i.MX8M Mini H.264 video recording to MP4 using GStreamer vpuenc_h264

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

i.MX8M Mini H.264 video recording to MP4 using GStreamer vpuenc_h264

Jump to solution
4,313 Views
vincentz63
Contributor IV

I'm trying to understand the effect of the few properties available on the i.MX8MMini's vpuenc_h264 (quant, bitrate and gop-size) by recording video captured from the OV5640 camera to MP4 using GStreamer.

I can generate a valid h264 stream but not the MP4 file.

I'm using the following launch cmd, which is based on the launch cmd on Section 7.3.6 of the "i.MX_Linux_User's_Guide": "Video Recording".

gst-launch-1.0 videotestsrc num-buffers=300 ! video/x-raw,width=1920,height=1080,format=YUY2 ! queue ! vpuenc_h264 ! mp4mux ! filesink location=./output.mp4 

An MP4 file is created, but it is always 595 bytes long and not playable.

I get the following debug output from GStreamer; the two warnings seem relevant but I do not know their meaning nor how to resolve them.

Pipeline is PREROLLING ...
0:00:00.059879402  4082     0x342070a0 FIXME                default gstutils.c:3981:gst_pad_create_stream_id_internal:<videotestsrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:00.173860030  4082     0x342070f0 WARN                GST_PADS gstpad.c:4226:gst_pad_peer_query:<vpuenc_h264-0:src> could not send sticky events
0:00:00.185602133  4082     0x342070f0 WARN                GST_PADS gstpad.c:4226:gst_pad_peer_query:<vpuenc_h264-0:src> could not send sticky events
0:00:07.601486136  4082     0x342070f0 FIXME               basesink gstbasesink.c:3145:gst_base_sink_default_event:<filesink0> stream-start event without group-id. Consider implementing group-id handling in the upstream elements
Pipeline is PREROLLED ...

The following launch cmd does stream the H.264 stream to a file that can be played back with VLC.

gst-launch-1.0 videotestsrc num-buffers=300 ! video/x-raw,width=1920,height=1080,format=YUY2 ! queue ! vpuenc_h264 ! filesink location=./output.h264
Labels (1)
1 Solution
3,963 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello JP,

Hello,

 

Please try the below command:

 

gst-launch-1.0 videotestsrc num-buffers=100 ! video/x-raw,width=1920,height=1080,format=YUY2 ! queue ! vpuenc_h264 ! h264parse ! mp4mux ! filesink l
ocation=./output.mp4

 

Regards,

View solution in original post

2 Replies
3,963 Views
vincentz63
Contributor IV

Many, many thanks! Was missing the h264parse element!

0 Kudos
3,964 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello JP,

Hello,

 

Please try the below command:

 

gst-launch-1.0 videotestsrc num-buffers=100 ! video/x-raw,width=1920,height=1080,format=YUY2 ! queue ! vpuenc_h264 ! h264parse ! mp4mux ! filesink l
ocation=./output.mp4

 

Regards,