[FFmpeg-trac] #11305(avfilter:new): filter_complex/trim destroys HDR metadata
FFmpeg
trac at avcodec.org
Sun Nov 17 13:44:12 EET 2024
#11305: filter_complex/trim destroys HDR metadata
-------------------------------------+-------------------------------------
Reporter: zealot0630 | Owner: (none)
Type: defect | Status: new
Priority: important | Component: avfilter
Version: 7.0 | Resolution:
Keywords: | Blocked By:
filter_complex hdr |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Description changed by zealot0630:
Old description:
> Summary of the bug:
> How to reproduce:
> {{{
> ffmpeg.exe -y -hide_banner \
> -i "2024-11-17 16-01-22.mkv" -filter_complex \
> [0:0]trim=start=00\\:00\\:00\\.000:end=00\\:00\\:03\\.000[ov0];\
> [0:1]atrim=start=00\\:00\\:00\\.000:end=00\\:00\\:03\\.000[oa0] \
> -map [ov0] -map [oa0] -map_metadata 0 \
> -c:v:0 hevc_nvenc -c:a:0 aac \
> -f mp4 "output.mp4"
> }}}
>
> ffmpeg outputs:
>
> {{{
> Input #0, matroska,webm, from '2024-11-17 16-01-22.mkv':
> Metadata:
> ENCODER : Lavf61.1.100
> Duration: 00:24:43.47, start: 0.000000, bitrate: 70103 kb/s
> Stream #0:0: Video: hevc (Main 10), yuv420p10le(pc,
> bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr,
> 1k tbn
> Metadata:
> DURATION : 00:24:43.467000000
> Side data:
> Content Light Level Metadata, MaxCLL=1000, MaxFALL=1000
> Mastering Display Metadata, has_primaries:1 has_luminance:1
> r(0.6800,0.3200) g(0.2650,0.6900) b(0.1500 0.0600) wp(0.3127, 0.3290)
> min_luminance=0.000000, max_luminance=1000.000000
> Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
> Metadata:
> title : Track1
> DURATION : 00:24:43.413000000
> Stream mapping:
> Stream #0:0 (hevc) -> trim:default
> Stream #0:1 (aac) -> atrim:default
> trim:default -> Stream #0:0 (hevc_nvenc)
> atrim:default -> Stream #0:1 (aac)
> Press [q] to stop, [?] for help
> Output #0, mp4, to 'output.mp4':
> Metadata:
> encoder : Lavf61.1.100
> Stream #0:0: Video: hevc (Main 10) (hev1 / 0x31766568), p010le(pc,
> bt2020nc/bt2020/smpte2084, progressive), 3840x2160 [SAR 1:1 DAR 16:9],
> q=2-31, 2000 kb/s, 60 fps, 15360 tbn
> Metadata:
> encoder : Lavc61.3.100 hevc_nvenc
> Side data:
> cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000
> vbv_delay: N/A
> Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
> fltp, 128 kb/s
> Metadata:
> encoder : Lavc61.3.100 aac
> [out#0/mp4 @ 000002b8050fe6c0] video:149KiB audio:49KiB subtitle:0KiB
> other streams:0KiB global headers:0KiB muxing overhead: 3.133152%
> frame= 180 fps= 72 q=41.0 Lsize= 203KiB time=00:00:02.95 bitrate=
> 565.1kbits/s speed=1.18x
> [aac @ 000002b805396a00] Qavg: 1094.995
> }}}
>
> Content Light Level Metadata and Mastering Display Metadata are lost
> after encoding.
New description:
Summary of the bug:
How to reproduce:
{{{
ffmpeg -y -hide_banner \
-i "2024-11-17 16-01-22.mkv" -filter_complex \
'[0:0]trim=start=00\\:00\\:00\\.000:end=00\\:00\\:03\\.000[ov0];
[0:1]atrim=start=00\\:00\\:00\\.000:end=00\\:00\\:03\\.000[oa0]' \
-map "[ov0]" -map "[oa0]" -map_metadata 0 \
-c:v:0 hevc_nvenc -c:a:0 aac \
-f mp4 "output.mp4"
}}}
ffmpeg outputs:
{{{
Input #0, matroska,webm, from '2024-11-17 16-01-22.mkv':
Metadata:
ENCODER : Lavf61.1.100
Duration: 00:24:43.47, start: 0.000000, bitrate: 70103 kb/s
Stream #0:0: Video: hevc (Main 10), yuv420p10le(pc,
bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr,
1k tbn
Metadata:
DURATION : 00:24:43.467000000
Side data:
Content Light Level Metadata, MaxCLL=1000, MaxFALL=1000
Mastering Display Metadata, has_primaries:1 has_luminance:1
r(0.6800,0.3200) g(0.2650,0.6900) b(0.1500 0.0600) wp(0.3127, 0.3290)
min_luminance=0.000000, max_luminance=1000.000000
Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
Metadata:
title : Track1
DURATION : 00:24:43.413000000
Stream mapping:
Stream #0:0 (hevc) -> trim:default
Stream #0:1 (aac) -> atrim:default
trim:default -> Stream #0:0 (hevc_nvenc)
atrim:default -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf61.1.100
Stream #0:0: Video: hevc (Main 10) (hev1 / 0x31766568), p010le(pc,
bt2020nc/bt2020/smpte2084, progressive), 3840x2160 [SAR 1:1 DAR 16:9],
q=2-31, 2000 kb/s, 60 fps, 15360 tbn
Metadata:
encoder : Lavc61.3.100 hevc_nvenc
Side data:
cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000
vbv_delay: N/A
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 128 kb/s
Metadata:
encoder : Lavc61.3.100 aac
[out#0/mp4 @ 000002b8050fe6c0] video:149KiB audio:49KiB subtitle:0KiB
other streams:0KiB global headers:0KiB muxing overhead: 3.133152%
frame= 180 fps= 72 q=41.0 Lsize= 203KiB time=00:00:02.95 bitrate=
565.1kbits/s speed=1.18x
[aac @ 000002b805396a00] Qavg: 1094.995
}}}
Content Light Level Metadata and Mastering Display Metadata are lost after
encoding.
--
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11305#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list