Saving stream to file on unstable communication line

alexolut alexolut at gmail.com
Mon Oct 31 08:30:42 UTC 2016


I have wrote C++ application which saves RTSP stream to separate files using
gst_parse_launch() and pipeline like following for command line: 

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

When connection fails I get error via:
    gst_bus_pop_filtered(bus, GST_MESSAGE_ERROR);
then send EOS to pipeline via:
    gst_element_send_event(pipeline, gst_event_new_eos());
set pipeline to NULL state:
   gst_element_set_state(pipeline, GST_STATE_NULL);
and go to the next iteration where I try to connect with:
   gst_element_set_state(pipeline, GST_STATE_GST_STATE_PLAYING);
In each iteration I destroy old pipeline and create new one.

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?



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Saving-stream-to-file-on-unstable-communication-line-tp4680334.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list