I need to develop an application that can record up to 10 rtsp streams coming from IP cameras to files.
I also need to be able to play this files while the recording updates them.
The VLC version is 2.2.6.
I have been trying different options strings passed to libvlc_media_add_option function.
std::ostringstream sStreamOption;
// Version 1
Code: Select all
sStreamOption << ":sout=#standard{access=file,mux=ts,dst=" << outputFile << "}";
Code: Select all
sStreamOption << ":sout=#file{dst=" << outputFile << "}";
Code: Select all
_pInstance = libvlc_new (0, NULL);
if (_pInstance != NULL)
{
_pMedia = libvlc_media_new_location (_pInstance, url.c_str ());
if (_pMedia != NULL)
{
libvlc_media_add_option (_pMedia, sStreamOption.str ().c_str ());
_pMediaPlayer = libvlc_media_player_new_from_media (_pMedia);
if (_pMediaPlayer != NULL)
libvlc_media_player_play (_pMediaPlayer);
}
}
When I use version 1 for the options, some of the streams are recorded properly, some of them generate huge file (it can reach a 1 GB very quickly), some others seems to be stopped. These huge files can't be played with any player.
When I use version 2 for the options, I have the same symptoms, plus the facts that I can't play the files while they are recording.
So I have the following questions :
- Can I execute this code from different threads?
- Which options do I need to pass to libvlc_media_add_option, knowing that no transcoding is needed?
Thanks for help!