Hi
I need to stream a video file and save it using LIBVLC. Here is what I have done so far:
libvlc_media_t* vlcMedia = nullptr;
libvlc_instance_t* vlcInstance = libvlc_new(0, nullptr);
vlcMedia = libvlc_media_new_location(vlcInstance, aUri);
if(nullptr != vlcMedia)
{
libvlc_media_player_t* vlcMediaPlayer = libvlc_media_player_new_from_media(vlcMedia);
if(nullptr != vlcMediaPlayer)
{
libvlc_media_release(vlcMedia);
libvlc_event_manager_t* vlcMediaManager = libvlc_media_player_event_manager(vlcMediaPlayer);
if(nullptr != vlcMediaManager)
libvlc_event_attach(vlcMediaManager, libvlc_MediaPlayerEndReached, OnStopped, this);
libvlc_media_player_set_hwnd(vlcMediaPlayer, Handle);
libvlc_media_player_play(vlcMediaPlayer);
}
}
This will connect to the remote media and starts playing the video. The question is how do I direct it to save the video? I could not find the API call for that.
Thank you
Sam
Thanks to @mtz the solution is to add:
libvlc_media_add_option(vlcMedia,":sout=#duplicate{dst=display,dst=std{access=file,mux=mp4,dst=xyz.mp4}");
after the call to libvlc_media_new_location
.