Page 1 of 1

Saving Stream to File Using libvlc

Posted: 17 Nov 2016 14:55
by manaphy
Hello,

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?

Re: Saving Stream to File Using libvlc

Posted: 17 Nov 2016 17:43
by Rémi Denis-Courmont
Check the verbose logs.

Re: Saving Stream to File Using libvlc

Posted: 18 Nov 2016 08:30
by manaphy
There doesn't seem to be any error other than "core input error: ES_OUT_RESET_PCR called" and "decode_slice_header error".

Since the functions I'm using are undocumented, I wonder if they are right for my purpose?

And I'm using libvlc_media_player_play to play the stream at the same time (while streaming) and the problem seems to happen when I stop the stream with libvlc_vlm_stop_media. The problem doesn't seem to happen in some other formats than mpg.

Re: Saving Stream to File Using libvlc

Posted: 18 Nov 2016 19:23
by Rémi Denis-Courmont
decode_slide_header error implies the source is corrupt. So then it's no surprise that the output is corrupt too.