[FFmpeg-user] Minimize CPU use with QuickSync?

Li, Zhong zhong.li at intel.com
Thu Jul 5 17:16:11 EEST 2018

> -----Original Message-----
> From: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] On Behalf Of
> Jason Coleman
> Sent: Friday, June 29, 2018 4:49 AM
> To: ffmpeg-user at ffmpeg.org
> Subject: [FFmpeg-user] Minimize CPU use with QuickSync?
> Hello,
> I recently picked up a computer with a Kaby Lake processesor, and I'm trying
> to setup ffmpeg transcodes to minimize impact to the CPU and maximize use
> of QuickSync during transcodes. I am going by indirect indicators (CPU use
> and GPU use, as indicated in the Windows 10 task manager) + what ffmpeg
> output says. I thought I had the entire pipeline (decode/scale-resize/encode)
> being performed by Quicksync, but I'm still getting a lot of CPU use, call it
> 70-90%. 

This is not an "entire" Quciksync pipeline as your command line below. 
You are using a software decoder output to system memory, then upload as qsv surface and use qsv to do scaling and encoding.
So high CPU usage is normal IMHO. 

Maybe my expectations are out of line and I need to adjust those?
> Am I missing anything that would cause operations to happen on the CPU
> instead? I'm currently using a zeranoe 64 bit build, on Win10 home, with the
> current Intel drivers. So this is an example encoding line, I don't have an
> output from ffmpeg in front of me, apologies, I can put one up later:
> C:\ffmpeg\ffmpeg.exe -hwaccel qsv -init_hw_device
> qsv=qsv:MFX_IMPL_hw_any -filter_hw_device qsv -i "testvid.mp4" -vf
> "format=nv12,hwupload=extra_hw_frames=100,scale_qsv=640:360" -b:v
> 800k -c:v h264_qsv -c:a copy -y "testoutput.mp4"

Is there any reason to use software decoder? If no, you can try to add "-c:v h264_qsv" to specify qsv decoder (then "-init_hw_device qsv=qsv:MFX_IMPL_hw_any -filter_hw_device qsv" is not necessary, and also remove "hwupload"):
C:\ffmpeg\ffmpeg.exe -hwaccel qsv -c:v h264_qsv -i "testvid.mp4" -vf
"scale_qsv=640:360" -b:v 800k -c:v h264_qsv -c:a copy -y "testoutput.mp4"

<I haven't set up QSV on windows yet. If this doesn't work, please let me know>

> Thank you!
> Jason

More information about the ffmpeg-user mailing list