[Cin] OpenCL again
Andrea paz
gamberucci.andrea at gmail.com
Tue Feb 14 09:54:03 CET 2023
Here is the clinfo. Keep in mind that AMD video cards are problematic
in Arch linux and my RX 5700XT is even more so. So I use the open
"amdgpu + mesa" driver, but for OpenCL I use the driver extracted from
amdgpu-pro (closed) via the "opencl-amd" package found in AUR:
https://pastebin.com/GaeCw33j
Using the command:
ffmpeg -i kumar.mp4 -vf
"format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010"
sdr.mp4
I get error (NOTE: I omitted the first part of summary [...]):
[...]
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'kumar.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41isomavc1
creation_time : 2021-01-29T03:44:29.000000Z
Duration: 00:00:08.42, start: 0.000000, bitrate: 11930 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
yuv420p(tv, bt709, progressive), 2560x1440, 11923 kb/s, 60 fps, 60
tbr, 60 tbn (default)
Metadata:
creation_time : 2021-01-29T03:44:29.000000Z
handler_name : L-SMASH Video Handler
vendor_id : [0][0][0][0]
encoder : AVC Coding
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[hwupload @ 0x55d02f90bf00] A hardware device reference is required to
upload frames to.
[Parsed_hwupload_1 @ 0x55d030732540] Query format failed for
'Parsed_hwupload_1': Invalid argument
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!
Trying to also use the options "-init_hw_device opencl=gpu
-filter_hw_device gpu" I still get error:
[...]
[AVHWDeviceContext @ 0x55f2d5c9a680] QSV to OpenCL mapping not usable.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'kumar.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41isomavc1
creation_time : 2021-01-29T03:44:29.000000Z
Duration: 00:00:08.42, start: 0.000000, bitrate: 11930 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
yuv420p(tv, bt709, progressive), 2560x1440, 11923 kb/s, 60 fps, 60
tbr, 60 tbn (default)
Metadata:
creation_time : 2021-01-29T03:44:29.000000Z
handler_name : L-SMASH Video Handler
vendor_id : [0][0][0][0]
encoder : AVC Coding
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[tonemap_opencl @ 0x55f2d6cf9780] unsupported transfer function characteristic.
Error while filtering: Function not implemented
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
Conversion failed!
Trying to use bt709 instead of bt2020:
[...]
[AVHWDeviceContext @ 0x56091bb58680] QSV to OpenCL mapping not usable.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'kumar.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41isomavc1
creation_time : 2021-01-29T03:44:29.000000Z
Duration: 00:00:08.42, start: 0.000000, bitrate: 11930 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
yuv420p(tv, bt709, progressive), 2560x1440, 11923 kb/s, 60 fps, 60
tbr, 60 tbn (default)
Metadata:
creation_time : 2021-01-29T03:44:29.000000Z
handler_name : L-SMASH Video Handler
vendor_id : [0][0][0][0]
encoder : AVC Coding
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[tonemap_opencl @ 0x56091cbb76c0] unsupported transfer function characteristic.
Error while filtering: Function not implemented
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
Conversion failed!
Trying with nv12 instead of p010 gives the same error.
Trying with another HDR video works:
$ ffmpeg -init_hw_device opencl=gpu -filter_hw_device gpu -i
New_York.ts -vf
"format=p010,hwupload,tonemap_opencl=t=bt709:tonemap=linear:format=p010,hwdownload,format=p010"
sdr.mp4
[...]
[AVHWDeviceContext @ 0x55ab233ad680] QSV to OpenCL mapping not usable.
[mpegts @ 0x55ab233f3540] start time for stream 1 is not set in
estimate_timings_from_pts
[mpegts @ 0x55ab233f3540] stream 1 : no TS found at start of file,
duration not set
[mpegts @ 0x55ab233f3540] Could not find codec parameters for stream 1
(Audio: aac ([15][0][0][0] / 0x000F), 0 channels): unspecified sample
format
Consider increasing the value for the 'analyzeduration' (0) and
'probesize' (5000000) options
Input #0, mpegts, from 'New_York.ts':
Duration: 00:01:12.24, start: 0.999989, bitrate: 52032 kb/s
Program 1
Stream #0:0[0x101]: Video: hevc (Main 10) ([36][0][0][0] / 0x0024),
yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR
16:9], 25 fps, 25 tbr, 90k tbn
Stream #0:1[0x102](und): Audio: aac ([15][0][0][0] / 0x000F), 0 channels
File 'sdr.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x55ab23549580] using SAR=1/1
[libx264 @ 0x55ab23549580] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55ab23549580] profile High 10, level 5.1, 4:2:0, 10-bit
[libx264 @ 0x55ab23549580] 264 - core 164 r3095 baee400 - 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=24 lookahead_threads=4 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 'sdr.mp4':
Metadata:
encoder : Lavf59.27.100
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p10le(tv,
bt2020nc/bt2020/bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9],
q=2-31, 25 fps, 12800 tbn
Metadata:
encoder : Lavc59.37.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 1806 fps= 20 q=-1.0 Lsize= 172058kB time=00:01:12.12
bitrate=19543.8kbits/s speed=0.782x
video:172035kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.013862%
[libx264 @ 0x55ab23549580] frame I:22 Avg QP:28.31 size:714949
[libx264 @ 0x55ab23549580] frame P:495 Avg QP:33.55 size:194494
[libx264 @ 0x55ab23549580] frame B:1289 Avg QP:37.99 size: 49775
[libx264 @ 0x55ab23549580] consecutive B-frames: 3.7% 2.4% 2.8% 91.0%
[libx264 @ 0x55ab23549580] mb I I16..4: 28.8% 52.4% 18.9%
[libx264 @ 0x55ab23549580] mb P I16..4: 6.0% 10.5% 1.1% P16..4:
33.7% 10.5% 8.3% 0.0% 0.0% skip:30.0%
[libx264 @ 0x55ab23549580] mb B I16..4: 0.9% 2.7% 0.3% B16..8:
29.0% 3.1% 0.9% direct: 2.3% skip:60.8% L0:43.2% L1:50.0% BI:
6.8%
[libx264 @ 0x55ab23549580] 8x8 transform intra:61.8% inter:74.7%
[libx264 @ 0x55ab23549580] coded y,uvDC,uvAC intra: 43.4% 47.4% 16.3%
inter: 14.0% 10.8% 1.1%
[libx264 @ 0x55ab23549580] i16 v,h,dc,p: 33% 36% 10% 21%
[libx264 @ 0x55ab23549580] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 27% 27%
3% 4% 4% 6% 4% 7%
[libx264 @ 0x55ab23549580] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 31% 10%
4% 6% 7% 8% 5% 7%
[libx264 @ 0x55ab23549580] i8c dc,h,v,p: 64% 19% 13% 4%
[libx264 @ 0x55ab23549580] Weighted P-Frames: Y:28.1% UV:20.0%
[libx264 @ 0x55ab23549580] ref P L0: 68.1% 18.4% 11.7% 1.8%
[libx264 @ 0x55ab23549580] ref B L0: 86.6% 10.4% 3.0%
[libx264 @ 0x55ab23549580] ref B L1: 94.4% 5.6%
[libx264 @ 0x55ab23549580] kb/s:19508.61
It does not work with nv12 but works with p010. The conversion uses
the CPU 100% but also uses the GPU (not 100%).
ffprobe on the source video:
$ ffprobe New_York.ts
[...]
[mpegts @ 0x55a97d509380] start time for stream 1 is not set in
estimate_timings_from_pts
[mpegts @ 0x55a97d509380] stream 1 : no TS found at start of file,
duration not set
[mpegts @ 0x55a97d509380] Could not find codec parameters for stream 1
(Audio: aac ([15][0][0][0] / 0x000F), 0 channels): unspecified sample
format
Consider increasing the value for the 'analyzeduration' (0) and
'probesize' (5000000) options
Input #0, mpegts, from 'New_York.ts':
Duration: 00:01:12.24, start: 0.999989, bitrate: 52032 kb/s
Program 1
Stream #0:0[0x101]: Video: hevc (Main 10) ([36][0][0][0] / 0x0024),
yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR
16:9], 25 fps, 25 tbr, 90k tbn
Stream #0:1[0x102](und): Audio: aac ([15][0][0][0] / 0x000F), 0 channels
ffprobe on the target video (sdr.mp4):
$ ffprobe sdr.mp4
[...]
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sdr.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.27.100
Duration: 00:01:12.24, start: 0.000000, bitrate: 19511 kb/s
Stream #0:0[0x1](und): Video: h264 (High 10) (avc1 / 0x31637661),
yuv420p10le(tv, bt2020nc/bt2020/bt709, progressive), 3840x2160 [SAR
1:1 DAR 16:9], 19508 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
encoder : Lavc59.37.100 libx264
I haven't tried in CinGG yet.
More information about the Cin
mailing list