Jump to content

Is hardware acceleration being used


falsyana

Recommended Posts

falsyana

Hi,

I am trying to validate if my hardware acceleration is being used or not.

I am using the emby/embyserver container (under podman) and I manage to get Emby to recognize the videocard when browsing to Server -> Transcoding

1921376449_Annotation2020-07-12112236.png.f0ada6b0fc8513461c0291a4c2da5159.png

When I download a movie from an Android tablet it must transcode, and when I look in the logs it seems it's using the videocard:

# cat ffmpeg-transcode-7a8a2ddb-fbcc-4934-9fa3-90147def8929_1.txt
[ ... snip ... ]
>>>>>>  Affected codecs
Encoder NVENC GeForce GT 710 - H.264 (AVC)
        Adapter #0: 'GeForce GT 710' ComputeCapability: 3.5
        Frame Sizes: max 4096x4096 - Width Alignment: 2 - Height Alignment: 2
        Profiles: Baseline Profile (Level 6.2), Main Profile (Level 6.2), High Profile (Level 6.2), High 4:4:4 Predictive Profile (Level 6.2)

Decoder NVDEC GeForce GT 710 - H.264 (AVC)
        Adapter #0: 'GeForce GT 710' ComputeCapability: 3.5
        Frame Sizes: 48x16...4096x4096 - Width Alignment: 2 - Height Alignment: 2
        Profiles: Constrained Baseline Profile (Level 6), Baseline Profile (Level 6), Main Profile (Level 6), High Profile (Level 6), Constrained High Profile (Level 6), Progressive High Profile (Level 6)


>>>>>>  FindVideoEncoder - Media: h264, UseHardwareCodecs: True, Mode: Automatic
Info    Checking: 'NVENC GeForce GT 710 - H.264 (AVC)'
Info    Check successful - selecting 'NVENC GeForce GT 710 - H.264 (AVC)'

>>>>>>  FindVideoDecoder - MediaType: h264, Mode: Automatic
Info    Checking: 'NVDEC GeForce GT 710 - H.264 (AVC)'
Info    Check successful - selecting 'NVDEC GeForce GT 710 - H.264 (AVC)'

>>>>>>  Processing Plan
Info    Name                                        CanDoInHardware      WillDoInHardware     Reason                                  
Info    NVDEC GeForce GT 710 - H.264 (AVC)       >> True                 True                 Hardware Codec                           
Info    VideoInput                               >> True                 True                 Matching hardware context                
Info    VideoOutput                              >> True                 True                 Hardware encoder                         
Info    NVENC GeForce GT 710 - H.264 (AVC)       >> True                 True                 Hardware Codec                           

>>>>>>  Projected Processing Formats
Info    Previous                HW-Context   Format       SW-Format       Next
Info    h264_cuvid           >> CUDA         cuda         nv12         >> 

>>>>>  Legacy Command

/bin/ffmpeg -re -hwaccel cuda -hwaccel_device 0 -hwaccel_output_format cuda  -c:v h264_cuvid  -f matroska -i file:"/mnt/movies/movieX.mkv" -map 0:0 -map 0:1 -map 0:2 -map 0:5 -c:v:0 h264_nvenc -force_key_frames "expr:gte(t,n_forced*5)" -b:v:0 3232000 -maxrate 3232000 -bufsize 6464000 -profile:v:0 high -vsync -1 -map_metadata -1 -map_chapters -1 -threads 0 -codec:a:0 aac -metadata:s:a:0 language=eng -disposition:a:0 default -ac:a:0 2 -ab:a:0 192000 -filter:a:0 "volume=2" -codec:a:1 aac -metadata:s:a:1 language=dut -disposition:a:1 none -ac:a:1 2 -ab:a:1 192000 -filter:a:1 "volume=2" -codec:s:0 copy -disposition:s:0 default -y "/config/sync/1/1/7a8a2ddb-fbcc-4934-9fa3-90147def8929.mkv"

>>>>>  Actual Command

/bin/ffmpeg -loglevel +timing -y -print_graphs_file /config/logs/ffmpeg-transcode-7a8a2ddb-fbcc-4934-9fa3-90147def8929_1graph.txt -copyts -start_at_zero -f matroska,webm -re -c:v:0 h264_cuvid -hwaccel:v:0 cuda -hwaccel_device:v:0 0 -hwaccel_output_format:v:0 cuda -i "/mnt/movies/movieX.mkv" -map 0:0 -map 0:1 -map 0:2 -map 0:5 -c:v:0 h264_nvenc -b:v:0 3232000 -g:v:0 144 -maxrate:v:0 3232000 -bufsize:v:0 6464000 -sc_threshold:v:0 0 -keyint_min:v:0 144 -profile:v:0 main -c:a:0 aac -ab:a:0 192000 -ac:a:0 2 -metadata:s:a:0 language=eng -filter:a:0 "volume=2" -disposition:a:0 default -c:a:1 aac -ab:a:1 192000 -ac:a:1 2 -metadata:s:a:1 language=dut -filter:a:1 "volume=2" -disposition:a:1 0 -c:s:0 copy -disposition:s:0 default -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 "/config/sync/1/1/7a8a2ddb-fbcc-4934-9fa3-90147def8929.mkv"
[ ... snip ... ]

The actual transcoding is going quite slow, but of course that could be because of the videocard is quite old. But the CPU usage of the 'ffmpeg' process on the host is quite low (+/- 4%).

09:10:04.054 frame=   10 fps=0.0 q=14.0 size=       1kB time=00:00:00.79 bitrate=N/A throttle=off speed=   0x    
09:10:04.559 frame=   22 fps= 22 q=14.0 size=       1kB time=00:00:01.30 bitrate=  19.2kbits/s throttle=off speed=0.51x    
09:10:05.064 frame=   34 fps= 23 q=14.0 size=       1kB time=00:00:01.81 bitrate=   9.6kbits/s throttle=off speed=0.678x    
09:10:05.573 frame=   46 fps= 23 q=14.0 size=       1kB time=00:00:02.32 bitrate=   6.4kbits/s throttle=off speed=0.761x    
09:10:06.080 frame=   58 fps= 23 q=14.0 size=       1kB time=00:00:02.81 bitrate=   4.9kbits/s throttle=off speed=0.802x    
09:10:06.588 frame=   70 fps= 23 q=14.0 size=       1kB time=00:00:03.32 bitrate=   3.9kbits/s throttle=off speed=0.836x    
09:10:07.096 frame=   86 fps= 24 q=14.0 size=       1kB time=00:00:03.84 bitrate=   3.2kbits/s throttle=off speed=0.861x    
[ ... snip ... ]
09:38:06.858 frame=40358 fps= 24 q=18.0 size=  661830kB time=00:28:03.60 bitrate=3221.8kbits/s throttle=off speed=   1x    
09:38:07.364 frame=40369 fps= 24 q=19.0 size=  661830kB time=00:28:04.11 bitrate=3220.8kbits/s throttle=off speed=   1x    
09:38:07.872 frame=40381 fps= 24 q=19.0 size=  661830kB time=00:28:04.60 bitrate=3219.9kbits/s throttle=off speed=   1x    
09:38:08.380 frame=40394 fps= 24 q=19.0 size=  663808kB time=00:28:05.11 bitrate=3228.5kbits/s throttle=off speed=   1x    
09:38:08.889 frame=40406 fps= 24 q=18.0 size=  663808kB time=00:28:05.63 bitrate=3227.6kbits/s throttle=off speed=   1x    
09:38:09.398 frame=40418 fps= 24 q=20.0 size=  664266kB time=00:28:06.14 bitrate=3228.8kbits/s throttle=off speed=   1x    
09:38:09.907 frame=40430 fps= 24 q=21.0 size=  664266kB time=00:28:06.65 bitrate=3227.8kbits/s throttle=off speed=   1x    
09:38:10.416 frame=40442 fps= 24 q=21.0 size=  664266kB time=00:28:07.16 bitrate=3226.8kbits/s throttle=off speed=   1x    
09:38:10.923 frame=40454 fps= 24 q=21.0 size=  664266kB time=00:28:07.65 bitrate=3225.9kbits/s throttle=off speed=   1x    
09:38:11.424 frame=40470 fps= 24 q=22.0 size=  664266kB time=00:28:08.17 bitrate=3224.9kbits/s throttle=off speed=   1x    
09:38:11.933 frame=40479 fps= 24 q=23.0 size=  664266kB time=00:28:08.68 bitrate=3223.9kbits/s throttle=off speed=   1x    
09:38:12.443 frame=40491 fps= 24 q=21.0 size=  664266kB time=00:28:09.19 bitrate=3223.0kbits/s throttle=off speed=   1x    

When running nvidia-smi from the container I get a file not found error 🤔

# podman exec -it emby sh
/ # ls -l /usr/bin/
total 1324
lrwxrwxrwx    1 root     root            14 Jun  2 09:11 execlineb -> /bin/execlineb
-rwxr-xr-x    1 root     root          1661 Mar 21  2019 fix-attrs
-rwxr-xr-x    1 root     root           522 Mar 21  2019 logutil-newfifo
-rwxr-xr-x    1 root     root           331 Mar 21  2019 logutil-service
-rwxr-xr-x    1 root     root           364 Mar 21  2019 logutil-service-main
-rwxr-xr-x    1 root     root         84136 Jun 28 10:29 nvidia-cuda-mps-control
-rwxr-xr-x    1 root     root         61224 Jun 28 10:28 nvidia-cuda-mps-server
-rwxr-xr-x    1 root     root        250416 Jun 28 10:09 nvidia-debugdump
-rwxr-xr-x    1 root     root        291392 Jun 28 15:07 nvidia-persistenced
-rwxr-xr-x    1 root     root        628280 Jun 28 10:11 nvidia-smi
-rwxr-xr-x    1 root     root           650 Mar 21  2019 printcontenv
-rwxr-xr-x    1 root     root           203 Mar 21  2019 with-contenv
-rwxr-xr-x    1 root     root           426 Mar 21  2019 with-retries
/ # 
/ # /usr/bin/nvidia-smi 
sh: /usr/bin/nvidia-smi: not found

Before I upgrade the videocard I would like to be sure that it's being used, how can I validate this?

Thanks!

Link to comment
Share on other sites

falsyana

After turning on debug logging and start a new job I see the following in the server logs:

2020-07-12 11:34:44.827 Info HttpServer: HTTP POST https://emby.lan:8920/Sync/Jobs. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
2020-07-12 11:34:44.830 Info App: Bitrate exceeds DirectPlay limit: media bitrate: 2724911, max bitrate: 320000
2020-07-12 11:34:44.830 Info App: Bitrate exceeds DirectStream limit: media bitrate: 2724911, max bitrate: 1500000
2020-07-12 11:34:44.830 Info HttpServer: HTTP Response 200 to 10.88.32.1. Time: 2ms. https://emby.lan:8920/Sync/Jobs
2020-07-12 11:34:44.831 Info App: Bitrate exceeds DirectPlay limit: media bitrate: 2724911, max bitrate: 320000
2020-07-12 11:34:44.831 Info App: Bitrate exceeds DirectStream limit: media bitrate: 2724911, max bitrate: 1500000
2020-07-12 11:34:44.836 Info HttpServer: HTTP GET https://emby.lan:8920/Sync/Jobs?UserId=7111ca6ce36f4adc990fac714f09c7b7&ExcludeProviders=ConvertSyncProvider. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
2020-07-12 11:34:44.837 Info HttpServer: HTTP Response 200 to 10.88.32.1. Time: 1ms. https://emby.lan:8920/Sync/Jobs?UserId=7111ca6ce36f4adc990fac714f09c7b7&ExcludeProviders=ConvertSyncProvider
2020-07-12 11:34:44.848 Debug App: CodecValidation: FindVideoEncoder - Media: h264, UseHardwareCodecs: True, Mode: Automatic
2020-07-12 11:34:44.848 Debug App: CodecValidation: Checking: 'NVENC GeForce GT 710 - H.264 (AVC)'
2020-07-12 11:34:44.848 Debug App: CodecValidation: Check successful - selecting 'NVENC GeForce GT 710 - H.264 (AVC)'
2020-07-12 11:34:44.848 Debug App: CodecValidation: FindVideoDecoder - MediaType: h264, Mode: Automatic
2020-07-12 11:34:44.848 Debug App: CodecValidation: Checking: 'NVDEC GeForce GT 710 - H.264 (AVC)'
2020-07-12 11:34:44.848 Debug App: CodecValidation: Check successful - selecting 'NVDEC GeForce GT 710 - H.264 (AVC)'
2020-07-12 11:34:44.848 Warn App: No filter behavior available for filter {0}
2020-07-12 11:34:44.848 Debug App: CodecValidation: Processing Plan
2020-07-12 11:34:44.848 Debug App: CodecValidation: Name                                        CanDoInHardware      WillDoInHardware     Reason                                  
2020-07-12 11:34:44.848 Debug App: CodecValidation: NVDEC GeForce GT 710 - H.264 (AVC)       >> True                 True                 Hardware Codec                           
2020-07-12 11:34:44.848 Debug App: CodecValidation: VideoInput                               >> True                 True                 Matching hardware context                
2020-07-12 11:34:44.848 Debug App: CodecValidation: Scaling                                  >> True                 True                                                          
2020-07-12 11:34:44.848 Debug App: CodecValidation: VideoOutput                              >> True                 True                 Hardware encoder                         
2020-07-12 11:34:44.848 Debug App: CodecValidation: NVENC GeForce GT 710 - H.264 (AVC)       >> True                 True                 Hardware Codec                           
2020-07-12 11:34:44.848 Debug App: CodecValidation: Projected Processing Formats
2020-07-12 11:34:44.848 Debug App: CodecValidation: Previous                HW-Context   Format       SW-Format       Next
2020-07-12 11:34:44.848 Debug App: CodecValidation: h264_cuvid           >> CUDA         cuda         nv12         >> scale_cuda
2020-07-12 11:34:44.848 Debug App: CodecValidation: scale_cuda           >> CUDA         cuda         nv12         >> setsar
2020-07-12 11:34:44.848 Debug App: CodecValidation: setsar               >> CUDA         cuda         nv12         >> 
2020-07-12 11:34:44.848 Debug App: CodecValidation: FindVideoDecoder - MediaType: h264, Mode: Automatic
2020-07-12 11:34:44.849 Debug App: CodecValidation: FindVideoDecoder - Checking: 'NVDEC GeForce GT 710 - H.264 (AVC)'
2020-07-12 11:34:44.849 Debug App: CodecValidation: FindVideoDecoder - Check successful - selecting 'NVDEC GeForce GT 710 - H.264 (AVC)'
2020-07-12 11:34:44.849 Debug App: CodecValidation: FindVideoEncoder - Media: h264, UseHardwareCodecs: True, Mode: Automatic
2020-07-12 11:34:44.849 Debug App: CodecValidation: FindVideoEncoder - Checking: 'NVENC GeForce GT 710 - H.264 (AVC)'
2020-07-12 11:34:44.849 Debug App: CodecValidation: FindVideoEncoder - Check successful - selecting 'NVENC GeForce GT 710 - H.264 (AVC)'
2020-07-12 11:34:44.850 Info VideoEncoder: ProcessRun 'Encoding 1206aa' Execute: /bin/ffmpeg -loglevel +timing -y -print_graphs_file /config/logs/ffmpeg-transcode-1206aa7b-db20-4773-83cd-d3efcc123224_1graph.txt -copyts -start_at_zero -f matroska,webm -re -c:v:0 h264_cuvid -hwaccel:v:0 cuda -hwaccel_device:v:0 0 -hwaccel_output_format:v:0 cuda -i "/mnt/movies/movieX.mkv" -filter_complex "[0:0]scale_cuda@f1=w=720:h=390,setsar@f2=sar=sar[f2_out0]" -map [f2_out0] -map 0:1 -map 0:2 -c:v:0 h264_nvenc -b:v:0 1180000 -g:v:0 144 -maxrate:v:0 1180000 -bufsize:v:0 2360000 -sc_threshold:v:0 0 -keyint_min:v:0 144 -profile:v:0 main -c:a:0 copy -metadata:s:a:0 language=eng -disposition:a:0 default -c:s:0 copy -disposition:s:0 default -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 "/config/sync/4/4/1206aa7b-db20-4773-83cd-d3efcc123224.mkv"
2020-07-12 11:34:44.851 Debug VideoEncoder: ProcessRun 'Encoding 1206aa' Started.

 

Everything points that it is using the videocard, and that the videocard is just (extemely) slow. I keep getting a speed around 1x.

As i final (and I should have started with this) test i just set 'Enable hardware acceleration when available' to 'No' and cpu usage went up to 15% and speed up to 10x.
So yes it is using the videocard which is just extremely slow (and old 😅), time to see if an upgrade is getting me to better speeds than what the CPU does now.

 

Thanks for taking your time to answer my question!

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...