Trying to save stream to different files

dv dv at pseudoterminal.org
Mon Aug 6 04:52:55 PDT 2012


On 07/03/12 20:46, oligarch wrote:
> Hello everybody.
>
> I know that subject is very popular here but any suggested decisions do not
> work for me, I don't know why.
> I have a h264 video stream and i want to save it directly to different files
> via "h264parse", "matroskamux" and "filesink" gstreamer elements. I want to
> generate a new file each hour for instance. The pipeline tail which is
> saving stream into file is:
>
> ....<recieving H264 stream>.... -> tee -> FILE_queue -> h264parse ->
> matroskamux -> filesink
>
> (here "FILE_queue" is the name of the queue element just for convenience)
>
> For changing filesink location I am trying to do the following:
> 1) asynchronously blocking FILE_queue src pad with the callback
> 2) in this callback:
>                - unlink h264parse from FILE_queue
>                - send EOS to h264parse sink pad
>                - making this: g_idle_add(destroy_filesink_tail, NULL), where
> "destroy_filesink_tail" sets
>                  "h264parse", "matroskamux" and "filesink" to NULL state and
> after that it removes its from
>                  pipeline with gst_bin_remove
>                - adding to pipeline already created new elements
> "h264parse2", "matroskamux2" and "filesink2"
>                  where "filesink2" has a new location property
>                - linking new elements with FILE_queue;
>                - unblocking FILE_queue src pad with
> gst_pad_set_blocked_async(...FALSE...)
>

To me, this looks like you should use state changes instead. GStreamer 
is heavily multithreaded, and what you describe sounds like a deadlock.
Check out 
http://gstreamer.freedesktop.org/data/doc/gstreamer/0.10.36/gstreamer/html/GstElement.html#GstStateChange 
.


More information about the gstreamer-devel mailing list