Saving Stream to File Using libvlc

This forum is about all development around libVLC.
manaphy
New Cone
New Cone
Posts: 2
Joined: 17 Nov 2016 14:38

Saving Stream to File Using libvlc

Postby manaphy » 17 Nov 2016 14:55

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?

Rémi Denis-Courmont
Developer
Developer
Posts: 15268
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Saving Stream to File Using libvlc

Postby Rémi Denis-Courmont » 17 Nov 2016 17:43

Check the verbose logs.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

manaphy
New Cone
New Cone
Posts: 2
Joined: 17 Nov 2016 14:38

Re: Saving Stream to File Using libvlc

Postby manaphy » 18 Nov 2016 08:30

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.

Rémi Denis-Courmont
Developer
Developer
Posts: 15268
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Saving Stream to File Using libvlc

Postby Rémi Denis-Courmont » 18 Nov 2016 19:23

decode_slide_header error implies the source is corrupt. So then it's no surprise that the output is corrupt too.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 17 guests