gstreamer iMX8M mini capture to file

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

gstreamer iMX8M mini capture to file

1,856 Views
davidvescovi
Contributor V

Could someone post a "known good" gstreamer pipeline that run on the iMX8M mini using the vpuenc_h24 element to save a v4lv2 camera capture input to a mp4 file?

Tags (1)
0 Kudos
8 Replies

1,470 Views
igorpadykov
NXP Employee
NXP Employee

Hi David

below vpuenc_h264 example for H264 transcode which may be useful:

gst-launch-1.0 videotestsrc ! video/x-raw,width=1920,height=1080 ! queue max-size-time=0 ! vpuenc_h264 ! vpudec ! queue max-size-time=0 ! waylandsink enable-tile=true sync=false

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,470 Views
davidvescovi
Contributor V

Not much help, I need standard capture input (using the NXP official camera capture accessory … v4l2src) and saving to a MP4 file. 

0 Kudos

1,470 Views
igorpadykov
NXP Employee
NXP Employee

gst-launch-1.0 v4l2src ! video/x-raw,format=NV12,width=1920,height=1080 ! queue max-size-time=0 ! vpuenc_h264 ! h264parse ! vpudec ! queue max-size-time=0 ! waylandsink enable-tile=true sync=false

0 Kudos

1,470 Views
davidvescovi
Contributor V

how does this save to an MP4 file?

0 Kudos

1,470 Views
igorpadykov
NXP Employee
NXP Employee

this is just example for:

"standard capture input (using the NXP official camera capture accessory … v4l2src"

also may be useful sect.7.3.6 Video recording Linux Guide in Linux L4.14.98_2.0.0 Documentation

0 Kudos

1,470 Views
davidvescovi
Contributor V

The document you refer to is the one I have been working from.

With your example I get:

Setting pipeline to PAUSED ...                                                 
====== VPUDEC: 4.4.5 build on Aug 13 2019 14:09:44. ======                     
        wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Jun  3 2019 09:53:37)  
        vpulib: 1.1.1                                                          
        firmware: 1.1.1.0                                                      
====== VPUENC: 4.4.5 build on Aug 13 2019 14:09:44. ======                     
        wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Jun  3 2019 09:53:37)  
        vpulib: 1.1.1                                                          
        firmware: 1.1.1.65535                                                  
Pipeline is live and does not need PREROLL ...                                 
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data st
ream error.                                                                    
Additional debug info:                                                         
../../../../git/libs/gst/base/gstbasesrc.c(3055): gst_base_src_loop (): /GstPipe
line:pipeline0/GstV4l2Src:v4l2src0:                                            
streaming stopped, reason not-negotiated (-4)                                  
ERROR: pipeline doesn't want to preroll.                                       
Setting pipeline to PAUSED ...                                                 
Setting pipeline to READY ...                                                  
Setting pipeline to NULL ...                                                   
Freeing pipeline ...                

so I tried:

gst-launch-1.0 -e v4l2src ! video/x-raw,format=NV12,width=1920,height=1080 ! queue max-size-time=0 ! vpuenc_h264 ! h264parse ! vpudec ! queue max-size-time=0 ! filesink location=camera2x.mp4

and

gst-launch-1.0 -e v4l2src ! video/x-raw,format=NV12,width=1920,height=1080 ! queue max-size-time=0 ! vpuenc_h264 ! h264parse ! mp4mux ! filesink location=camera2x.mp4

and various other combinations and all fail for some reason or another.

This appears to be close:

gst-launch-1.0 -e v4l2src ! videoconvert ! queue ! vpuenc_h264 ! h264parse ! mp4mux ! filesink location=camera.mp4

but after I cancel the file size is always zero.

0 Kudos

1,470 Views
igorpadykov
NXP Employee
NXP Employee

gst-launch-1.0 videotestsrc num-buffers=100 ! video/x-raw,width=1920,height=1080 ! videoparse format=2 witdh=1920 height=1080 framerate=30/1 ! vpuenc_h264 ! avimux ! filesink location=filename_1920_1080.avi

0 Kudos

1,470 Views
davidvescovi
Contributor V

generates a file so it is closer. transferred to PC, player reads but displays junk.

0 Kudos