In the case of the i.MX VPU Hantro, while encoding a 1080p video, I considered two different approaches:
MP4 → YUV → H.264
MP4 → H.264
I noticed that the first approach consumes significantly more CPU load compared to the second approach. Is that intermediate conversion required?
1) Approach 1
>decode mp4 to yuv
gst-launch-1.0 filesrc location=5MB_1080p.mp4 ! qtdemux ! h264parse ! imxvpudec_h264 ! filesink location=1080p.yuv
CPU load: 90 %
>encode yuv to h264
gst-launch-1.0 filesrc location=1080p.yuv ! videoparse width=1920 height=1080 format=nv12 framerate=30/1 ! imxvpuenc_h264 ! h264parse ! filesink location=1080p.h264
CPU load: 35.9%
2) Approach 2
> Decode and Encode in a Single Pipeline
gst-launch-1.0 filesrc location=5MB_1080p.mp4 ! qtdemux name=demux demux.video_0 ! h264parse ! imxvpudec_h264 ! imxvpuenc_h264 ! h264parse ! filesink location=enc.h264
CPU load: 6.6%