[FFmpeg-user] map_metadata to overwrite metadata?
Leo Butler
leo.butler81 at googlemail.com
Fri Feb 4 14:03:11 EET 2022
Synopsis: I have a video (.webm) with existing chapter metadata. I want
to overwrite that with data from a metadata file. I don't understand why
map_metadata can write, but does not overwrite, chapter metadata.
Try:
Create a video with a couple chapters (see below):
ffmpeg -y -f lavfi -i 'color=c=red:s=1280x720' -i meta.txt -map_metadata 1 -t 20 test.webm
Overwrite(?) the metadata:
ffmpeg -y -i test.webm -i meta-2.txt -map_metadata 1 test-2.webm
That does not work, but this does:
ffmpeg -y -i test.webm -i meta-2.txt -map_metadata 1 -map_chapters 1 test-3.webm
Question: why does the first insert the chapter information, but the
second does not overwrite the chapter information, and why is
'-map_chapters' needed?
Output:
$ ffmpeg -y -f lavfi -i 'color=c=red:s=1280x720' -i meta.txt -map_metadata 1 -t 20 test.webm
ffmpeg version 4.4.1-3 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Debian 11.2.0-14)
configuration: --prefix=/usr --extra-version=3 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, lavfi, from 'color=c=red:s=1280x720':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #1, ffmetadata, from 'meta.txt':
Metadata:
title : Title
artist : Dr Leo Butler
email : leo.butler at example.com
date : 04 February 2022
Duration: 00:00:20.00, start: 0.000000, bitrate: 0 kb/s
Chapters:
Chapter #1:0: start 0.000000, end 0.750000
Metadata:
title : introduction
Chapter #1:1: start 0.750000, end 20.000000
Metadata:
title : conclusion
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x561af4c67180] v1.11.0
[libvpx-vp9 @ 0x561af4c67180] Neither bitrate nor constrained quality specified, using default CRF of 32
Output #0, webm, to 'test.webm':
Metadata:
title : Title
artist : Dr Leo Butler
email : leo.butler at example.com
date : 04 February 2022
encoder : Lavf58.76.100
Chapters:
Chapter #0:0: start 0.000000, end 0.750000
Metadata:
title : introduction
Chapter #0:1: start 0.750000, end 20.000000
Metadata:
title : conclusion
Stream #0:0: Video: vp9, yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 1k tbn
Metadata:
encoder : Lavc58.134.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 500 fps=106 q=0.0 Lsize= 25kB time=00:00:19.96 bitrate= 10.2kbits/s speed=4.25x
video:21kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 17.996834%
$ ffmpeg -y -i test.webm -i meta-2.txt -map_metadata 1 test-2.webm
ffmpeg version 4.4.1-3 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Debian 11.2.0-14)
configuration: --prefix=/usr --extra-version=3 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, matroska,webm, from 'test.webm':
Metadata:
title : Title
DATE : 04 February 2022
ARTIST : Dr Leo Butler
EMAIL : leo.butler at example.com
ENCODER : Lavf58.76.100
Duration: 00:00:20.00, start: 0.000000, bitrate: 10 kb/s
Chapters:
Chapter #0:0: start 0.000000, end 0.750000
Metadata:
title : introduction
Chapter #0:1: start 0.750000, end 20.000000
Metadata:
title : conclusion
Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv, progressive), 1280x720, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
Metadata:
ENCODER : Lavc58.134.100 libvpx-vp9
DURATION : 00:00:20.000000000
Input #1, ffmetadata, from 'meta-2.txt':
Metadata:
title : Title
artist : Dr Leo Butler
email : leo.butler at example.com
date : 04 February 2022
Duration: 00:00:20.00, start: 0.000000, bitrate: 0 kb/s
Chapters:
Chapter #1:0: start 0.000000, end 1.750000
Metadata:
title : introduction
Chapter #1:1: start 1.750000, end 20.000000
Metadata:
title : conclusion
Stream mapping:
Stream #0:0 -> #0:0 (vp9 (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x55825e987bc0] v1.11.0
[libvpx-vp9 @ 0x55825e987bc0] Neither bitrate nor constrained quality specified, using default CRF of 32
Output #0, webm, to 'test-2.webm':
Metadata:
title : Title
artist : Dr Leo Butler
email : leo.butler at example.com
date : 04 February 2022
encoder : Lavf58.76.100
Chapters:
Chapter #0:0: start 0.000000, end 0.750000
Metadata:
title : introduction
Chapter #0:1: start 0.750000, end 20.000000
Metadata:
title : conclusion
Stream #0:0: Video: vp9, yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 1k tbn (default)
Metadata:
DURATION : 00:00:20.000000000
encoder : Lavc58.134.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 500 fps= 89 q=0.0 Lsize= 25kB time=00:00:19.96 bitrate= 10.2kbits/s speed=3.53x
video:21kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 18.029428%
$ ffmpeg -y -i test.webm -i meta-2.txt -map_metadata 1 -map_chapters 1 test-3.webm
ffmpeg version 4.4.1-3 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Debian 11.2.0-14)
configuration: --prefix=/usr --extra-version=3 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, matroska,webm, from 'test.webm':
Metadata:
title : Title
DATE : 04 February 2022
ARTIST : Dr Leo Butler
EMAIL : leo.butler at example.com
ENCODER : Lavf58.76.100
Duration: 00:00:20.00, start: 0.000000, bitrate: 10 kb/s
Chapters:
Chapter #0:0: start 0.000000, end 0.750000
Metadata:
title : introduction
Chapter #0:1: start 0.750000, end 20.000000
Metadata:
title : conclusion
Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv, progressive), 1280x720, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
Metadata:
ENCODER : Lavc58.134.100 libvpx-vp9
DURATION : 00:00:20.000000000
Input #1, ffmetadata, from 'meta-2.txt':
Metadata:
title : Title
artist : Dr Leo Butler
email : leo.butler at example.com
date : 04 February 2022
Duration: 00:00:20.00, start: 0.000000, bitrate: 0 kb/s
Chapters:
Chapter #1:0: start 0.000000, end 1.750000
Metadata:
title : introduction
Chapter #1:1: start 1.750000, end 20.000000
Metadata:
title : conclusion
Stream mapping:
Stream #0:0 -> #0:0 (vp9 (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x5618e3072c00] v1.11.0
[libvpx-vp9 @ 0x5618e3072c00] Neither bitrate nor constrained quality specified, using default CRF of 32
Output #0, webm, to 'test-3.webm':
Metadata:
title : Title
artist : Dr Leo Butler
email : leo.butler at example.com
date : 04 February 2022
encoder : Lavf58.76.100
Chapters:
Chapter #0:0: start 0.000000, end 1.750000
Metadata:
title : introduction
Chapter #0:1: start 1.750000, end 20.000000
Metadata:
title : conclusion
Stream #0:0: Video: vp9, yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 1k tbn (default)
Metadata:
DURATION : 00:00:20.000000000
encoder : Lavc58.134.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 500 fps= 96 q=0.0 Lsize= 25kB time=00:00:19.96 bitrate= 10.2kbits/s speed=3.82x
video:21kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 18.029428%
$ cat meta.txt
;FFMETADATA1
title=Title
artist=Dr Leo Butler
email=leo.butler at example.com
date=04 February 2022
[CHAPTER]
TIMEBASE=1/1000
START=0
END=750.0
title=introduction
[CHAPTER]
TIMEBASE=1/1000
START=750.0
END=20000.0
title=conclusion
$ cat meta-2.txt
;FFMETADATA1
title=Title
artist=Dr Leo Butler
email=leo.butler at example.com
date=04 February 2022
[CHAPTER]
TIMEBASE=1/1000
START=0
END=1750.0
title=introduction
[CHAPTER]
TIMEBASE=1/1000
START=1750.0
END=20000.o
title=conclusion
TIA,
Leo
More information about the ffmpeg-user
mailing list