[FFmpeg-user] Minimize CPU use with QuickSync?
pobox at chiencorp.com
Fri Jul 6 18:33:06 EEST 2018
I didn't have a specific reason to utilize the software decoder. I didn't realize I still was. In retrospect, it makes sense that I would have to specify the decoder as well, I'd chalk it up to lack of familiarity with how ffmpeg works. I made the changes you suggested, which really makes for a much simpler looking command, so that's nice. I had built my command based on information I scraped together doing a lot of reading of out-dated posts and a lot of searching online.
In any event, I'm still seeing around 20% CPU usage, but I'm not sure from where, but I'm really pleased with the change because on the GPU end, I'm seeing around 75% utilization now, and in particular where my transcode was running around 4x before, it's running around 16x now, so that's fantastic. I'm not 100% sure that the CPU usage isn't just from more network overhead from everything running so much faster.
I've also run into the occasional file that fails to transcode because it looks like something in the stream is breaking the QS decoder, actually. Some entries on the ffmpeg bug list suggest it's a problem in how QuickSync is handling some frame types? Anyway, different problem, but I'm keeping my original line around as well, so that for the files I have problems with, I can switch back to the software decoder.
Thank you, that was very helpful!
From: ffmpeg-user <ffmpeg-user-bounces at ffmpeg.org> on behalf of Li, Zhong <zhong.li at intel.com>
Sent: Thursday, July 5, 2018 10:16 AM
To: FFmpeg user questions
Subject: Re: [FFmpeg-user] Minimize CPU use with QuickSync?
> -----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?
> 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
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!
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
To unsubscribe, visit link above, or email
ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user