Recording and Displaying Streams Simultaneously
Posted: 23 Oct 2018 15:43
Hello everyone,
I have Qt application which allows users to watch a stream, and record this stream if needed.The interface looks as follows;
https://imgur.com/a/CGB8vP7
So "Open Stream Button" allows user to watch a specific stream and "Record Stream Button" displays and record the stream simultaneously. So far everything is fine. My problem is that when the user watches the stream and wants to record it, I have to stop the Vlc instance and open the media with new parameters. What I want to do is record the stream without stopping VLC media. Here's a part of my code;
TO DISPLAY STREAM:
TO DISPLAY AND RECORD STREAM:
As I said, this code works just fine but everytime I start/stop recording, I have to stop and open the media as well. VLC Media Player "Record" button does this exactly how I want. If I open a media using VLC Media Player (i.e. VLC 2.2.8 ), and then press the record button. And you will see that the media is not restarted. Is there any way I can achieve this?
NOTE: I tried this creating two different VLC instances and two different player instances. But in that case, if I open a stream with one player, the other player doesnt record the stream at all. I think the reason behind it is that both players are trying to listen to the same udp port, and only one of them can access.
I have Qt application which allows users to watch a stream, and record this stream if needed.The interface looks as follows;
https://imgur.com/a/CGB8vP7
So "Open Stream Button" allows user to watch a specific stream and "Record Stream Button" displays and record the stream simultaneously. So far everything is fine. My problem is that when the user watches the stream and wants to record it, I have to stop the Vlc instance and open the media with new parameters. What I want to do is record the stream without stopping VLC media. Here's a part of my code;
TO DISPLAY STREAM:
Code: Select all
QString url = "udp://@239.255.255.10:1234";
VlcMedia media = new VlcMedia(url, instance);
VlcMediaPlayer *player = new VlcMediaPlayer(instance);
player->open(media);
Code: Select all
player->stop();
QString recordOption = ":sout=#duplicate{dst=display, dst=std{access=file,mux=ts,dst=save.ts}}";
libvlc_media_add_option(media->core(), recordOption.toUtf8().data());
player->open(media);
NOTE: I tried this creating two different VLC instances and two different player instances. But in that case, if I open a stream with one player, the other player doesnt record the stream at all. I think the reason behind it is that both players are trying to listen to the same udp port, and only one of them can access.