I'm trying to copy all tags from a mp4 file to another, but haven't found a command line tool (Windows) to do it.
For mp3 and ogg there are options, like id3.exe --duplicate or tools that dump tags to stdout and read them from stdin to tag another file. I haven't found such a tool for mp4 yet, and am struggling to manually catch all possible tags with mediainfo or exiftool.
I know mp4box, or other tools like kid3-cli, tone, ... but didn't see how to do it in one batch, maybe some wizardry with json files or the like.
ffmpeg can do it, I think you'll have to make a copy of your destination file rather than just update the existing file.
Assuming you have "source.mp4" with your tags, "untagged.mp4" is your audio without tags, and "destination.mp4" as the audio from untagged.mp4 + the tags from source.mp4:
ffmpeg -i source.mp4 -i untagged.mp4 -map_metadata 0 -map 1 -c:a copy -movflags faststart destination.mp4
Here's the breakdown of the command:
- give ffmpeg two inputs (`-i source.mp4 -i untagged.mp4`)
- specify you want the metadata from the first input (`-map_metadata 0`)
- specify you want data streams from the second input (`-map 1`)
- you want to copy the audio as-is (`-c:a copy`)
- you want the "faststart" option for movflags (that places the moov atom at the beginning of the file)
- finally the output filename
What it probably won't copy very well is embedded pictures, I always have a hard time getting that handled correctly.
It might not copy each and every tag but I think the only missing tags would be particularly esoteric ones. All your standard stuff like artist, title, album, albumartist, musicbrainz IDs, etc should copy fine.
It looks like exiftool should be able to do this as well:
exiftool -TagsFromFile source.mp4 -overwrite_original -all:all untagged.mp4
This will copy the tags from source.mp4 and write them into untagged.mp4 - updating it in-place.
ffmpeg -i source.mp4 -i untagged.mp4 -map_metadata 0 -map 1 -c:a copy -movflags faststart destination.mp4
What it probably won't copy very well is embedded pictures, I always have a hard time getting that handled correctly.
This may sound strange, but ffmpeg treats cover arts as video streams. So I think you can do it like this:
ffmpeg -i source.mp4 -i untagged.mp4 -map_metadata 0 -map 1 -c:a copy -map 0 -c:v copy -movflags faststart destination.mp4