AnsweredAssumed Answered

1080p h264 encoding error

Question asked by Chris Roed on Jul 30, 2019
Latest reply on Aug 3, 2019 by Chris Roed

I've had a real tough time trying to push my camera up from 720p to 1080p...  See earlier (https://community.nxp.com/thread/508198).  Long story short, converting UYVY to YUV420 frames resulted in a green bar on the right side of the screen.  Using gstreamer is a guide, I discovered that the NV12 format resulted in a perfect output from the IPU.

 

Now... on to the video encoding.  I've changed all my code to use NV12, and I'm trying to do h264 encoding.  I modified the encode-example in libimxvpuapi (https://github.com/Freescale/libimxvpuapi/blob/v1/example/encode-example.c) to encode 1080p video, and use the raw NV12 stream recorded previously. 

I made sure to set the vpu_open_param.chroma_interleave=1 so that the VPU knows it is an NV12 stream. 

I also modified the call to imx_vpu_calc_framebuffer_sizes so that chroma_interleave is 1

 

1 frame from input:

 

1 frame from output:

 

 

 

You'll notice there's another green bar at the bottom of the screen this time, and something is messed up in the overlay text.

 

As with my color conversion problems, I tried using gstreamer to convert the raw video file and gstreamer worked perfectly.  

 

$gst-launch-1.0 filesrc location="1080_overlay.nv12" ! rawvideoparse use-sink-caps=false width=1920 height=1080 format=nv12 ! vpuenc_h264 ! queue ! flvmux ! filesink  location="gst_overlay_1080.mp4"

Outcomes