I want to save an RTSP stream to a file using libvlc but I'm having some problems. Below is the code fragment I use:
Code: Select all
libvlc_vlm_add_broadcast(vlc, "test", testUrl,
"#transcode{vcodec=h264,venc=x264{cfr=16},scale=1,acodec=mp4a,ab=160,channels=2,samplerate=44100}:file{dst=test.mpg}",
0, NULL, 1, 0);
libvlc_vlm_play_media(vlc, "test");
This seems to save the file but the file is sometimes corrupted and VLC can't play it (sometimes it can).
Are these functions the right way to save stream to file using libvlc? What am I doing wrong?