Using ffmpeg to copy metadata from one file to another
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2 Looping
--
Chapters
00:00 Using Ffmpeg To Copy Metadata From One File To Another
00:20 Accepted Answer Score 43
01:03 Answer 2 Score 3
01:28 Answer 3 Score 0
01:43 Answer 4 Score 0
01:57 Thank you
--
Full question
https://superuser.com/questions/996223/u...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#ffmpeg #metadata
#avk47
ACCEPTED ANSWER
Score 43
Use -map_metadata
.
In this example the global and stream metadata will be copied from in0.mkv
. The video and audio streams will be stream copied from in1.mkv
:
ffmpeg -i in0.mkv -i in1.mkv -map 1 -c copy \
# copies all global metadata from in0.mkv to out.mkv
-map_metadata 0 \
# copies video stream metadata from in0.mkv to out.mkv
-map_metadata:s:v 0:s:v \
# copies audio stream metadata from in0.mkv to out.mkv
-map_metadata:s:a 0:s:a \
out.mkv
This will result in something like:
Output #0, matroska, to 'out.mkv':
Metadata:
title : Global Title
AUTHOR : Global Author
Stream #0:0: Video: h264
Metadata:
title : Stream 0 Title
Stream #0:1: Audio: vorbis
Metadata:
title : Stream 1 Title
By default global metadata is copied from the first input file, so -map_metadata 0
could probably be omitted.
ANSWER 2
Score 3
From the comment in the answer How to make Handbrake preserve capture time / creation time?
A full command line adding the option to copy special tags will be:
ffmpeg -i in.mp4 -i out.mp4 -map 1 -map_metadata 0 -c copy -movflags use_metadata_tags fixed.mp4
ANSWER 3
Score 0
For decoding Flac to AIFF whilst preserving metadata, this answer worked better for me: Covert FLAC to AIFF while saving tags/metadata
ANSWER 4
Score 0
When using ffmpeg at a file which has metadata (like a title) in its streams, you need to use -map_metadata again, as it will not hold those metadata in the new output