How to generate Vlc Stream Output String in Qt application
-
I am developing a media player in
Qt
usinglibvlc
throughvlc-qt
wrapper and want to do the video streaming from that player and I have seen If I do the streaming throughVLC
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 theVLC
does.
My code to stream the same video using same codecsm_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:Streaming_HowTo_New/
https://wiki.videolan.org/Documentation:Streaming_HowTo/Command_Line_Examples/
https://wiki.videolan.org/Documentation:Streaming_HowTo/Advanced_Streaming_Using_the_Command_Line/
-
@devillIsHeree said in How to generate Vlc Stream Output String in Qt application:
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
I'm not sure what exactly the problem is?
You can simply use a string as template and put the information user entered in that string, like:QString vlcString = QString(":sout=#transcode{vcodec=%1,venc=x264{qp=5}...").arg(codecString)...
-
Hi,
@devillIsHeree said in How to generate Vlc Stream Output String in Qt application:
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.
No there's not as there are way to many possibilities to mix:
- Container format
- Audio stream format
- Video stream format
- Audio sample rate
- Video sample rate
- Audio quality depending on the codec
- Video quality depending on the codec
etc.
If you want to provide choices to your users, you need to create a "stream definition builder" using for example QString::arg as @jsulm suggested.