Dynamically Record Video

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynamically Record Video

Jump to solution
302 Views
itaigolan
Contributor II

Hi, I’m displaying a video from v4l2src in a waylandsink and while I’m doing that I want to dynamically record the video to an mp4. I want to allow a user provided input to determine when to start recording to an mp4 and when to stop the recording. The recording pipeline I’m currently using is:
gst-launch-1.0 v4l2src ! vpuenc_h264 ! h264parse ! mp4mux ! filesink location=sample.mp4 -e

I tried connecting the recording pipeline to a tee and then deleting it when I’m done recording and I was able to get video to record but that approach causes problems after starting and stopping recording multiple times. Does anyone know a way I can approach this, preferably by just pausing the recording section of the pipeline?

 
Labels (1)
0 Kudos
1 Solution
239 Views
malik_cisse
Senior Contributor I

Hi @itaigolan,
I would implement a gstreamer Tee that sinks in an Appsink. After that, every time a new recording event occurs, I will start a recording pipeline using Appsrc. This would be my best bet.

You might alternatively look at Ridgerun Interpipe that can do similar stuff:
https://developer.ridgerun.com/wiki/index.php/GstInterpipe_-_GstInterpipe_Overview 

Using pause or start/stop does not work well with MP4 because MP4 needs a proper file header that contains all key frame positions of the stream. A more robust file format for this is Mpeg-TS. H.264 elementary stream embeds very well in *.ts files and TS muxer are available in stock Gstreamer.

View solution in original post

0 Kudos
4 Replies
240 Views
malik_cisse
Senior Contributor I

Hi @itaigolan,
I would implement a gstreamer Tee that sinks in an Appsink. After that, every time a new recording event occurs, I will start a recording pipeline using Appsrc. This would be my best bet.

You might alternatively look at Ridgerun Interpipe that can do similar stuff:
https://developer.ridgerun.com/wiki/index.php/GstInterpipe_-_GstInterpipe_Overview 

Using pause or start/stop does not work well with MP4 because MP4 needs a proper file header that contains all key frame positions of the stream. A more robust file format for this is Mpeg-TS. H.264 elementary stream embeds very well in *.ts files and TS muxer are available in stock Gstreamer.

0 Kudos
148 Views
itaigolan
Contributor II

Thanks for the response, I got good results using the appsink approach.

287 Views
joanxie
NXP TechSupport
NXP TechSupport

what processor and bsp version do you use? and what kind of problem do you have? 

0 Kudos
263 Views
itaigolan
Contributor II

The processor is imx8mp and we are running Mickledore. My question is how do I set up a system where I can dynamically start and stop video recording while constantly displaying the video on a waylandsink.

0 Kudos