[FFmpeg-user] Multicore CPU run

Dennis Mungai dmngaie at gmail.com
Sat Feb 2 18:14:57 EET 2019


On Sat, 2 Feb 2019 at 18:47, Mahmood Naderan <mahmood.nt at gmail.com> wrote:

> >Then don't use the cuda filter.
>
> So, my time measurements show that
>
> CPU:  ./ffmpeg  -i ../4k_normal.mp4 -vf scale=1280:720 720p1.mp4
> real    0m23.748s
>
> GPU: ./ffmpeg -hwaccel cuvid -c:v h264_cuvid -i ../4k_normal.mp4 -vf
> scale_npp=1280:720 -c:v h264_nvenc 720p1.mp4
> real    0m20.889s
>
>
>
> Do you think that is normal?
>
> Regards,
> Mahmood
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


And yes, what you're seeing here is normal.

The scale filter is software based (and doesn't thread so well).
The scale_npp (and scale_cuda) run on the GPU and should be slightly faster
for single transcodes, and much faster with 1:N transcodes.
There's a patch set on this mailing list that speeds up 1:N transcodes when
paired with multiple scalers behind -filter_complex, via a new abr_pipeline
option...

For initializing the device for filtering, pass this to ffmpeg before the
-i section:

-init_hw_device cuda=0 -filter_hw_device 0


Assuming you're also running the NVENC encoder on that GPU number (via the
-gpu 0 ) option, etc, when you have multiple NVENC capable GPUs.

And for the scaler, you'll want to call up a hwupload+format filter chain
as shown:

format=nv12,hwupload,scale_npp=w=1280:h=720


Using your sample above:

./ffmpeg -init_hw_device cuda=0 -i ../4k_normal.mp4 -vf
format=nv12,hwupload,scale_npp=1280:720 -c:v h264_nvenc 720p1.mp4

Try that and report back.


More information about the ffmpeg-user mailing list