Saving stream to file on unstable communication line

Tim Müller tim at centricular.com
Mon Oct 31 09:15:51 UTC 2016


On Mon, 2016-10-31 at 01:30 -0700, alexolut wrote:

Hi,

> gst-launch-1.0 -e rtspsrc location=rtsp://path/to/src !
> rtpjitterbuffer !
> rtpmp4vdepay ! mpeg4videoparse ! splitmuxsink location=video%d.avi
> max-size-time=10000000000 max-size-bytes=1000000

Just on a side note, you are not creating AVI files here (since you
don't use avimux as muxer, the default muxer of splitmuxsink is
mp4mux).

> When connection fails I get error via: (..)
> Most times everything work perfect, but occasionally I get broken
> files (ffmpeg detects it with message: "[mov,mp4,m4a,3gp,3g2,mj2 @
> 00967fe0] moov atom not found") which can't be played.
> 
> My question is: what I need to do in my code to guarantee that file
> closed correctly after connection was broken? In another words: how
> to do what is option "-e" does for gst-launch util?

The easiest option might be to use a container format where the content
survives even if it's not finalised properly, for example Matroska or
MPEG-TS.

For MP4, you use mp4mux's "reserved-*" properties to make sure the file
always stays valid, and set it as muxer on splitmuxsink. This means
some data might be lost at the end though, depending on the update
period.

Cheers
 -Tim


-- 
Tim Müller, Centricular Ltd - http://www.centricular.com


More information about the gstreamer-devel mailing list