[Cin] New speed winner for hw tonemapping!
Andrew Randrianasulu
randrianasulu at gmail.com
Mon Apr 28 23:52:30 CEST 2025
вт, 29 апр. 2025 г., 00:47 Terje J. Hanssen <terjejhanssen at gmail.com>:
>
>
> Den 28.04.2025 17:38, skrev Andrew Randrianasulu:
>
>
>
> пн, 28 апр. 2025 г., 17:20 Terje J. Hanssen <terjejhanssen at gmail.com>:
>
>>
>> Den 27.04.2025 23:39, skrev Andrew Randrianasulu:
>>
>>
>>
>> вс, 27 апр. 2025 г., 23:58 Terje J. Hanssen <terjejhanssen at gmail.com>:
>>
>>>
>>> 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?
>>
>>
>>
>> I tried also to convert adding -vf format=yuv420p,
>>
>
> sorry, I mean
>
> -i ~/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov -vf
> libplacebo=format=yuv444p: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
>
> format as part of -vf libplacebo string, not separate ffmpeg filter.
>
>
>
> but both the 10bit and 8bit output files are distorted when playback with
>> vlc, mpv or ffplay.
>> In comparison testing with my highest ProRes hq 10bit video file as input
>> (not HDR), the output mp4 file looks fine with the same ffmpeg code line.
>>
>> Was there a download site with small HDR10 test clips available, so we
>> can test and compare using the same input?
>>
>
> No clips themselves, but wiki with links to them
>
> https://kodi.wiki/view/Samples
>
> I used
>
> Apple "special" clip
>
> "HDR10 HEVC 59.94 (MOV, @hdmkv's iPhone 11 Pro Max raw 4K footage using 4K
> HDR Video Recorder app)"
>
>
> https://drive.google.com/file/d/1Ic9DZXMSo07EJMqCFaQRKSSrSw6y1mYv/view?usp=sharing
>
>
> ================
>
> For some reasons, the conversions work fine when I leave out the export of
> environment variables:
>
> env | egrep -i "ANV|vulkan"
>
may be latest mesa vulkan driver for intel enabled those extensions by
default ....
Enjoy THE SPEEED! ;)
>
> a) HDR10 UHD/4k --> SDR FHD/2k
> -------------------------------
>
> Downloaded the inpput testfile from
> "HDR10 HEVC 59.94 (MOV, @hdmkv's iPhone 11 Pro Max raw 4K footage using 4K
> HDR Video Recorder app)"
>
> https://drive.google.com/file/d/1Ic9DZXMSo07EJMqCFaQRKSSrSw6y1mYv/view?usp=sharing
>
> time -p ffmpeg -hide_banner -init_hw_device vulkan=vulkan
> -filter_hw_device vulkan -hwaccel vulkan -i
> 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
> ffmpeg-libplacebo-iPhone11_4K-recorder_59.940HDR10.mp4
>
> frame= 1148 fps= 86 q=-1.0 Lsize= 32501KiB time=00:00:19.13
> bitrate=13913.6kbits/s speed=1.43x
> bench: utime=235.787s stime=2.261s rtime=13.349s
> bench: maxrss=3259684KiB
> real 13,45
> user 235,84
> sys 2,30
>
>
> b) HDR FHD/2k --> SDR FHD/2k
> -----------------------------
>
> Recorded input video test clip with Pixel 7 Pro smartphone
>
> time -p 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.mp4
>
> frame= 209 fps=104 q=-1.0 Lsize= 2862KiB time=00:00:06.90
> bitrate=3398.0kbits/s speed=3.44x
> bench: utime=27.177s stime=0.512s rtime=2.007s
> bench: maxrss=2327544KiB
> real 4,96
> user 27,24
> sys 0,54
>
>
> du -sh *
> 32M ffmpeg-libplacebo-iPhone11_4K-recorder_59.940HDR10.mp4
> 2,8M ffmpeg-libplacebo-PXL_20250427_195356771.mp4
> 158M iPhone11_4K-recorder_59.940HDR10.mov
> 17M PXL_20250427_195356771.TS.mp4
>
> =============================
>
> and less demanding (but still slideshow w/o hw acceleration!)
>
> "HDR10+ Profile B HEVC 10-bit 23.976 Sample (MKV with EAC-3 JOC ATMOS
> audio)"
>
> https://mega.nz/file/nehDka6Z#C5_OPbSZkONdOp1jRmc09C9-viDc3zMj8ZHruHcWKyA
>
>
>
>>
>> time -p ffmpeg -hide_banner -init_hw_device vulkan=vulkan
>> -filter_hw_device vulkan -hwaccel vulkan -i PXL_20250427_195356771.TS.mp4
>> -vf
>> format=yuv420p,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 @ 0x56364496c680] 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 @ 0x563644986d40] using SAR=1/1
>> [libx264 @ 0x563644986d40] using cpu capabilities: MMX2 SSE2Fast SSSE3
>> SSE4.2 AVX FMA3 BMI2 AVX2
>> [libx264 @ 0x563644986d40] profile High, level 4.0, 4:2:0, 8-bit
>> [libx264 @ 0x563644986d40] 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=69 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), yuv420p(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 @ 0x56364496f940] video:3480KiB audio:163KiB subtitle:0KiB
>> other streams:0KiB global headers:0KiB muxing overhead: 0.242542%
>> frame= 209 fps=116 q=-1.0 Lsize= 3651KiB time=00:00:06.90
>> bitrate=4335.2kbits/s speed=3.83x
>> bench: utime=14.435s stime=0.739s rtime=1.804s
>> bench: maxrss=1455376KiB
>> [libx264 @ 0x563644986d40] frame I:2 Avg QP:18.68 size:105708
>> [libx264 @ 0x563644986d40] frame P:66 Avg QP:23.77 size: 32017
>> [libx264 @ 0x563644986d40] frame B:141 Avg QP:31.40 size: 8783
>> [libx264 @ 0x563644986d40] consecutive B-frames: 7.2% 6.7% 5.7% 80.4%
>> [libx264 @ 0x563644986d40] mb I I16..4: 32.3% 25.8% 41.9%
>> [libx264 @ 0x563644986d40] mb P I16..4: 0.4% 0.5% 1.2% P16..4:
>> 16.7% 8.0% 5.6% 0.0% 0.0% skip:67.5%
>> [libx264 @ 0x563644986d40] mb B I16..4: 0.0% 0.0% 0.0% B16..8:
>> 12.9% 4.5% 1.4% direct: 1.8% skip:79.2% L0:46.1% L1:47.2% BI: 6.8%
>> [libx264 @ 0x563644986d40] 8x8 transform intra:23.8% inter:36.3%
>> [libx264 @ 0x563644986d40] coded y,uvDC,uvAC intra: 56.1% 64.0% 50.1%
>> inter: 6.8% 6.4% 2.8%
>> [libx264 @ 0x563644986d40] i16 v,h,dc,p: 53% 44% 2% 1%
>> [libx264 @ 0x563644986d40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 16% 16%
>> 2% 1% 0% 0% 0% 21%
>> [libx264 @ 0x563644986d40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 56% 12%
>> 1% 1% 1% 1% 1% 7%
>> [libx264 @ 0x563644986d40] i8c dc,h,v,p: 42% 45% 13% 1%
>> [libx264 @ 0x563644986d40] Weighted P-Frames: Y:0.0% UV:0.0%
>> [libx264 @ 0x563644986d40] ref P L0: 68.8% 8.1% 12.7% 10.4%
>> [libx264 @ 0x563644986d40] ref B L0: 88.9% 8.3% 2.8%
>> [libx264 @ 0x563644986d40] ref B L1: 94.5% 5.5%
>> [libx264 @ 0x563644986d40] kb/s:4091.33
>> real 4,76
>> user 14,49
>> sys 0,77
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20250429/4c5712da/attachment-0001.htm>
More information about the Cin
mailing list