Why Gstreamer encoding takes more cpu load while encoding .yuv than .mp4

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

Why Gstreamer encoding takes more cpu load while encoding .yuv than .mp4

Jump to solution
476 Views
Hariharan1
Contributor III

In the case of the i.MX VPU Hantro, while encoding a 1080p video, I considered two different approaches:

  1. MP4 → YUV → H.264

  2. 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%

 

 

0 Kudos
Reply
1 Solution
441 Views
pengyong_zhang
NXP Employee
NXP Employee

Hi @Hariharan1 

yes, you are right, At approach 1, The primary causes of high CPU load are: extensive data writes to disk and data shuffling during the decoding process. But approach 2, There are no intermediate disk write and read operations; data is directly transferred in memory. So, in your current scenario, approach 2 is the best choice.

B.R

View solution in original post

0 Kudos
Reply
1 Reply
442 Views
pengyong_zhang
NXP Employee
NXP Employee

Hi @Hariharan1 

yes, you are right, At approach 1, The primary causes of high CPU load are: extensive data writes to disk and data shuffling during the decoding process. But approach 2, There are no intermediate disk write and read operations; data is directly transferred in memory. So, in your current scenario, approach 2 is the best choice.

B.R

0 Kudos
Reply