ffmpeg -hwaccel AV1 QSV encoding on Arc GPU executes rapid, but commands?
Late last year I posted a thread "[Cin] Prepping HW upgrade options for AV1 de-/encoding" https://www.mail-archive.com/cin@lists.cinelerra-gg.org/msg06626.html and there have also been other threads about hardware acceleration So here again, I also wanted to give it a first try with ffmpeg -hwaccel AV1 QSV encoding. First some system specifications: inxi -CGS System: Host: localhost.localdomain Kernel: 6.9.4-1-default arch: x86_64 bits: 64 Desktop: GNOME v: 46.2 Distro: openSUSE Tumbleweed-Slowroll 20240605 CPU: Info: 12-core (8-mt/4-st) model: 12th Gen Intel Core i7-12700KF bits: 64 type: MST AMCP cache: L2: 12 MiB Speed (MHz): avg: 800 min/max: 800/4900:5000:3800 cores: 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 800 12: 800 13: 800 14: 800 15: 800 16: 800 17: 800 18: 800 19: 800 20: 800 Graphics: Device-1: Intel DG2 [Arc A750] driver: i915 v: kernel Device-2: Microdia Camera driver: snd-usb-audio,uvcvideo type: USB Display: wayland server: X.org v: 1.21.1.12 with: Xwayland v: 24.1.0 compositor: gnome-shell driver: gpu: i915 resolution: 2560x1440~60Hz API: OpenGL v: 4.6 vendor: intel mesa v: 24.0.8 renderer: Mesa Intel Arc A750 Graphics (DG2) API: EGL Message: EGL data requires eglinfo. Check --recommends. ls /dev/dri by-path card1 renderD128 ffmpeg -hide_banner -hwaccels Hardware acceleration methods: vdpau cuda vaapi qsv drm vulkan ffmpeg -hide_banner -h encoder=av1_qsv Encoder av1_qsv [AV1 (Intel Quick Sync Video acceleration)]: General capabilities: delay hybrid Threading capabilities: none Supported hardware devices: qsv qsv qsv Supported pixel formats: nv12 p010le qsv av1_qsv encoder AVOptions: -async_depth <int> E..V....... Maximum processing parallelism (from 1 to INT_MAX) (default 4) -preset <int> E..V....... (from 0 to 7) (default 0) veryfast 7 E..V....... faster 6 E..V....... fast 5 E..V....... medium 4 E..V....... slow 3 E..V....... slower 2 E..V....... veryslow 1 E..V....... -forced_idr <boolean> E..V....... Forcing I frames as IDR frames (default false) -low_power <boolean> E..V....... enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.) (default auto) -b_strategy <int> E..V....... Strategy to choose between I/P/B-frames (from -1 to 1) (default -1) -adaptive_i <int> E..V....... Adaptive I-frame placement (from -1 to 1) (default -1) -adaptive_b <int> E..V....... Adaptive B-frame placement (from -1 to 1) (default -1) -extbrc <int> E..V....... Extended bitrate control (from -1 to 1) (default -1) -low_delay_brc <boolean> E..V....... Allow to strictly obey avg frame size (default auto) -max_frame_size <int> E..V....... Maximum encoded frame size in bytes (from -1 to INT_MAX) (default -1) -max_frame_size_i <int> E..V....... Maximum encoded I frame size in bytes (from -1 to INT_MAX) (default -1) -max_frame_size_p <int> E..V....... Maximum encoded P frame size in bytes (from -1 to INT_MAX) (default -1) -profile <int> E..V....... (from 0 to INT_MAX) (default unknown) unknown 0 E..V....... main 1 E..V....... -tile_cols <int> E..V....... Number of columns for tiled encoding (from 0 to 65535) (default 0) -tile_rows <int> E..V....... Number of rows for tiled encoding (from 0 to 65535) (default 0) -look_ahead_depth <int> E..V....... Depth of look ahead in number frames, available when extbrc option is enabled (from 0 to 100) (default 0) -------------- So far I have not found any detailed user guide for this, so suggestions are welcome. I have tried to apply a sample command line from the FFmpeg wiki:Hardware/QuickSync https://trac.ffmpeg.org/wiki/Hardware/QuickSync#Transcode ffmpeg -hwaccel qsv -qsv_device /dev/dri/renderD128 -c:v h264_qsv -i input.mp4 -c:v h264_qsv output.mp4 I added -preset 4 (medium) from above (which gives much more compression and smaller file size than with -preset 4 for av1_svt). This didn't seem to change the file size compression compared with the defaults (without setting preset) Some visible artifacts (mosaic and stuttering ) is seen during zoom and pan in the hdv file; probably due to hard compression and/or the memory allocation error messages, I would guess. ------------- In short, I have tested the same SD-DV 576i and HDV 1080i video files as with SVT-AV1 (CPU based) in another resent post. ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv -preset 4 dv01_07_av1_qsv_pr4.webm frame= 2832 fps=2106 q=-0.0 Lsize= 10554KiB time=00:01:53.24 bitrate= 763.5kbits/s speed=84.2x fmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i hdv09_04.m2t -c:v av1_qsv -preset 4 hdv09_04.m2t_av1_qsv_pr4.webm frame= 5913 fps=700 q=-0.0 Lsize= 48022KiB time=00:03:58.77 bitrate=1647.6kbits/s dup=0 drop=4 speed=28.3x du -sh dv01_07* 389M dv01_07.dv 11M dv01_07_av1_qsv_pr4.webm 24M dv01_07_svt-av1_pr4.webm 27M dv01_07_svt-av1_pr6.webm 28M dv01_07_svt-av1_pr8.webm 31M dv01_07_svt-av1_pr10.webm 33M dv01_07_svt-av1_pr12.webm du -sh hdv09_04* 745M hdv09_04.m2t 47M hdv09_04.m2t_av1_qsv_pr4.webm 111M hdv09_04_m2t_svt-av1_pr4.webm 119M hdv09_04_m2t_svt-av1_pr6.webm 118M hdv09_04_m2t_svt-av1_pr8.webm 125M hdv09_04_m2t_svt-av1_pr10.webm 134M hdv09_04_m2t_svt-av1_pr12.webm A warning output in both command lines is: [vist#0:0/dvvideo @ 0x556a3f679100] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv". I tried to add this without success, so suggestion is welcome !? And possibly suggestions regarding the more seriously errors "Cannot allocate memory" that arised from the second command transcoding the hdv file? [mpeg2_qsv @ 0x5596ba3d1500] Failed to allocate a qsv/nv12 frame from a fixed pool of hardware frames. [mpeg2_qsv @ 0x5596ba3d1500] Consider setting extra_hw_frames to a larger value (currently set to 8, giving a pool size of 32). [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Error submitting packet to decoder: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Error submitting packet to decoder: Cannot allocate memory ....... skip [mpegts @ 0x5596ba48c000] PES packet size mismatch0:03:46.20 bitrate=1650.3kbits/s speed=28.3x [mpegts @ 0x5596ba48c000] Packet corrupt (stream = 1, dts = 258142320). [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Cannot allocate memory .......... skip [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [mpeg2_qsv @ 0x5596ba3d1500] Too many errors when draining, this is a bug. Stop draining and force EOF. [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Internal bug, should not have happened I attach also the "complete" ffmpeg output FWIW for both files, though skipping repeated error lines: ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv -preset 4 dv01_07_av1_qsv_pr4.webm libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 [dv @ 0x556a3f643000] Estimating duration from bitrate, this may be inaccurate [vist#0:0/dvvideo @ 0x556a3f679100] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv". Input #0, dv, from 'dv01_07.dv': Metadata: timecode : 01:09:35:09 Duration: 00:01:53.28, start: 0.000000, bitrate: 28800 kb/s Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 28800 kb/s, 60k fps, 25 tbr, 60k tbn Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Stream mapping: Stream #0:0 -> #0:0 (dvvideo (native) -> av1 (av1_qsv)) Stream #0:1 -> #0:1 (pcm_s16le (native) -> opus (libopus)) Press [q] to stop, [?] for help [libopus @ 0x556a3f656580] No bit rate set. Defaulting to 96000 bps. [av1_qsv @ 0x556a3f653040] Using the constant quantization parameter (CQP) by default. Please use the global_quality option and other options for a quality-based mode or the b option and other options for a bitrate-based mode if the default is not the desired choice. Output #0, webm, to 'dv01_07_av1_qsv_pr4.webm': Metadata: timecode : 01:09:35:09 encoder : Lavf61.1.100 Stream #0:0: Video: av1, nv12(bottom coded first (swapped)), 720x576 [SAR 16:15 DAR 4:3], q=2-31, 25 fps, 1k tbn Metadata: encoder : Lavc61.3.100 av1_qsv Stream #0:1: Audio: opus, 48000 Hz, stereo, s16, 96 kb/s Metadata: encoder : Lavc61.3.100 libopus [out#0/webm @ 0x556a3f4da5c0] video:9315KiB audio:1186KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.505196% frame= 2832 fps=2106 q=-0.0 Lsize= 10554KiB time=00:01:53.24 bitrate= 763.5kbits/s speed=84.2x ------------------ ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i hdv09_04.m2t -c:v av1_qsv -preset 4 hdv09_04.m2t_av1_qsv_pr4.webm libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 [mpeg2video @ 0x5596ba391500] Invalid frame dimensions 0x0. Last message repeated 3 times [mpegts @ 0x5596ba48c000] PES packet size mismatch [mpegts @ 0x5596ba48c000] Packet corrupt (stream = 1, dts = 258142320). [mpegts @ 0x5596ba48c000] Could not find codec parameters for stream 2 (Unknown: none ([160][0][0][0] / 0x00A0)): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options [mpegts @ 0x5596ba48c000] Could not find codec parameters for stream 3 (Unknown: none ([161][0][0][0] / 0x00A1)): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options [vist#0:0/mpeg2video @ 0x5596ba394d00] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv". Input #0, mpegts, from 'hdv09_04.m2t': Duration: 00:03:59.06, start: 2629.496000, bitrate: 26110 kb/s Program 100 Stream #0:0[0x810]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 25 fps, 25 tbr, 90k tbn Side data: cpb: bitrate max/min/avg: 25000000/0/0 buffer size: 7340032 vbv_delay: N/A Stream #0:1[0x814]: Audio: mp2 (mp3float) ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 384 kb/s Stream #0:2[0x815]: Unknown: none ([160][0][0][0] / 0x00A0) Stream #0:3[0x811]: Unknown: none ([161][0][0][0] / 0x00A1) Stream mapping: Stream #0:0 -> #0:0 (mpeg2video (mpeg2_qsv) -> av1 (av1_qsv)) Stream #0:1 -> #0:1 (mp2 (native) -> opus (libopus)) Press [q] to stop, [?] for help [libopus @ 0x5596ba448cc0] No bit rate set. Defaulting to 96000 bps. [av1_qsv @ 0x5596ba39f1c0] Using the constant quantization parameter (CQP) by default. Please use the global_quality option and other options for a quality-based mode or the b option and other options for a bitrate-based mode if the default is not the desired choice. Output #0, webm, to 'hdv09_04.m2t_av1_qsv_pr4.webm': Metadata: encoder : Lavf61.1.100 Stream #0:0: Video: av1, qsv(tv, bt709, top coded first (swapped)), 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 25 fps, 1k tbn Metadata: encoder : Lavc61.3.100 av1_qsv Stream #0:1: Audio: opus, 48000 Hz, stereo, s16, 96 kb/s Metadata: encoder : Lavc61.3.100 libopus [mpeg2_qsv @ 0x5596ba3d1500] Failed to allocate a qsv/nv12 frame from a fixed pool of hardware frames. [mpeg2_qsv @ 0x5596ba3d1500] Consider setting extra_hw_frames to a larger value (currently set to 8, giving a pool size of 32). [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Error submitting packet to decoder: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Error submitting packet to decoder: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed ............skip [mpegts @ 0x5596ba48c000] PES packet size mismatch0:03:46.20 bitrate=1650.3kbits/s speed=28.3x [mpegts @ 0x5596ba48c000] Packet corrupt (stream = 1, dts = 258142320). [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Cannot allocate memory .......skip [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [mpeg2_qsv @ 0x5596ba3d1500] Too many errors when draining, this is a bug. Stop draining and force EOF. [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Internal bug, should not have happened [out#0/webm @ 0x5596ba3cc400] video:45422KiB audio:2490KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.230717% frame= 5913 fps=700 q=-0.0 Lsize= 48022KiB time=00:03:58.77 bitrate=1647.6kbits/s dup=0 drop=4 speed=28.3x
ср, 19 июн. 2024 г., 03:30 Terje J. Hanssen via Cin < cin@lists.cinelerra-gg.org>:
Late last year I posted a thread "[Cin] Prepping HW upgrade options for AV1 de-/encoding" https://www.mail-archive.com/cin@lists.cinelerra-gg.org/msg06626.html
and there have also been other threads about hardware acceleration
So here again, I also wanted to give it a first try with ffmpeg -hwaccel AV1 QSV encoding. First some system specifications:
inxi -CGS System: Host: localhost.localdomain Kernel: 6.9.4-1-default arch: x86_64 bits: 64 Desktop: GNOME v: 46.2 Distro: openSUSE Tumbleweed-Slowroll 20240605 CPU: Info: 12-core (8-mt/4-st) model: 12th Gen Intel Core i7-12700KF bits: 64 type: MST AMCP cache: L2: 12 MiB Speed (MHz): avg: 800 min/max: 800/4900:5000:3800 cores: 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 800 12: 800 13: 800 14: 800 15: 800 16: 800 17: 800 18: 800 19: 800 20: 800 Graphics: Device-1: Intel DG2 [Arc A750] driver: i915 v: kernel Device-2: Microdia Camera driver: snd-usb-audio,uvcvideo type: USB Display: wayland server: X.org v: 1.21.1.12 with: Xwayland v: 24.1.0 compositor: gnome-shell driver: gpu: i915 resolution: 2560x1440~60Hz API: OpenGL v: 4.6 vendor: intel mesa v: 24.0.8 renderer: Mesa Intel Arc A750 Graphics (DG2) API: EGL Message: EGL data requires eglinfo. Check --recommends.
ls /dev/dri by-path card1 renderD128
ffmpeg -hide_banner -hwaccels Hardware acceleration methods: vdpau cuda vaapi qsv drm vulkan
ffmpeg -hide_banner -h encoder=av1_qsv Encoder av1_qsv [AV1 (Intel Quick Sync Video acceleration)]: General capabilities: delay hybrid Threading capabilities: none Supported hardware devices: qsv qsv qsv Supported pixel formats: nv12 p010le qsv av1_qsv encoder AVOptions: -async_depth <int> E..V....... Maximum processing parallelism (from 1 to INT_MAX) (default 4) -preset <int> E..V....... (from 0 to 7) (default 0) veryfast 7 E..V....... faster 6 E..V....... fast 5 E..V....... medium 4 E..V....... slow 3 E..V....... slower 2 E..V....... veryslow 1 E..V....... -forced_idr <boolean> E..V....... Forcing I frames as IDR frames (default false) -low_power <boolean> E..V....... enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.) (default auto) -b_strategy <int> E..V....... Strategy to choose between I/P/B-frames (from -1 to 1) (default -1) -adaptive_i <int> E..V....... Adaptive I-frame placement (from -1 to 1) (default -1) -adaptive_b <int> E..V....... Adaptive B-frame placement (from -1 to 1) (default -1) -extbrc <int> E..V....... Extended bitrate control (from -1 to 1) (default -1) -low_delay_brc <boolean> E..V....... Allow to strictly obey avg frame size (default auto) -max_frame_size <int> E..V....... Maximum encoded frame size in bytes (from -1 to INT_MAX) (default -1) -max_frame_size_i <int> E..V....... Maximum encoded I frame size in bytes (from -1 to INT_MAX) (default -1) -max_frame_size_p <int> E..V....... Maximum encoded P frame size in bytes (from -1 to INT_MAX) (default -1) -profile <int> E..V....... (from 0 to INT_MAX) (default unknown) unknown 0 E..V....... main 1 E..V....... -tile_cols <int> E..V....... Number of columns for tiled encoding (from 0 to 65535) (default 0) -tile_rows <int> E..V....... Number of rows for tiled encoding (from 0 to 65535) (default 0) -look_ahead_depth <int> E..V....... Depth of look ahead in number frames, available when extbrc option is enabled (from 0 to 100) (default 0)
--------------
So far I have not found any detailed user guide for this, so suggestions are welcome.
I have tried to apply a sample command line from the FFmpeg wiki:Hardware/QuickSync https://trac.ffmpeg.org/wiki/Hardware/QuickSync#Transcode
ffmpeg -hwaccel qsv -qsv_device /dev/dri/renderD128 -c:v h264_qsv -i input.mp4 -c:v h264_qsv output.mp4
I added -preset 4 (medium) from above (which gives much more compression and smaller file size than with -preset 4 for av1_svt). This didn't seem to change the file size compression compared with the defaults (without setting preset) Some visible artifacts (mosaic and stuttering ) is seen during zoom and pan in the hdv file; probably due to hard compression and/or the memory allocation error messages, I would guess.
-------------
In short, I have tested the same SD-DV 576i and HDV 1080i video files as with SVT-AV1 (CPU based) in another resent post.
ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv -preset 4 dv01_07_av1_qsv_pr4.webm frame= 2832 fps=2106 q=-0.0 Lsize= 10554KiB time=00:01:53.24 bitrate= 763.5kbits/s speed=84.2x
fmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i hdv09_04.m2t -c:v av1_qsv -preset 4 hdv09_04.m2t_av1_qsv_pr4.webm frame= 5913 fps=700 q=-0.0 Lsize= 48022KiB time=00:03:58.77 bitrate=1647.6kbits/s dup=0 drop=4 speed=28.3x
du -sh dv01_07* 389M dv01_07.dv 11M dv01_07_av1_qsv_pr4.webm 24M dv01_07_svt-av1_pr4.webm 27M dv01_07_svt-av1_pr6.webm 28M dv01_07_svt-av1_pr8.webm 31M dv01_07_svt-av1_pr10.webm 33M dv01_07_svt-av1_pr12.webm
du -sh hdv09_04* 745M hdv09_04.m2t 47M hdv09_04.m2t_av1_qsv_pr4.webm 111M hdv09_04_m2t_svt-av1_pr4.webm 119M hdv09_04_m2t_svt-av1_pr6.webm 118M hdv09_04_m2t_svt-av1_pr8.webm 125M hdv09_04_m2t_svt-av1_pr10.webm 134M hdv09_04_m2t_svt-av1_pr12.webm
A warning output in both command lines is:
[vist#0:0/dvvideo @ 0x556a3f679100] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
I tried to add this without success, so suggestion is welcome !?
And possibly suggestions regarding the more seriously errors "Cannot allocate memory" that arised from the second command transcoding the hdv file?
well, you tried to add -extra_hw_frames 16 for example to your ffmpeg line? I think mpeg2 is not most popular input codec nowadays .... [mpeg2_qsv @ 0x5596ba3d1500] Failed to allocate a qsv/nv12 frame from a
fixed pool of hardware frames. [mpeg2_qsv @ 0x5596ba3d1500] Consider setting extra_hw_frames to a larger value (currently set to 8, giving a pool size of 32). [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Error submitting packet to decoder: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Error submitting packet to decoder: Cannot allocate memory ....... skip [mpegts @ 0x5596ba48c000] PES packet size mismatch0:03:46.20 bitrate=1650.3kbits/s speed=28.3x [mpegts @ 0x5596ba48c000] Packet corrupt (stream = 1, dts = 258142320). [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Cannot allocate memory .......... skip [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [mpeg2_qsv @ 0x5596ba3d1500] Too many errors when draining, this is a bug. Stop draining and force EOF. [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Internal bug, should not have happened
I attach also the "complete" ffmpeg output FWIW for both files, though skipping repeated error lines:
ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv -preset 4 dv01_07_av1_qsv_pr4.webm libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 [dv @ 0x556a3f643000] Estimating duration from bitrate, this may be inaccurate [vist#0:0/dvvideo @ 0x556a3f679100] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv". Input #0, dv, from 'dv01_07.dv': Metadata: timecode : 01:09:35:09 Duration: 00:01:53.28, start: 0.000000, bitrate: 28800 kb/s Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 28800 kb/s, 60k fps, 25 tbr, 60k tbn Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Stream mapping: Stream #0:0 -> #0:0 (dvvideo (native) -> av1 (av1_qsv)) Stream #0:1 -> #0:1 (pcm_s16le (native) -> opus (libopus)) Press [q] to stop, [?] for help [libopus @ 0x556a3f656580] No bit rate set. Defaulting to 96000 bps. [av1_qsv @ 0x556a3f653040] Using the constant quantization parameter (CQP) by default. Please use the global_quality option and other options for a quality-based mode or the b option and other options for a bitrate-based mode if the default is not the desired choice. Output #0, webm, to 'dv01_07_av1_qsv_pr4.webm': Metadata: timecode : 01:09:35:09 encoder : Lavf61.1.100 Stream #0:0: Video: av1, nv12(bottom coded first (swapped)), 720x576 [SAR 16:15 DAR 4:3], q=2-31, 25 fps, 1k tbn Metadata: encoder : Lavc61.3.100 av1_qsv Stream #0:1: Audio: opus, 48000 Hz, stereo, s16, 96 kb/s Metadata: encoder : Lavc61.3.100 libopus [out#0/webm @ 0x556a3f4da5c0] video:9315KiB audio:1186KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.505196% frame= 2832 fps=2106 q=-0.0 Lsize= 10554KiB time=00:01:53.24 bitrate= 763.5kbits/s speed=84.2x
bitrate= 763.5kbits/s
sounds a bit low even for av1, so may be try to set -b to some higher value as suggested? ==== av1_qsv @ 0x556a3f653040] Using the constant quantization parameter (CQP) by default. Please use the global_quality option and other options for a quality-based mode or the b option and other options for a bitrate-based mode if the default is not the desired choice. ====
------------------
ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i hdv09_04.m2t -c:v av1_qsv -preset 4 hdv09_04.m2t_av1_qsv_pr4.webm libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 [mpeg2video @ 0x5596ba391500] Invalid frame dimensions 0x0. Last message repeated 3 times [mpegts @ 0x5596ba48c000] PES packet size mismatch [mpegts @ 0x5596ba48c000] Packet corrupt (stream = 1, dts = 258142320). [mpegts @ 0x5596ba48c000] Could not find codec parameters for stream 2 (Unknown: none ([160][0][0][0] / 0x00A0)): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options [mpegts @ 0x5596ba48c000] Could not find codec parameters for stream 3 (Unknown: none ([161][0][0][0] / 0x00A1)): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options [vist#0:0/mpeg2video @ 0x5596ba394d00] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv". Input #0, mpegts, from 'hdv09_04.m2t': Duration: 00:03:59.06, start: 2629.496000, bitrate: 26110 kb/s Program 100 Stream #0:0[0x810]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 25 fps, 25 tbr, 90k tbn Side data: cpb: bitrate max/min/avg: 25000000/0/0 buffer size: 7340032 vbv_delay: N/A Stream #0:1[0x814]: Audio: mp2 (mp3float) ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 384 kb/s Stream #0:2[0x815]: Unknown: none ([160][0][0][0] / 0x00A0) Stream #0:3[0x811]: Unknown: none ([161][0][0][0] / 0x00A1) Stream mapping: Stream #0:0 -> #0:0 (mpeg2video (mpeg2_qsv) -> av1 (av1_qsv)) Stream #0:1 -> #0:1 (mp2 (native) -> opus (libopus)) Press [q] to stop, [?] for help [libopus @ 0x5596ba448cc0] No bit rate set. Defaulting to 96000 bps. [av1_qsv @ 0x5596ba39f1c0] Using the constant quantization parameter (CQP) by default. Please use the global_quality option and other options for a quality-based mode or the b option and other options for a bitrate-based mode if the default is not the desired choice. Output #0, webm, to 'hdv09_04.m2t_av1_qsv_pr4.webm': Metadata: encoder : Lavf61.1.100 Stream #0:0: Video: av1, qsv(tv, bt709, top coded first (swapped)), 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 25 fps, 1k tbn Metadata: encoder : Lavc61.3.100 av1_qsv Stream #0:1: Audio: opus, 48000 Hz, stereo, s16, 96 kb/s Metadata: encoder : Lavc61.3.100 libopus [mpeg2_qsv @ 0x5596ba3d1500] Failed to allocate a qsv/nv12 frame from a fixed pool of hardware frames. [mpeg2_qsv @ 0x5596ba3d1500] Consider setting extra_hw_frames to a larger value (currently set to 8, giving a pool size of 32). [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Error submitting packet to decoder: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Error submitting packet to decoder: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed ............skip [mpegts @ 0x5596ba48c000] PES packet size mismatch0:03:46.20 bitrate=1650.3kbits/s speed=28.3x [mpegts @ 0x5596ba48c000] Packet corrupt (stream = 1, dts = 258142320). [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Cannot allocate memory .......skip [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Cannot allocate memory [mpeg2_qsv @ 0x5596ba3d1500] get_buffer() failed [mpeg2_qsv @ 0x5596ba3d1500] Too many errors when draining, this is a bug. Stop draining and force EOF. [vist#0:0/mpeg2video @ 0x5596ba394d00] [dec:mpeg2_qsv @ 0x5596ba3921c0] Decoding error: Internal bug, should not have happened [out#0/webm @ 0x5596ba3cc400] video:45422KiB audio:2490KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.230717% frame= 5913 fps=700 q=-0.0 Lsize= 48022KiB time=00:03:58.77 bitrate=1647.6kbits/s dup=0 drop=4 speed=28.3x
-- Cin mailing list Cin@lists.cinelerra-gg.org https://lists.cinelerra-gg.org/mailman/listinfo/cin
On 6/19/24 02:44, Andrew Randrianasulu wrote:
------------ skip
-------------
In short, I have tested the same SD-DV 576i and HDV 1080i video files as with SVT-AV1 (CPU based) in another resent post.
ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv -preset 4 dv01_07_av1_qsv_pr4.webm frame= 2832 fps=2106 q=-0.0 Lsize= 10554KiB time=00:01:53.24 bitrate= 763.5kbits/s speed=84.2x
fmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i hdv09_04.m2t -c:v av1_qsv -preset 4 hdv09_04.m2t_av1_qsv_pr4.webm frame= 5913 fps=700 q=-0.0 Lsize= 48022KiB time=00:03:58.77 bitrate=1647.6kbits/s dup=0 drop=4 speed=28.3x
....skip
A warning output in both command lines is:
[vist#0:0/dvvideo @ 0x556a3f679100] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
I tried to add this without success, so suggestion is welcome !?
I got this succesful now and avoided this warning, see command lines below
And possibly suggestions regarding the more seriously errors "Cannot allocate memory" that arised from the second command transcoding the hdv file?
well, you tried to add -extra_hw_frames 16 for example to your ffmpeg line? I think mpeg2 is not most popular input codec nowadays ....
Yes, thank you. This worked, see below (not unlike previous extending the bufsize for transcoding to mpg(2) for DVD)
.I attach also the "complete" ffmpeg output FWIW for both files, though skipping repeated error lines:
ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv -preset 4 dv01_07_av1_qsv_pr4.webm ........skip
frame= 2832 fps=2106 q=-0.0 Lsize= 10554KiB time=00:01:53.24 bitrate= 763.5kbits/s speed=84.2x
bitrate= 763.5kbits/s
sounds a bit low even for av1, so may be try to set -b to some higher value as suggested?
As suggested where? bitrate= 763.5kbits/s was for SD-DV which was viewable and not quite bad in my eyes.
====
av1_qsv @ 0x556a3f653040] Using the constant quantization parameter (CQP) by default. Please use the global_quality option and other options for a quality-based mode or the b option and other options for a bitrate-based mode if the default is not the desired choice. ====
To make a direct speed performance comparison between this GPU -Hwaccel AV1_QSV encoding and my previou CPU based SVT-AV1 encoding, I have used the same ffmpeg command line parameters and preset 4, and iterated similar bitrate and file size as follows: SD-DV -> AV1 ------------ SVT-AV1: ffmpeg -hide_banner -i dv01_07.dv -c:v libsvtav1 -preset 4 -crf 35 -c:a libvorbis dv01_07_svt-av1_pr4.webm frame= 2832 fps= 50 q=35.0 Lsize= 24159KiB time=00:01:53.24 bitrate=1747.7kbits/s speed= 2x AV1_QSV: ffmpeg -hide_banner -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv -preset 4 -b:v 1570k -crf 35 -c:a libvorbis dv01_07_av1_qsv_pr4_b1570k.webm frame= 2832 fps=1891 q=-0.0 Lsize= 24166KiB time=00:01:53.24 bitrate=1748.2kbits/s speed=75.6x That is, AV1_QSV DV transcoding speed 75.6x/2x ~ 38x or fps 1891/50 ~ 38 faster than corresponding with SVT-AV1. File sizes: 389M dv01_07.dv 24M dv01_07_svt-av1_pr4.webm 24M dv01_07_av1_qsv_pr4_b1557k.webm HDV -> AV1 ---------- SVT-AV1: ffmpeg -hide_banner -i hdv09_04.m2t -c:v libsvtav1 -preset 4 -crf 35 -c:a libvorbis hdv09_04_svt-av1_pr4.webm frame= 5963 fps= 24 q=35.0 Lsize= 113663KiB time=00:03:58.77 bitrate=3899.6kbits/s speed=0.948x AV1_QSV: ffmpeg -hide_banner -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128 -extra_hw_frames 16 -i hdv09_04.m2t -c:v av1_qsv -preset 4 -b:v 3700k hdv09_04_av1_qsv_pr4_bv3700k.webm frame= 5963 fps=482 q=-0.0 Lsize= 113271KiB time=00:03:58.77 bitrate=3886.1kbits/s speed=19.3x That is, AV1_QSV HDV transcoding speed 19.3x/0.948x ~ 20x or fps 482/24 ~ 20 faster than corresponding with SVT-AV1 File sizes: 745M hdv09_04.m2t 111M hdv09_04_svt-av1_pr4.webm 111M hdv09_04_av1_qsv_pr4_bv3700k.webm ------------------ FFmpeg output for the latest QSV_AV1 transcoding follows. As seen the error messages messages are gone, though not quite clean as there are still some "disturbing" mpeg2video messages. SD-DV -> AV1 ---------- ffmpeg -hide_banner -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv -preset 4 -b:v 1570k -crf 35 -c:a libvorbis dv01_07_av1_qsv_pr4_b1570k.webm libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 [dv @ 0x5614ce553080] Estimating duration from bitrate, this may be inaccurate Input #0, dv, from 'dv01_07.dv': Metadata: timecode : 01:09:35:09 Duration: 00:01:53.28, start: 0.000000, bitrate: 28800 kb/s Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 28800 kb/s, 60k fps, 25 tbr, 60k tbn Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s [out#0/webm @ 0x5614ce3ea640] Codec AVOption crf (Select the quality for constant quality mode) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream. Stream mapping: Stream #0:0 -> #0:0 (dvvideo (native) -> av1 (av1_qsv)) Stream #0:1 -> #0:1 (pcm_s16le (native) -> vorbis (libvorbis)) Press [q] to stop, [?] for help Output #0, webm, to 'dv01_07_av1_qsv_pr4_b1570k.webm': Metadata: timecode : 01:09:35:09 encoder : Lavf61.1.100 Stream #0:0: Video: av1, nv12(bottom coded first (swapped)), 720x576 [SAR 16:15 DAR 4:3], q=2-31, 1570 kb/s, 25 fps, 1k tbn Metadata: encoder : Lavc61.3.100 av1_qsv Stream #0:1: Audio: vorbis, 48000 Hz, stereo, fltp Metadata: encoder : Lavc61.3.100 libvorbis [out#0/webm @ 0x5614ce3ea640] video:22613KiB audio:1495KiB subtitle:0KiB other streams:0KiB global headers:4KiB muxing overhead: 0.244968% frame= 2832 fps=1891 q=-0.0 Lsize= 24166KiB time=00:01:53.24 bitrate=1748.2kbits/s speed=75.6x HDV->AV1 --------- ffmpeg -hide_banner -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128 -extra_hw_frames 16 -i hdv09_04.m2t -c:v av1_qsv -preset 4 -b:v 3700k hdv09_04_av1_qsv_pr4_bv3700k.webm libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 [mpeg2video @ 0x5607564ea600] Invalid frame dimensions 0x0. Last message repeated 3 times [mpegts @ 0x56075643ee00] PES packet size mismatch [mpegts @ 0x56075643ee00] Packet corrupt (stream = 1, dts = 258142320). [mpegts @ 0x56075643ee00] Could not find codec parameters for stream 2 (Unknown: none ([160][0][0][0] / 0x00A0)): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options [mpegts @ 0x56075643ee00] Could not find codec parameters for stream 3 (Unknown: none ([161][0][0][0] / 0x00A1)): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options Input #0, mpegts, from 'hdv09_04.m2t': Duration: 00:03:59.06, start: 2629.496000, bitrate: 26110 kb/s Program 100 Stream #0:0[0x810]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 25 fps, 25 tbr, 90k tbn Side data: cpb: bitrate max/min/avg: 25000000/0/0 buffer size: 7340032 vbv_delay: N/A Stream #0:1[0x814]: Audio: mp2 (mp3float) ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 384 kb/s Stream #0:2[0x815]: Unknown: none ([160][0][0][0] / 0x00A0) Stream #0:3[0x811]: Unknown: none ([161][0][0][0] / 0x00A1) Stream mapping: Stream #0:0 -> #0:0 (mpeg2video (native) -> av1 (av1_qsv)) Stream #0:1 -> #0:1 (mp2 (native) -> opus (libopus)) Press [q] to stop, [?] for help [libopus @ 0x560756595f80] No bit rate set. Defaulting to 96000 bps. Output #0, webm, to 'hdv09_04_av1_qsv_pr4_bv3700k.webm': Metadata: encoder : Lavf61.1.100 Stream #0:0: Video: av1, nv12(tv, bt709, top coded first (swapped)), 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 3700 kb/s, 25 fps, 1k tbn Metadata: encoder : Lavc61.3.100 av1_qsv Stream #0:1: Audio: opus, 48000 Hz, stereo, s16, 96 kb/s Metadata: encoder : Lavc61.3.100 libopus [mpegts @ 0x56075643ee00] PES packet size mismatch0:03:51.36 bitrate=3834.3kbits/s speed=19.3x [mpegts @ 0x56075643ee00] Packet corrupt (stream = 1, dts = 258142320). [mpeg2video @ 0x560756595500] ac-tex damaged at 10 61 [mpeg2video @ 0x560756595500] Warning MVs not available [mpeg2video @ 0x560756595500] concealing 630 DC, 630 AC, 630 MV errors in P frame [vist#0:0/mpeg2video @ 0x5607564f6940] [dec:mpeg2video @ 0x560756440480] corrupt decoded frame [out#0/webm @ 0x5607565b2040] video:110669KiB audio:2490KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.098391% frame= 5963 fps=482 q=-0.0 Lsize= 113271KiB time=00:03:58.77 bitrate=3886.1kbits/s speed=19.3x
чт, 20 июн. 2024 г., 01:02 Terje J. Hanssen <terjejhanssen@gmail.com>:
On 6/19/24 02:44, Andrew Randrianasulu wrote:
------------ skip
-------------
In short, I have tested the same SD-DV 576i and HDV 1080i video files as with SVT-AV1 (CPU based) in another resent post.
ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv -preset 4 dv01_07_av1_qsv_pr4.webm frame= 2832 fps=2106 q=-0.0 Lsize= 10554KiB time=00:01:53.24 bitrate= 763.5kbits/s speed=84.2x
fmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i hdv09_04.m2t -c:v av1_qsv -preset 4 hdv09_04.m2t_av1_qsv_pr4.webm frame= 5913 fps=700 q=-0.0 Lsize= 48022KiB time=00:03:58.77 bitrate=1647.6kbits/s dup=0 drop=4 speed=28.3x
....skip
A warning output in both command lines is:
[vist#0:0/dvvideo @ 0x556a3f679100] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
I tried to add this without success, so suggestion is welcome !?
I got this succesful now and avoided this warning, see command lines below
And possibly suggestions regarding the more seriously errors "Cannot allocate memory" that arised from the second command transcoding the hdv file?
well, you tried to add -extra_hw_frames 16 for example to your ffmpeg line? I think mpeg2 is not most popular input codec nowadays ....
Yes, thank you. This worked, see below (not unlike previous extending the bufsize for transcoding to mpg(2) for DVD)
.I attach also the "complete" ffmpeg output FWIW for both files, though skipping repeated error lines:
ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv -preset 4 dv01_07_av1_qsv_pr4.webm ........skip
frame= 2832 fps=2106 q=-0.0 Lsize= 10554KiB time=00:01:53.24 bitrate=
763.5kbits/s speed=84.2x
bitrate= 763.5kbits/s
sounds a bit low even for av1, so may be try to set -b to some higher value as suggested?
As suggested where? bitrate= 763.5kbits/s was for SD-DV which was viewable and not quite bad in my eyes.
guess my guess was outdated (based on xvid days?) sorry!
====
av1_qsv @ 0x556a3f653040] Using the constant quantization parameter (CQP) by default. Please use the global_quality option and other options for a quality-based mode or the b option and other options for a bitrate-based mode if the default is not the desired choice. ====
To make a direct speed performance comparison between this GPU -Hwaccel AV1_QSV encoding and my previou CPU based SVT-AV1 encoding, I have used the same ffmpeg command line parameters and preset 4, and iterated similar bitrate and file size as follows:
SD-DV -> AV1 ------------
SVT-AV1: ffmpeg -hide_banner -i dv01_07.dv -c:v libsvtav1 -preset 4 -crf 35 -c:a libvorbis dv01_07_svt-av1_pr4.webm frame= 2832 fps= 50 q=35.0 Lsize= 24159KiB time=00:01:53.24 bitrate=1747.7kbits/s speed= 2x
AV1_QSV: ffmpeg -hide_banner -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv -preset 4 -b:v 1570k -crf 35 -c:a libvorbis dv01_07_av1_qsv_pr4_b1570k.webm frame= 2832 fps=1891 q=-0.0 Lsize= 24166KiB time=00:01:53.24 bitrate=1748.2kbits/s speed=75.6x
That is, AV1_QSV DV transcoding speed 75.6x/2x ~ 38x or fps 1891/50 ~ 38 faster than corresponding with SVT-AV1.
File sizes:
389M dv01_07.dv 24M dv01_07_svt-av1_pr4.webm 24M dv01_07_av1_qsv_pr4_b1557k.webm
HDV -> AV1 ----------
SVT-AV1: ffmpeg -hide_banner -i hdv09_04.m2t -c:v libsvtav1 -preset 4 -crf 35 -c:a libvorbis hdv09_04_svt-av1_pr4.webm frame= 5963 fps= 24 q=35.0 Lsize= 113663KiB time=00:03:58.77 bitrate=3899.6kbits/s speed=0.948x
AV1_QSV: ffmpeg -hide_banner -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128 -extra_hw_frames 16 -i hdv09_04.m2t -c:v av1_qsv -preset 4 -b:v 3700k hdv09_04_av1_qsv_pr4_bv3700k.webm frame= 5963 fps=482 q=-0.0 Lsize= 113271KiB time=00:03:58.77 bitrate=3886.1kbits/s speed=19.3x
That is, AV1_QSV HDV transcoding speed 19.3x/0.948x ~ 20x or fps 482/24 ~ 20 faster than corresponding with SVT-AV1
impressive!
File sizes:
745M hdv09_04.m2t 111M hdv09_04_svt-av1_pr4.webm 111M hdv09_04_av1_qsv_pr4_bv3700k.webm
------------------
I also hope quality is "good enough" for final/delivery transcode ...
FFmpeg output for the latest QSV_AV1 transcoding follows. As seen the error messages messages are gone, though not quite clean as there are still some "disturbing" mpeg2video messages.
SD-DV -> AV1 ---------- ffmpeg -hide_banner -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128 -i dv01_07.dv -c:v av1_qsv -preset 4 -b:v 1570k -crf 35 -c:a libvorbis dv01_07_av1_qsv_pr4_b1570k.webm
libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 [dv @ 0x5614ce553080] Estimating duration from bitrate, this may be inaccurate Input #0, dv, from 'dv01_07.dv': Metadata: timecode : 01:09:35:09 Duration: 00:01:53.28, start: 0.000000, bitrate: 28800 kb/s Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 28800 kb/s, 60k fps, 25 tbr, 60k tbn Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s [out#0/webm @ 0x5614ce3ea640] Codec AVOption crf (Select the quality for constant quality mode) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream. Stream mapping: Stream #0:0 -> #0:0 (dvvideo (native) -> av1 (av1_qsv)) Stream #0:1 -> #0:1 (pcm_s16le (native) -> vorbis (libvorbis)) Press [q] to stop, [?] for help Output #0, webm, to 'dv01_07_av1_qsv_pr4_b1570k.webm': Metadata: timecode : 01:09:35:09 encoder : Lavf61.1.100 Stream #0:0: Video: av1, nv12(bottom coded first (swapped)), 720x576 [SAR 16:15 DAR 4:3], q=2-31, 1570 kb/s, 25 fps, 1k tbn Metadata: encoder : Lavc61.3.100 av1_qsv Stream #0:1: Audio: vorbis, 48000 Hz, stereo, fltp Metadata: encoder : Lavc61.3.100 libvorbis [out#0/webm @ 0x5614ce3ea640] video:22613KiB audio:1495KiB subtitle:0KiB other streams:0KiB global headers:4KiB muxing overhead: 0.244968% frame= 2832 fps=1891 q=-0.0 Lsize= 24166KiB time=00:01:53.24 bitrate=1748.2kbits/s speed=75.6x
HDV->AV1 --------- ffmpeg -hide_banner -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128 -extra_hw_frames 16 -i hdv09_04.m2t -c:v av1_qsv -preset 4 -b:v 3700k hdv09_04_av1_qsv_pr4_bv3700k.webm
libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 libva info: VA-API version 1.21.0 libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 [mpeg2video @ 0x5607564ea600] Invalid frame dimensions 0x0. Last message repeated 3 times [mpegts @ 0x56075643ee00] PES packet size mismatch [mpegts @ 0x56075643ee00] Packet corrupt (stream = 1, dts = 258142320). [mpegts @ 0x56075643ee00] Could not find codec parameters for stream 2 (Unknown: none ([160][0][0][0] / 0x00A0)): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options [mpegts @ 0x56075643ee00] Could not find codec parameters for stream 3 (Unknown: none ([161][0][0][0] / 0x00A1)): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options Input #0, mpegts, from 'hdv09_04.m2t': Duration: 00:03:59.06, start: 2629.496000, bitrate: 26110 kb/s Program 100 Stream #0:0[0x810]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 25 fps, 25 tbr, 90k tbn Side data: cpb: bitrate max/min/avg: 25000000/0/0 buffer size: 7340032 vbv_delay: N/A Stream #0:1[0x814]: Audio: mp2 (mp3float) ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 384 kb/s Stream #0:2[0x815]: Unknown: none ([160][0][0][0] / 0x00A0) Stream #0:3[0x811]: Unknown: none ([161][0][0][0] / 0x00A1) Stream mapping: Stream #0:0 -> #0:0 (mpeg2video (native) -> av1 (av1_qsv)) Stream #0:1 -> #0:1 (mp2 (native) -> opus (libopus)) Press [q] to stop, [?] for help [libopus @ 0x560756595f80] No bit rate set. Defaulting to 96000 bps. Output #0, webm, to 'hdv09_04_av1_qsv_pr4_bv3700k.webm': Metadata: encoder : Lavf61.1.100 Stream #0:0: Video: av1, nv12(tv, bt709, top coded first (swapped)), 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 3700 kb/s, 25 fps, 1k tbn Metadata: encoder : Lavc61.3.100 av1_qsv Stream #0:1: Audio: opus, 48000 Hz, stereo, s16, 96 kb/s Metadata: encoder : Lavc61.3.100 libopus [mpegts @ 0x56075643ee00] PES packet size mismatch0:03:51.36 bitrate=3834.3kbits/s speed=19.3x [mpegts @ 0x56075643ee00] Packet corrupt (stream = 1, dts = 258142320). [mpeg2video @ 0x560756595500] ac-tex damaged at 10 61 [mpeg2video @ 0x560756595500] Warning MVs not available [mpeg2video @ 0x560756595500] concealing 630 DC, 630 AC, 630 MV errors in P frame [vist#0:0/mpeg2video @ 0x5607564f6940] [dec:mpeg2video @ 0x560756440480] corrupt decoded frame [out#0/webm @ 0x5607565b2040] video:110669KiB audio:2490KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.098391% frame= 5963 fps=482 q=-0.0 Lsize= 113271KiB time=00:03:58.77 bitrate=3886.1kbits/s speed=19.3x
so, may be after whole setup was verified to function correctly at least in bare ffmpeg we can iterate back to vaapi for creating cingg profile ? (if I understand correctly qsv adds additional layer/library on top of vaapi driver - not something I wish to deal with in appimage packaging ....)
On 6/20/24 00:13, Andrew Randrianasulu wrote:
....skip
so, may be after whole setup was verified to function correctly at least in bare ffmpeg we can iterate back to vaapi for creating cingg profile ? (if I understand correctly qsv adds additional layer/library on top of vaapi driver - not something I wish to deal with in appimage packaging ....)
Yes, Vaapi may also be of my interest next, when I (soon) have my legacy WS rebuild with working hw pieces, possibly also for my laptop with igpu. I admit that I myself as a user have not yet a full overview over the HWA methods, software packages and drivers needed for each method. So far reading the FFmpeg's HWAccel-Intro, Jellyfin pages, relevant Linux distro pages etc is an attempt. What I have noticed is that VA-API is an open-source library and API specification (originally developed by Intel) , which provides access to graphics hardware acceleration capabilities for video processing. It consists of a main library and driver-specific acceleration backends for each supported hardware vendor. Libva is an implementation for VA-API (Video Acceleration API) The Intel(R) Media Driver for VAAPI is a new VA-API (Video Acceleration API) user mode driver supporting hardware accelerated decoding, encoding, and video post processing for GEN based graphics hardware. https://github.com/intel/libva?tab=readme-ov-file#libva-project https://fuchsia.googlesource.com/third_party/github.com/intel/media-driver/+... Regarding QSV on Arc GPU it looked for me at first as Intel had drivers and repositories only available for Ubuntu https://dgpu-docs.intel.com/driver/client/overview.html However, I myself have simply just installed and used the current ffmpeg-7 prebuild thanks to the Packman Team, beside other related multimedia and codecs packages for openSUSE Tw Slowroll: inxi -GS System: Host: localhost.localdomain Kernel: 6.9.5-1-default arch: x86_64 bits: 64 Desktop: GNOME v: 46.2 Distro: openSUSE Tumbleweed-Slowroll 20240605 Graphics: Device-1: Intel DG2 [Arc A750] driver: i915 v: kernel Device-2: Microdia Camera driver: snd-usb-audio,uvcvideo type: USB Display: wayland server: X.org v: 1.21.1.12 with: Xwayland v: 24.1.0 compositor: gnome-shell driver: gpu: i915 resolution: 2560x1440~60Hz API: OpenGL v: 4.6 vendor: intel mesa v: 24.0.8 renderer: Mesa Intel Arc A750 Graphics (DG2) API: EGL Message: EGL data requires eglinfo. Check --recommends. zypper se -is ffmpeg vaapi libva vulkan intel qsv svt vpl Loading repository data... Reading installed packages... S | Name | Type | Version | Arch | Repository ---+---------------------------+---------+--------------------------+--------+------------------------- i+ | ffmpeg-7 | package | 7.0-1699.3.pm.7 | x86_64 | Packman i+ | intel-cmt-cat | package | 5.0.0.10.git+b26b31b-1.2 | x86_64 | openSUSE-Slowroll-Oss i+ | intel-gpu-tools | package | 1.28-3.4 | x86_64 | openSUSE-Slowroll-Oss i+ | intel-media-driver | package | 24.1.3-1.2 | x86_64 | openSUSE-Slowroll-Oss i+ | intel-opencl | package | 24.13.29138.7-1.1 | x86_64 | openSUSE-Slowroll-Oss i+ | intel-SINIT | package | 2.3-88.11 | noarch | openSUSE-Slowroll-Oss i | intel-vaapi-driver | package | 2.4.1-5.13 | x86_64 | openSUSE-Slowroll-Oss i | kernel-firmware-intel | package | 20240618-1.1 | noarch | openSUSE-Slowroll-Update i | libdrm_intel1 | package | 2.4.121-1.1 | x86_64 | openSUSE-Slowroll-Oss i | libgstvulkan-1_0-0 | package | 1.24.0-4.1 | x86_64 | openSUSE-Slowroll-Oss i | libheif-ffmpeg | package | 1.17.6-1699.5.pm.9 | x86_64 | Packman i | libheif-svtenc | package | 1.17.6-1699.5.pm.9 | x86_64 | Packman i | liblavplay-2_2-0 | package | 2.2.1-2.10 | x86_64 | openSUSE-Slowroll-Oss i | libSvtAv1Dec0 | package | 2.1.0-1.1 | x86_64 | openSUSE-Slowroll-Oss i | libSvtAv1Enc2 | package | 2.1.0-1.1 | x86_64 | openSUSE-Slowroll-Oss i | libva-drm2 | package | 2.21.0-1.1 | x86_64 | openSUSE-Slowroll-Oss i | libva-glx2 | package | 2.21.0-1.1 | x86_64 | openSUSE-Slowroll-Oss i | libva-wayland2 | package | 2.21.0-1.1 | x86_64 | openSUSE-Slowroll-Oss i | libva-x11-2 | package | 2.21.0-1.1 | x86_64 | openSUSE-Slowroll-Oss i | libva2 | package | 2.21.0-1.1 | x86_64 | openSUSE-Slowroll-Oss i | libvpl2 | package | 2.10.1-2.2 | x86_64 | openSUSE-Slowroll-Oss i | libvulkan1 | package | 1.3.283.0-1.1 | x86_64 | openSUSE-Slowroll-Oss i+ | libvulkan_intel | package | 24.0.8-1699.384.pm.1 | x86_64 | Packman i+ | libze_intel_gpu1 | package | 24.13.29138.7-1.1 | x86_64 | openSUSE-Slowroll-Oss i | Mesa-libva | package | 24.0.8-1699.384.pm.1 | x86_64 | Packman i+ | Mesa-vulkan-device-select | package | 24.0.8-1699.384.pm.1 | x86_64 | Packman i+ | openvino-intel-cpu-plugin | package | 2024.1.0-1.1 | x86_64 | openSUSE-Slowroll-Oss i+ | SVT-AV1 | package | 2.1.0-1.1 | x86_64 | openSUSE-Slowroll-Oss i+ | ucode-intel | package | 20240514-1.1 | x86_64 | openSUSE-Slowroll-Oss zypper info libva2 libvpl2 Loading repository data... Reading installed packages... Information for package libva2: ------------------------------- Repository : openSUSE-Slowroll-Oss Name : libva2 Version : 2.21.0-1.1 Arch : x86_64 Vendor : openSUSE Installed Size : 187.2 KiB Installed : Yes (automatically) Status : up-to-date Source package : libva-2.21.0-1.1.src Upstream URL : https://01.org/linuxmedia Summary : Video Acceleration API Description : The libva library implements the Video Acceleration API. The library loads a hardware dependendent driver. This is the core runtime library. Information for package libvpl2: -------------------------------- Repository : openSUSE-Slowroll-Oss Name : libvpl2 Version : 2.10.1-2.2 Arch : x86_64 Vendor : openSUSE Installed Size : 353.0 KiB Installed : Yes (automatically) Status : up-to-date Source package : libvpl-2.10.1-2.2.src Upstream URL : https://github.com/oneapi-src/oneVPL Summary : oneAPI Video Processing Library (oneVPL) dispatcher Description : The oneAPI Video Processing Library (oneVPL) provides a single video processing API for encode, decode, and video processing that works across a wide range of accelerators.
participants (2)
-
Andrew Randrianasulu -
Terje J. Hanssen