Display with recording

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

Display with recording

Ilya Aleshkov
Hi,

I'm using a pipeline like this

gst-launch-1.0 videotestsrc ! tee name=t t. ! queue ! glimagesink t. ! queue ! x264enc tune=zerolatency ! filesink location=video.h264

Everything works. I'm able to display and record at the same time. Now I'd like to start/stop recording at any time. What is the best strategy to achieve this?
I know that it's a pretty common question. I have already read a lot of materials. But this situation still isn't clear for me.

Thanks,
Ilya

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

Re: Display with recording

Nicolas Dufresne-5
Le jeudi 01 novembre 2018 à 19:48 +0300, Ilya Aleshkov a écrit :

> Hi,
>
> I'm using a pipeline like this
>
> gst-launch-1.0 videotestsrc ! tee name=t t. ! queue ! glimagesink t.
> ! queue ! x264enc tune=zerolatency ! filesink location=video.h264
>
> Everything works. I'm able to display and record at the same time.
> Now I'd like to start/stop recording at any time. What is the best
> strategy to achieve this?
> I know that it's a pretty common question. I have already read a lot
> of materials. But this situation still isn't clear for me.
First, you'll need an app, since that's the limit of what gst-launch-
1.0 tool can handle. To me, the simple strategy is to keep the
recording pipeline separate. So you'd have:

  videotestsrc ! tee name=t
    t. ! queue ! glimagesaink
    t. ! queue ! appsink

  appsrc ! x264enc tune=zerolatency ! video/x-h264,stream-format=byte-stream ! filesink location=video.h264

And then your app will pass the samples from appsink to appsrc. You'll
have the option to make this callback based, blocking loop or a mix.
When you want to stop the recording you'd do:

  - gst_app_src_end_of_stream (appsrc)
  - wait for eos message and reset that pipeline
  - stop further samples.

And then to start again, you simply stop dropping samples.

Nicolas

>
> Thanks,
> Ilya
> _______________________________________________
> 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: Display with recording

Ilya Aleshkov
Nicolas, thank you so much!
Your solution looks much more elegant than mine. I'll try it. Right now I just pause my pipeline, modify it and start it again. My strategy generates noticeable freezes.

Ilya

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