Opened 2 years ago
Closed 22 months ago
#10157 closed defect (fixed)
Behavior of map_metadata -1 no longer strips metadata as expected
Reported by: | migan10 | Owned by: | Thilo Borgmann |
---|---|---|---|
Priority: | normal | Component: | ffmpeg |
Version: | git-master | Keywords: | |
Cc: | migan10 | Blocked By: | |
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | yes |
Description
Summary of the bug:
Until recently, using "-map_metadata -1" would strip all metadata from an input file, including global and stream metadata (excepting bitstream metadata). Now, using -map_metadata -1 seems to have no effect or may just affect global metadata. I can't figure out the correct method to strip metadata from individual streams, if there is one.
I have run a bisect and the responsible commit is here, from November 2022:
https://github.com/FFmpeg/FFmpeg/commit/41194806812a31d25e24c535fcb92d7d97b8ce9d
How to reproduce:
Simply try using -map_metadata -1 with any input file that has metadata on any of the streams. May potentially be specific to mkv muxer, as that's all I've tested with. In example below you can see the metadata reappear in the output file details despite setting -map_metadata -1.
% ffmpeg -i in.mkv -map_metadata -1 -map_chapters -1 -c copy -y out.mkv ffmpeg version N-109647-gba36e6ed52 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 12 (Debian 12.2.0-13) configuration: --disable-ffplay --disable-doc --prefix=/opt/ffmpeg/build --pkg-config-flags=--static --extra-cflags='-I/opt/ffmpeg/build/include -I/usr/include/samba-4.0 -march=native' --extra-ldflags=-L/opt/ffmpeg/build/lib --extra-libs='-lpthread -lm' --bindir=/opt/ffmpeg/bin --enable-gpl --enable-version3 --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-libcaca --enable-libaribb24 --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libgme --enable-libgsm --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-librubberband --enable-libsnappy --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libwebp --enable-libxvid --enable-lv2 --enable-opencl --enable-libdrm --enable-cuda-nvcc --enable-openssl --enable-ffnvcodec --enable-nvenc --enable-nvdec --enable-libnpp --enable-libzimg --enable-libzvbi --enable-libxml2 --enable-filter=scale_cuda --enable-libvmaf libavutil 57. 44.100 / 57. 44.100 libavcodec 59. 56.100 / 59. 56.100 libavformat 59. 35.100 / 59. 35.100 libavdevice 59. 8.101 / 59. 8.101 libavfilter 8. 54.100 / 8. 54.100 libswscale 6. 8.112 / 6. 8.112 libswresample 4. 9.100 / 4. 9.100 libpostproc 56. 7.100 / 56. 7.100 Input #0, matroska,webm, from 'in.mkv': Metadata: ENCODER : Lavf59.35.100 Duration: 00:25:26.43, start: 0.000000, bitrate: 2743 kb/s Chapters: Chapter #0:0: start 0.000000, end 739.805733 Metadata: title : Chapter 01 Chapter #0:1: start 739.805733, end 1526.424900 Metadata: title : Chapter 02 Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, progressive), 710x480 [SAR 8:9 DAR 71:54], 59.94 fps, 59.94 tbr, 1k tbn Metadata: ENCODER : Lavc59.56.100 hevc_nvenc DURATION : 00:25:26.425000000 Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default) Metadata: title : Stereo BPS-eng : 192000 DURATION-eng : 00:25:26.400000000 NUMBER_OF_FRAMES-eng: 47700 NUMBER_OF_BYTES-eng: 36633600 SOURCE_ID-eng : 0180BD _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.2 linux(x64-release) _STATISTICS_WRITING_DATE_UTC-eng: 2023-01-27 07:48:22 _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID DURATION : 00:25:26.400000000 Stream #0:2(eng): Subtitle: ass (default) Metadata: BPS-eng : 436 DURATION-eng : 00:24:56.962000000 NUMBER_OF_FRAMES-eng: 835 NUMBER_OF_BYTES-eng: 81624 SOURCE_ID-eng : 0100E0 _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.2 linux(x64-release) _STATISTICS_WRITING_DATE_UTC-eng: 2023-01-27 07:48:22 _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID ENCODER : Lavc59.56.100 ssa DURATION : 00:24:58.596000000 Output #0, matroska, to 'out.mkv': Metadata: encoder : Lavf59.35.100 Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, progressive), 710x480 [SAR 8:9 DAR 71:54], q=2-31, 59.94 fps, 59.94 tbr, 1k tbn Metadata: ENCODER : Lavc59.56.100 hevc_nvenc DURATION : 00:25:26.425000000 Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s (default) Metadata: title : Stereo BPS-eng : 192000 DURATION-eng : 00:25:26.400000000 NUMBER_OF_FRAMES-eng: 47700 NUMBER_OF_BYTES-eng: 36633600 SOURCE_ID-eng : 0180BD _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.2 linux(x64-release) _STATISTICS_WRITING_DATE_UTC-eng: 2023-01-27 07:48:22 _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID DURATION : 00:25:26.400000000 Stream #0:2(eng): Subtitle: ass (default) Metadata: BPS-eng : 436 DURATION-eng : 00:24:56.962000000 NUMBER_OF_FRAMES-eng: 835 NUMBER_OF_BYTES-eng: 81624 SOURCE_ID-eng : 0100E0 _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.2 linux(x64-release) _STATISTICS_WRITING_DATE_UTC-eng: 2023-01-27 07:48:22 _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID ENCODER : Lavc59.56.100 ssa DURATION : 00:24:58.596000000 Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Stream #0:2 -> #0:2 (copy) Press [q] to stop, [?] for help frame=54550 fps=36267 q=-1.0 size= 298240kB time=00:15:10.02 bitrate=2684.7kbits/s speed= 605x
Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.
Change History (5)
comment:1 by , 2 years ago
comment:2 by , 22 months ago
Your commit was one off, actual regression is from
3c7dd5ed37da6d2de06c4850de5a319ca9cdd47f
Fix sent to the mailing list.
Thanks!
comment:3 by , 22 months ago
Analyzed by developer: | set |
---|---|
Owner: | set to |
Reproduced by developer: | set |
Status: | new → open |
comment:4 by , 22 months ago
Component: | undetermined → ffmpeg |
---|
comment:5 by , 22 months ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
It looks like you can approximate the same behavior of -map_metadata -1 with "-map_metadata:s -1 -map_metadata:g -1"
It appears "-map_chapters -1" still works, but is equal to "-map_metadata:c -1"
It could be nice to keep -map_metadata -1 functional as a similar shortcut. I don't know how widely it is used but I've sure used it a lot over the years and in lots of scripts.