Dynamically start and stop recording with tee branch to create seekable videos

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamically start and stop recording with tee branch to create seekable videos

gstreamer_webcam
Hello, I'm trying to start and stop a recording with a tee branch. Every time
when asked to start recording, tee will create a new branch with a unique
id. When asked to stop recording, the tee branch will be stopped and removed
(the other tee branch and pipeline is still functioning). How can I send EOS
to make the generated videos seekable?

One relevant hint in
http://gstreamer-devel.966125.n4.nabble.com/Dynamically-start-and-stop-recording-using-valve-td4670091.html,
but I don't know how to check if the EOS actually reaches the filesink
before setting the pipeline state to NULL.

Any ideas or code snippet would be appreciated.

My pipeline is something like this :

                  ^ ->  queue->x264enc->avimux->filesink
                  |
src->caps->tee-> queue->x264enc->avimux->filesink





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically start and stop recording with tee branch to create seekable videos

Nicolas Dufresne-5
Le mercredi 11 décembre 2019 à 15:43 -0600, gstreamer_webcam a écrit :

> Hello, I'm trying to start and stop a recording with a tee branch. Every time
> when asked to start recording, tee will create a new branch with a unique
> id. When asked to stop recording, the tee branch will be stopped and removed
> (the other tee branch and pipeline is still functioning). How can I send EOS
> to make the generated videos seekable?
>
> One relevant hint in
> http://gstreamer-devel.966125.n4.nabble.com/Dynamically-start-and-stop-recording-using-valve-td4670091.html,
> but I don't know how to check if the EOS actually reaches the filesink
> before setting the pipeline state to NULL.
Because it's quite difficult, the dev I know doing that same ended up
using  two pipelines for that. An appsink on the live pipeline and then
an appsrc on the recording pipeline. Both way can work, but I think the
split pipeline approach is far easier to get right. Draining a branch
of a pipeline is rather hard, but possible, and might also be needed in
some scenarios.

>
> Any ideas or code snippet would be appreciated.
>
> My pipeline is something like this :
>
>                   ^ ->  queue->x264enc->avimux->filesink
>                   |
> src->caps->tee-> queue->x264enc->avimux->filesink
>
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically start and stop recording with tee branch to create seekable videos

Tim Müller
In reply to this post by gstreamer_webcam
On Wed, 2019-12-11 at 15:43 -0600, gstreamer_webcam wrote:

Hi,

> Hello, I'm trying to start and stop a recording with a tee branch.
> Every time when asked to start recording, tee will create a new
> branch with a unique id. When asked to stop recording, the tee branch
> will be stopped and removed (the other tee branch and pipeline is
> still functioning). How can I send EOS to make the generated videos
> seekable?
>
> (snip)
> but I don't know how to check if the EOS actually reaches the
> filesink before setting the pipeline state to NULL.
>
> Any ideas or code snippet would be appreciated.

There is similar code in here (with extra feature to have some backlog
when you start recording, the code will get much more compact if you
remove that):

https://people.freedesktop.org/~tpm/code/test-backlog-recording-h264.c

https://people.freedesktop.org/~tpm/code/test-backlog-recording-h264-rtp.c

Important bits to grep for are "message-forward" and "GstBinForwarded".

(The main purpose here is to make sure to bypass the ususal
pipeline/bin EOS aggregation logic so that the application can pick up
the EOS from the filesink in one branch even if the sinks on the other
branches are not EOS yet.).

Cheers
 Tim

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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel