Den 26.04.2025 22:37, skrev Andrew
Randrianasulu via Cin:
RADV_PERFTEST=video_decode,video_encode time -p
./ffmpeg -init_hw_device vulkan=vulkan -filter_hw_device
vulkan -hwaccel vulkan -i
~/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov
-vf
libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos:colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
-c:a copy -c:v libx264 -f mp4 -benchmark
/dev/shm/ffmpeg-git-libplacebo-vulkan-2k.mp4
frame= 1148 fps= 10 q=-1.0 Lsize= 30435KiB
time=00:00:19.13 bitrate=13029.3kbits/s speed=0.167x
bench: utime=355.600s stime=25.878s
rtime=114.342s
so nearly 10 fps with scaled to FHD input!
(otherwise 32bit x264 OOMs)
==================
I admit I'm not sure what's going on in every detail above and
below. But I've tried to adapt something similar or equivalent (?)
using my Google Pixel 7 Pro smartphone to record a small HDR10 video
clip, and then using ffmpeg on my Intel Alder Lake cpu/DG2 gpu
workstation. Comments are welcome for correction and learning?
Well, 125 fps sounds fast ;)
This line tries to convert HDR video to SDR version, same size (for your case) but it now 10bit h264 instead of 10bit h265.
You probably can add format=yuv420p before all other -vf liblacebo options so resulting file will be more compatible 8bit h264.
You can try to watch both vids side by side, I think mpv uses same algorithm as libplacebo, so on SDR screen results must look close to each other?
System:
Host: localhost.localdomain Kernel:
6.12.24-1.0.2.sr20250402-longterm
arch: x86_64 bits: 64
Desktop: GNOME v: 48.0 Distro: openSUSE Tumbleweed-Slowroll
20250402
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: x11 server: X.org v: 1.21.1.15 with: Xwayland v: 24.1.6
driver:
X: loaded: modesetting unloaded: vesa dri: iris gpu: i915
resolution: 2560x1440~60Hz
API: EGL v: 1.5 drivers: iris,swrast platforms:
gbm,x11,surfaceless,device
API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 25.0.4
renderer: Mesa Intel Arc A750 Graphics (DG2)
API: Vulkan v: 1.4.309 drivers: N/A surfaces: xcb,xlib
Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo gpu:
gputop,
intel_gpu_top, lsgpu x11: xprop,xrandr
-----------
ffmpeg -hide_banner
-init_hw_device vulkan=vulkan -filter_hw_device vulkan -hwaccel
vulkan -i PXL_20250427_195356771.TS.mp4 -vf
libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos:colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
-c:a copy -c:v libx264 -f mp4 -benchmark
ffmpeg-libplacebo-PXL_20250427_195356771.TS.mp4
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55685cd87c00] All samples in data
stream index:id [3:4] have zero duration, stream set to be
discarded by default. Override using AVStream->discard or
-discard for ffmpeg command.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'PXL_20250427_195356771.TS.mp4':
Metadata:
major_brand : isom
minor_version : 131072
compatible_brands: isomiso2mp41
creation_time : 2025-04-27T19:54:05.000000Z
SpecialTypeID :
com.google.android.apps.camera.gallery.specialtype.SpecialType-AMETHYST
com.android.capture.fps: 30.000000
com.android.model: Pixel 7 Pro
com.android.manufacturer: Google
Duration: 00:00:06.97, start: 0.000000, bitrate: 20255 kb/s
Stream #0:0[0x1](eng): Data: none (mett / 0x7474656D), 47 kb/s
(default)
Metadata:
creation_time : 2025-04-27T19:54:05.000000Z
handler_name : MetaHandle
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D),
48000 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
creation_time : 2025-04-27T19:54:05.000000Z
handler_name : SoundHandle
vendor_id : [0][0][0][0]
Stream #0:2[0x3](eng): Video: hevc (Main 10) (hvc1 /
0x31637668), yuv420p10le(tv, bt2020nc/bt2020/arib-std-b67),
1920x1080, 20010 kb/s, SAR 1:1 DAR 16:9, 29.99 fps, 30 tbr, 90k
tbn (default)
Metadata:
creation_time : 2025-04-27T19:54:05.000000Z
handler_name : VideoHandle
vendor_id : [0][0][0][0]
Stream #0:3[0x4](eng): Data: none (mett / 0x7474656D) (default)
Metadata:
creation_time : 2025-04-27T19:54:05.000000Z
handler_name : MetaHandle
File 'ffmpeg-libplacebo-PXL_20250427_195356771.TS.mp4' already
exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:2 -> #0:0 (hevc (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
MESA-INTEL: warning: ../src/intel/vulkan/anv_formats.c:834:
FINISHME: support more multi-planar formats with DRM modifiers
[libx264 @ 0x55685cdc5d40] using SAR=1/1
[libx264 @ 0x55685cdc5d40] using cpu capabilities: MMX2 SSE2Fast
SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55685cdc5d40] profile High 10, level 4.0, 4:2:0,
10-bit
[libx264 @ 0x55685cdc5d40] 264 - core 164 - H.264/MPEG-4 AVC codec
- Copyleft 2003-2023 - 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=30 lookahead_threads=5
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=crf mbtree=1
crf=23.0 qcomp=0.60 qpmin=0 qpmax=81 qpstep=4 ip_ratio=1.40
aq=1:1.00
Output #0, mp4, to
'ffmpeg-libplacebo-PXL_20250427_195356771.TS.mp4':
Metadata:
major_brand : isom
minor_version : 131072
compatible_brands: isomiso2mp41
com.android.manufacturer: Google
SpecialTypeID :
com.google.android.apps.camera.gallery.specialtype.SpecialType-AMETHYST
com.android.capture.fps: 30.000000
com.android.model: Pixel 7 Pro
encoder : Lavf61.7.100
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661),
yuv420p10le(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9],
q=2-31, 30 fps, 15360 tbn (default)
Metadata:
creation_time : 2025-04-27T19:54:05.000000Z
handler_name : VideoHandle
vendor_id : [0][0][0][0]
encoder : Lavc61.19.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay:
N/A
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 192 kb/s (default)
Metadata:
creation_time : 2025-04-27T19:54:05.000000Z
handler_name : SoundHandle
vendor_id : [0][0][0][0]
[out#0/mp4 @ 0x55685cd8ad40] video:3416KiB audio:163KiB
subtitle:0KiB other streams:0KiB global headers:0KiB muxing
overhead: 0.246920%
frame= 209 fps=125 q=-1.0 Lsize= 3587KiB time=00:00:06.90
bitrate=4259.0kbits/s speed=4.14x
bench: utime=17.173s stime=0.719s rtime=1.667s
bench: maxrss=2162156KiB
[libx264 @ 0x55685cdc5d40] frame I:2 Avg QP:31.03 size:100880
[libx264 @ 0x55685cdc5d40] frame P:67 Avg QP:36.43 size: 30951
[libx264 @ 0x55685cdc5d40] frame B:140 Avg QP:43.70 size: 8726
[libx264 @ 0x55685cdc5d40] consecutive B-frames: 7.7% 7.7% 4.3%
80.4%
[libx264 @ 0x55685cdc5d40] mb I I16..4: 14.9% 48.7% 36.5%
[libx264 @ 0x55685cdc5d40] mb P I16..4: 1.1% 0.9% 1.3%
P16..4: 15.0% 7.6% 5.3% 0.0% 0.0% skip:68.8%
[libx264 @ 0x55685cdc5d40] mb B I16..4: 0.0% 0.0% 0.0%
B16..8: 12.7% 4.5% 1.4% direct: 1.8% skip:79.4% L0:46.4%
L1:46.7% BI: 6.8%
[libx264 @ 0x55685cdc5d40] 8x8 transform intra:37.2% inter:33.8%
[libx264 @ 0x55685cdc5d40] coded y,uvDC,uvAC intra: 37.3% 52.3%
41.1% inter: 6.5% 5.8% 2.8%
[libx264 @ 0x55685cdc5d40] i16 v,h,dc,p: 37% 60% 3% 1%
[libx264 @ 0x55685cdc5d40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 66% 8%
14% 1% 0% 0% 0% 0% 10%
[libx264 @ 0x55685cdc5d40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 58%
9% 1% 1% 1% 1% 1% 7%
[libx264 @ 0x55685cdc5d40] i8c dc,h,v,p: 47% 40% 12% 1%
[libx264 @ 0x55685cdc5d40] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x55685cdc5d40] ref P L0: 75.6% 11.8% 12.6%
[libx264 @ 0x55685cdc5d40] ref B L0: 88.4% 8.8% 2.8%
[libx264 @ 0x55685cdc5d40] ref B L1: 95.0% 5.0%
[libx264 @ 0x55685cdc5d40] kb/s:4015.85
================
ffmpeg git
8bb682d454990a1049a21f1f51442205ea3337e9
configured as
./configure --enable-opencl --disable-debug
--enable-libx265 --enable-libx264 --enable-gpl
--enable-libplacebo --enable-vulkan --enable-libshaderc
--enable-libzimg --enable-libaom --enable-libdav1d
--enable-libsoxr --enable-libfontconfig --enable-libfreetype
--enable-libfribidi --enable-gnutls --enable-libass
--enable-libbluray --enable-libcdio --enable-frei0r
--enable-libgsm --enable-openal --enable-libopus
--enable-librtmp --enable-libsnappy --enable-libspeex
--enable-libssh --enable-libtheora --enable-libtwolame
--enable-libv4l2 --enable-libvidstab --enable-libvorbis
--enable-libvpx --enable-libwebp
Cpu usage for just decoding also was lower than
in vaapi case, so *some* use for Vulkan decode, contrary to my
initial sceptecism!