Low GPU utilization

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Low GPU utilization

Mahmood Naderan
Hi,
I have noted that the following command

./ffmpeg -hwaccel nvdec -i ../4k_normal.mp4 -preset medium -movflags
+faststart -c:a aac ../4k_normal_conv.mp4

utilizes the GPU for about 20% according to nvidia-smi. That is pretty low
while 500MB out of 4GB of device memory is occupied.

Is that normal? Or there are some options missing here?
ffmpeg has a lot of options and I am confused about how to combine them. If
somebody can help, I will appreciate it.

Regards,
Mahmood
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Low GPU utilization

Moritz Barsnick
On Thu, Jan 24, 2019 at 00:07:36 +0330, Mahmood Naderan wrote:
> ./ffmpeg -hwaccel nvdec -i ../4k_normal.mp4 -preset medium -movflags
> +faststart -c:a aac ../4k_normal_conv.mp4
>
> utilizes the GPU for about 20% according to nvidia-smi. That is pretty low
> while 500MB out of 4GB of device memory is occupied.

You're only using the GPU for decoding. (The "dec" in "nvdec" hints at
this.) The GPU probably idling, while the CPU encoding is the bottleneck.

> Is that normal? Or there are some options missing here?
> ffmpeg has a lot of options and I am confused about how to combine them. If
> somebody can help, I will appreciate it.

Check here for the proper syntax:
https://trac.ffmpeg.org/wiki/HWAccelIntro#NVENCNVDEC

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Low GPU utilization

Mahmood Naderan
>You're only using the GPU for decoding. (The "dec" in "nvdec" hints at
>this.) The GPU probably idling, while the CPU encoding is the bottleneck.

Even for encoding, I see 10% GPU utilization

./ffmpeg -i ../4k_normal.mp4 -c:v h264_nvenc 4k.mp4


Regards,
Mahmood
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Low GPU utilization

Mahmood Naderan
Guys, I tried the example from Nvidia website [1] for "Transcode a single
video file" in order to trranscode a 4K video to a 4K video.


$ ./ffmpeg -hwaccel cuvid -c:v h264_cuvid -i ../4k_normal.mp4 -vf
scale_npp=3840:2160 -c:v h264_nvenc 4k.mp4
ffmpeg version N-93005-gd92f06eb66 Copyright (c) 2000-2019 the FFmpeg
developers
  built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
  configuration: --enable-cuda --enable-cuvid --enable-nvenc
--enable-nonfree --enable-filter=scale_cuda --enable-cuda-sdk
--enable-libnpp --extra-cflags=-I/usr/local/cuda/include
--extra-ldflags=-L/usr/local/cuda/lib64
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 44.100 / 58. 44.100
  libavformat    58. 26.100 / 58. 26.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../4k_normal.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.71.100
  Duration: 00:01:31.91, start: 0.000000, bitrate: 32684 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
3840x2160 [SAR 1:1 DAR 16:9], 32482 kb/s, 29.97 fps, 29.97 tbr, 30k tbn,
59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 195 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
File '4k.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mp4, to '4k.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.26.100
    Stream #0:0(und): Video: h264 (h264_nvenc) (Main) (avc1 / 0x31637661),
cuda, 3840x2160 [SAR 1:1 DAR 16:9], q=-1--1, 2000 kb/s, 29.97 fps, 30k tbn,
29.97 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.44.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay:
-1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc58.44.100 aac
frame= 2760 fps=111 q=37.0 Lsize=   25235kB time=00:01:32.05
bitrate=2245.6kbits/s dup=5 drop=0 speed=3.72x
video:23717kB audio:1441kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.307457%
[aac @ 0x55e602553980] Qavg: 135.844




That utilizes GPU for about 20%. Is that all? Or there are some options for
better using GPU?

[1] https://developer.nvidia.com/ffmpeg



Regards,
Mahmood




On Thu, Jan 24, 2019 at 10:25 AM Mahmood Naderan <[hidden email]>
wrote:

> >You're only using the GPU for decoding. (The "dec" in "nvdec" hints at
> >this.) The GPU probably idling, while the CPU encoding is the bottleneck.
>
> Even for encoding, I see 10% GPU utilization
>
> ./ffmpeg -i ../4k_normal.mp4 -c:v h264_nvenc 4k.mp4
>
>
> Regards,
> Mahmood
>
>
>
>
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".