Changing filesink location dynamically

ivan-perez ivan at encore-lab.com
Wed Feb 1 16:30:42 UTC 2017


Hello

I have a pipeline which gets a video in H.264 format from a camera and
splits it into two sinks: a RTP sink and a file sink. I want the file sink
to create videos of 10 seconds every minute.

This is my pipeline at the moment:

          fdsrc \
          !
video/x-h264,width=320,height=240,framerate=30/1,profile=baseline,stream-format=avc,alignment=au
\
          ! h264parse \
          ! tee name=split \
         split. \
          ! queue max-size-buffers=100 max-size-bytes=102400
max-size-time=250000000 \
          ! rtph264pay config-interval=1 pt=96 \
          ! multiudpsink sync=false \
         split. \
          ! queue \
          ! mp4mux name=mp4mux \
          ! filesink location=video1.mp4 name=fsink

So, in one thread of my application in C, I try to stop the recording of the
first video and then create a new one after 50 seconds. This is my code:

    /* pipeline started */
    int i;
    for (i = 2; i < 10; i++) {
        sleep(10);
        gst_element_send_event(mp4mux, gst_event_new_eos());
        gst_element_set_state(fsink, GST_STATE_NULL);
        
        sleep(50);
        g_object_set(fsink, "location", "video{$i}.mp4", NULL);/* of course
with that `$i` properly set */
        gst_element_set_state(fsink, GST_STATE_PLAYING);
    }

What do I get? Right after the EOS event is sent into the pipeline, the
whole pipeline stops. I get a GST_MESSAGE_EOS in the main loop and it
therefore stops. It's like that EOS is going up in the pipeline and being
transmitted into all the elements, while what I want is that the EOS event
is only sent to the 'mp4mux' and its children (i.e. the 'filesink' element).
What's more, the video is not playable (VLC says its format is not correct).

What am I doing wrong? Thanks in advance!

Kind regards.



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Changing-filesink-location-dynamically-tp4681677.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list