How to generate Vlc Stream Output String in Qt application
Posted: 09 Dec 2020 08:30
I am developing a media player in ```Qt``` using ```libvlc``` through ```vlc-qt``` wrapper and want to do the video streaming from that player and I have seen If I do the streaming through ```VLC``` media player, I got one stream output string in the last window. For exmaple I get this the below string when I selected the video and it's stream options
```
:sout=#transcode{vcodec=h264,venc=x264{qp=5},scale=Auto,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:udp{dst=127.0.0.1:1234} :no-sout-all :sout-keep
```
And to do tthe streaming in my video player ```Qt``` application, I just pass this string to my player and it start streaming the video in the same way the ```VLC``` does.
My code to stream the same video using same codecs
```
m_media = new VlcMedia("file:///home/vinay/Desktop/Captain.America.Civil.WAR.2016.1080p.HD.TC.AC3.x264-ETRG/ETRG.mp4",m_instance);
m_media->setOption(":sout=#transcode{vcodec=h264,venc=x264{qp=5},scale=Auto,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:udp{dst=127.0.0.1:1234}");
m_media->setOption(":no-sout-all");
m_media->setOption(":sout-keep");
m_player->open(m_media);
```
So I got that this stream output string contains all the details which I require to do the streaming. So i want to do the same in my application where user choose the video clip and then choose the method of streaming and than codec and at last I want to generate the stream output string in the same way ```VLC``` media player does but I am not getting how can I generate this stream output string.
I searched in whole internet and get some documentation of streaming through command line in ```VLC``` where they explain the syntax and other thing of that string stream output but there are so many options available, I am still not getting how to implement that in Qt.
Please help is there any method exist which will give me the stream string output when i just pass the streaming method and codec to it.
The references which I get on internet are given below
https://wiki.videolan.org/Documentation ... HowTo_New/
https://wiki.videolan.org/Documentation ... _Examples/
https://wiki.videolan.org/Documentation ... mand_Line/
```
:sout=#transcode{vcodec=h264,venc=x264{qp=5},scale=Auto,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:udp{dst=127.0.0.1:1234} :no-sout-all :sout-keep
```
And to do tthe streaming in my video player ```Qt``` application, I just pass this string to my player and it start streaming the video in the same way the ```VLC``` does.
My code to stream the same video using same codecs
```
m_media = new VlcMedia("file:///home/vinay/Desktop/Captain.America.Civil.WAR.2016.1080p.HD.TC.AC3.x264-ETRG/ETRG.mp4",m_instance);
m_media->setOption(":sout=#transcode{vcodec=h264,venc=x264{qp=5},scale=Auto,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:udp{dst=127.0.0.1:1234}");
m_media->setOption(":no-sout-all");
m_media->setOption(":sout-keep");
m_player->open(m_media);
```
So I got that this stream output string contains all the details which I require to do the streaming. So i want to do the same in my application where user choose the video clip and then choose the method of streaming and than codec and at last I want to generate the stream output string in the same way ```VLC``` media player does but I am not getting how can I generate this stream output string.
I searched in whole internet and get some documentation of streaming through command line in ```VLC``` where they explain the syntax and other thing of that string stream output but there are so many options available, I am still not getting how to implement that in Qt.
Please help is there any method exist which will give me the stream string output when i just pass the streaming method and codec to it.
The references which I get on internet are given below
https://wiki.videolan.org/Documentation ... HowTo_New/
https://wiki.videolan.org/Documentation ... _Examples/
https://wiki.videolan.org/Documentation ... mand_Line/