Benchmarks

Now and then I use my GPU to encode video files, and on rare occasions I upgrade my graphics card to a recent midrange model. I have used Nvidia GeForce ones over the past ten years or so. Just recently I thought of keeping the speed and times that the various graphics cards take to encode a typical video file as a personal reference.
Summary:

DUTH.264 [fps]H.265 [fps]
RTX 407011661099
UHD 630370166
Core i7 87008842
RTX 2060 Super997885
UHD 620342153
Core i7 8550U3619

RTX 4070

System information

$ uname -a
Linux core7 6.5.2 #10 SMP PREEMPT_DYNAMIC Wed Sep 13 22:59:04 CEST 2023 x86_64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz GenuineIntel GNU/Linux

$ equery l nvidia-drivers nvidia-cuda-toolkit
 * Searching for nvidia-drivers ...
[IP-] [  ] x11-drivers/nvidia-drivers-535.104.05:0/535

 * Searching for nvidia-cuda-toolkit ...
[IP-] [  ] dev-util/nvidia-cuda-toolkit-12.2.2:0/12.2.2

$ ffmpeg -version | head -2
ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13 (Gentoo 13.2.1_p20230826 p7)

$ lspci -s 01:00.0
01:00.0 VGA compatible controller: NVIDIA Corporation AD104 [GeForce RTX 4070] (rev a1)

Re-encode H.264

$ ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -i src.m2t -c:v h264_nvenc -b:v 5M -c:a copy -sn -map 0:v -map 0:a dst.mp4
Input #0, mpegts, from 'src.m2t':
  Duration: 03:09:00.10, start: 1.400000, bitrate: 4969 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2[0x102]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3[0x103]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4[0x104]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
Output #0, mp4, to 'dst.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), cuda(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 12800 tbn
    Metadata:
      encoder         : Lavc58.134.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 10000000 vbv_delay: N/A
  Stream #0:1: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
frame=567006 fps=1166 q=24.0 Lsize= 8392928kB time=03:09:00.04 bitrate=6063.0kbits/s dup=26 drop=1 speed=23.3x    
video:6864243kB audio:1505973kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.271350%

Encode H.265

$ ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -i src.m2t -c:v hevc_nvenc -b:v 5M -c:a copy -sn -map 0:v -map 0:a dst.mp4
Input #0, mpegts, from 'src.m2t':
  Duration: 03:09:00.10, start: 1.400000, bitrate: 4969 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2[0x102]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3[0x103]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4[0x104]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_nvenc))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
Output #0, mp4, to 'dst.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: hevc (Main) (hev1 / 0x31766568), cuda(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 12800 tbn
    Metadata:
      encoder         : Lavc58.134.100 hevc_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 10000000 vbv_delay: N/A
  Stream #0:1: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
frame=567006 fps=1099 q=23.0 Lsize= 8577966kB time=03:09:00.04 bitrate=6196.7kbits/s dup=26 drop=1 speed=  22x    
video:7049280kB audio:1505973kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.265482%

UHD Graphics 630

System information

$ uname -a
Linux core7 6.5.2 #10 SMP PREEMPT_DYNAMIC Wed Sep 13 22:59:04 CEST 2023 x86_64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz GenuineIntel GNU/Linux

$ ffmpeg -version | head -2
ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13 (Gentoo 13.2.1_p20230826 p7)

$ lspci -s 00:02.0
00:02.0 VGA compatible controller: Intel Corporation CoffeeLake-S GT2 [UHD Graphics 630]

That's the integrated GPU of the main processor.

Re-encode H.264

$ ffmpeg -hide_banner -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i src.m2t -c:v h264_vaapi -b:v 5M -c:a copy -sn -map 0:v -map 0:a dst.mp4
Input #0, mpegts, from 'src.m2t':
  Duration: 03:09:00.10, start: 1.400000, bitrate: 4969 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2[0x102]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3[0x103]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4[0x104]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_vaapi))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
Output #0, mp4, to 'dst.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), vaapi_vld(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 12800 tbn
    Metadata:
      encoder         : Lavc58.134.100 h264_vaapi
  Stream #0:1: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
frame=567006 fps=370 q=-0.0 Lsize= 8339423kB time=03:09:00.08 bitrate=6024.3kbits/s dup=26 drop=1 speed= 7.4x    
video:6809952kB audio:1505973kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.282559%

Encode H.265

$ ffmpeg -hide_banner -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i src.m2t -c:v hevc_vaapi -b:v 5M -c:a copy -sn -map 0:v -map 0:a dst.mp4
Input #0, mpegts, from 'src.m2t':
  Duration: 03:09:00.10, start: 1.400000, bitrate: 4969 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2[0x102]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3[0x103]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4[0x104]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_vaapi))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
Output #0, mp4, to 'dst.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: hevc (Main) (hev1 / 0x31766568), vaapi_vld(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 12800 tbn
    Metadata:
      encoder         : Lavc58.134.100 hevc_vaapi
  Stream #0:1: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
frame=567006 fps=166 q=-0.0 Lsize= 8331851kB time=03:09:00.08 bitrate=6018.9kbits/s dup=26 drop=1 speed=3.32x    
video:6802381kB audio:1505973kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.282818%

Core i7-8700

This used the bare software encoders, and ran on the main processor solely. I stopped ffmpeg by pressing q after each invocation had encoded 2 minutes of video data. CPU core temperature was around 80 °C, fan at full speed. Impressive: ffmpeg used all 6 cores, but system was not sluggish, i.e. switching terminal windows and calling top showed no delay.

System information

$ uname -a
Linux core7 6.5.2 #10 SMP PREEMPT_DYNAMIC Wed Sep 13 22:59:04 CEST 2023 x86_64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz GenuineIntel GNU/Linux

$ ffmpeg -version | head -2
ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13 (Gentoo 13.2.1_p20230826 p7)

Re-encode H.264

$ ffmpeg -hide_banner -i src.m2t -c:v libx264 -b:v 5M -c:a copy -sn -map 0:v -map 0:a dst.mp4
Input #0, mpegts, from 'src.m2t':
  Duration: 03:09:00.10, start: 1.400000, bitrate: 4969 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2[0x102]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3[0x103]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4[0x104]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x556cbab0ac40] using SAR=1/1
[libx264 @ 0x556cbab0ac40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x556cbab0ac40] profile High, level 3.2, 4:2:0, 8-bit
[libx264 @ 0x556cbab0ac40] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=9 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=5000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'dst.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 12800 tbn
    Metadata:
      encoder         : Lavc58.134.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
frame= 6058 fps= 88 q=-1.0 Lsize=   89400kB time=00:02:01.22 bitrate=6041.2kbits/s dup=26 drop=0 speed=1.75x    
video:73129kB audio:16101kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.191588%

Encode H.265

$ ffmpeg -hide_banner -i src.m2t -c:v libx265 -b:v 5M -c:a copy -sn -map 0:v -map 0:a dst.mp4
Input #0, mpegts, from 'src.m2t':
  Duration: 03:09:00.10, start: 1.400000, bitrate: 4969 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2[0x102]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3[0x103]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4[0x104]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.5+1-f0c1022b6
x265 [info]: build info [Linux][GCC 11.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 6 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 2 / wpp(12 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 25 / 250 / 40 / 5.00 
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : ABR-5000 kbps / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing lslices=4 deblock sao
Output #0, mp4, to 'dst.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: hevc (hev1 / 0x31766568), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 12800 tbn
    Metadata:
      encoder         : Lavc58.134.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
frame= 6099 fps= 42 q=28.0 Lsize=   89718kB time=00:02:02.09 bitrate=6019.7kbits/s dup=26 drop=0 speed=0.849x    
video:73327kB audio:16213kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.199068%
x265 [info]: frame I:     32, Avg QP:17.34  kb/s: 45066.16
x265 [info]: frame P:   1597, Avg QP:19.60  kb/s: 15053.69
x265 [info]: frame B:   4470, Avg QP:27.22  kb/s: 1016.09 
x265 [info]: Weighted P-Frames: Y:0.6% UV:0.3%
x265 [info]: consecutive B-frames: 6.6% 6.0% 15.5% 50.3% 21.7% 

encoded 6099 frames in 143.81s (42.41 fps), 4922.91 kb/s, Avg QP:25.17

RTX 2060 Super

System information

$ uname -a
Linux core7 6.5.2 #10 SMP PREEMPT_DYNAMIC Wed Sep 13 22:59:04 CEST 2023 x86_64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz GenuineIntel GNU/Linux

$ equery l nvidia-drivers nvidia-cuda-toolkit
 * Searching for nvidia-drivers ...
[IP-] [  ] x11-drivers/nvidia-drivers-535.104.05:0/535

 * Searching for nvidia-cuda-toolkit ...
[IP-] [  ] dev-util/nvidia-cuda-toolkit-12.2.2:0/12.2.2

$ ffmpeg -version | head -2
ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13 (Gentoo 13.2.1_p20230826 p7)

$ lspci -s 01:00.0
01:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2060 Super] (rev a1)

Re-encode H.264

$ ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -i src.m2t -c:v h264_nvenc -b:v 5M -c:a copy -sn -map 0:v -map 0:a dst.mp4
Input #0, mpegts, from 'src.m2t':
  Duration: 03:09:00.10, start: 1.400000, bitrate: 4969 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2[0x102]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3[0x103]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4[0x104]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
Output #0, mp4, to 'dst.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), cuda(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 12800 tbn
    Metadata:
      encoder         : Lavc58.134.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 10000000 vbv_delay: N/A
  Stream #0:1: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
frame=567006 fps=997 q=25.0 Lsize= 8393211kB time=03:09:00.04 bitrate=6063.2kbits/s dup=26 drop=1 speed=19.9x    
video:6864526kB audio:1505973kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.271341%

Encode H.265

$ ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -i src.m2t -c:v hevc_nvenc -b:v 5M -c:a copy -sn -map 0:v -map 0:a dst.mp4
Input #0, mpegts, from 'src.m2t':
  Duration: 03:09:00.10, start: 1.400000, bitrate: 4969 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2[0x102]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3[0x103]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4[0x104]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_nvenc))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
Output #0, mp4, to 'dst.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: hevc (Main) (hev1 / 0x31766568), cuda(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 12800 tbn
    Metadata:
      encoder         : Lavc58.134.100 hevc_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 10000000 vbv_delay: N/A
  Stream #0:1: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
frame=567006 fps=885 q=23.0 Lsize= 8577916kB time=03:09:00.04 bitrate=6196.7kbits/s dup=26 drop=1 speed=17.7x    
video:7049230kB audio:1505973kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.265484%

UHD Graphics 620

System information

$ uname -a
Linux t480 6.5.7-gentoo-x86_64 #1 SMP PREEMPT_DYNAMIC Fri Oct 13 00:49:19 CEST 2023 x86_64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz GenuineIntel GNU/Linux

$ ffmpeg -version | head -2
ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13 (Gentoo 13.2.1_p20231014 p9)

lspci -s 00:02.0
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)

That's the integrated GPU of the main processor.

Re-encode H.264

$ ffmpeg -hide_banner -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i src.m2t -c:v h264_vaapi -b:v 5M -c:a copy -sn -map 0:v -map 0:a dst.mp4
Input #0, mpegts, from 'src.m2t':
  Duration: 03:09:00.10, start: 1.400000, bitrate: 4969 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2[0x102]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3[0x103]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4[0x104]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_vaapi))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x55556a9be700] track 1: codec frame size is not set
Output #0, mp4, to 'dst.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), vaapi_vld(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 12800 tbn
    Metadata:
      encoder         : Lavc58.134.100 h264_vaapi
  Stream #0:1: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
frame=567006 fps=342 q=-0.0 Lsize= 8339423kB time=03:09:00.08 bitrate=6024.3kbits/s dup=26 drop=1 speed=6.84x    
video:6809952kB audio:1505973kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.282559%

Encode H.265

$ ffmpeg -hide_banner -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i src.m2t -c:v hevc_vaapi -b:v 5M -c:a copy -sn -map 0:v -map 0:a dst.mp4
Input #0, mpegts, from 'src.m2t':
  Duration: 03:09:00.10, start: 1.400000, bitrate: 4969 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2[0x102]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3[0x103]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4[0x104]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_vaapi))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x55a46ad0d700] track 1: codec frame size is not set
Output #0, mp4, to 'dst.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: hevc (Main) (hev1 / 0x31766568), vaapi_vld(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 12800 tbn
    Metadata:
      encoder         : Lavc58.134.100 hevc_vaapi
  Stream #0:1: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
frame=567006 fps=153 q=-0.0 Lsize= 8331851kB time=03:09:00.08 bitrate=6018.9kbits/s dup=26 drop=1 speed=3.06x    
video:6802381kB audio:1505973kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.282818%

Core i7-8550U

System information

$ uname -a
Linux t480 6.5.7-gentoo-x86_64 #1 SMP PREEMPT_DYNAMIC Fri Oct 13 00:49:19 CEST 2023 x86_64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz GenuineIntel GNU/Linux

$ ffmpeg -version | head -2
ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13 (Gentoo 13.2.1_p20231014 p9)

Re-encode H.264

$ ffmpeg -hide_banner -i src.m2t -c:v libx264 -b:v 5M -c:a copy -sn -map 0:v -map 0:a dst.mp4
Input #0, mpegts, from 'src.m2t':
  Duration: 03:09:00.10, start: 1.400000, bitrate: 4969 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2[0x102]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3[0x103]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4[0x104]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x560828895c40] using SAR=1/1
[libx264 @ 0x560828895c40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x560828895c40] profile High, level 3.2, 4:2:0, 8-bit
[libx264 @ 0x560828895c40] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=5000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x5608283aec80] track 1: codec frame size is not set
Output #0, mp4, to 'dst.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 12800 tbn
    Metadata:
      encoder         : Lavc58.134.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
frame= 6376 fps= 36 q=-1.0 Lsize=   94423kB time=00:02:07.56 bitrate=6063.6kbits/s dup=26 drop=0 speed=0.73x    
video:77299kB audio:16944kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.190756%

Encode H.265

$ ffmpeg -hide_banner -i src.m2t -c:v libx265 -b:v 5M -c:a copy -sn -map 0:v -map 0:a dst.mp4
Input #0, mpegts, from 'src.m2t':
  Duration: 03:09:00.10, start: 1.400000, bitrate: 4969 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2[0x102]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3[0x103]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4[0x104]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.5+1-f0c1022b6
x265 [info]: build info [Linux][GCC 11.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 4 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 2 / wpp(12 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 25 / 250 / 40 / 5.00 
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : ABR-5000 kbps / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing lslices=4 deblock sao
[mp4 @ 0x55f9619e4c80] track 1: codec frame size is not set
Output #0, mp4, to 'dst.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: hevc (hev1 / 0x31766568), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 12800 tbn
    Metadata:
      encoder         : Lavc58.134.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
  Stream #0:2: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:3: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:4: Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
frame= 6084 fps= 19 q=27.7 Lsize=   89405kB time=00:02:01.73 bitrate=6016.5kbits/s dup=26 drop=0 speed=0.376x    
video:73062kB audio:16166kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.199231%
x265 [info]: frame I:     32, Avg QP:17.34  kb/s: 45060.64
x265 [info]: frame P:   1591, Avg QP:19.60  kb/s: 15045.88
x265 [info]: frame B:   4461, Avg QP:27.22  kb/s: 1016.90 
x265 [info]: Weighted P-Frames: Y:0.6% UV:0.3%
x265 [info]: consecutive B-frames: 6.6% 5.9% 15.5% 50.3% 21.8% 

encoded 6084 frames in 324.05s (18.78 fps), 4917.21 kb/s, Avg QP:25.18