add/edit custom metadata fields to video files without remuxing?
2
votes
0
answers
1181
views
**TL;DR - Looking for a way to edit/add *CUSTOM* metadata fields to video files without remuxing**.
I have some media files that I add custom metadata fields to ([mostly mkv files downloaded with
yt-dlp
](https://stackoverflow.com/questions/71347719/set-metadata-based-on-the-output-filename-in-yt-dlp/74202367#74202367) but I also have a few mp4 videos and occasionally some m4a/m4b audio files, usually a podcast or something similar).
Every so often, especially if the source info is incorrect, I go back and make modifications and sometimes even add new fields.
I am aware that I can use ffmpeg
to do so, such as with the following example snippet:
$
filePath=sample.mkv;
propName=MY_CUSTOM_FIELD;
propValue='The quick brown fox jumps over the lazy dog';
tempFilePath=temp.mkv
$ mediainfo --Language=raw --Full --Inform="General;%${propName}%" "${filePath}"
$ ffmpeg -i "${filePath}" -movflags use_metadata_tags -loglevel quiet -c copy -metadata "${propName}"="${propValue}" "${tempFilePath}";
$ mv "${tempFilePath}" "${filePath}";
$ mediainfo --Language=raw --Full --Inform="General;%${propName}%" "${filePath}"
The quick brown fox jumps over the lazy dog
This works great *except* for the fact that it remuxes the video. Depending on file size and system load, the remux can end up taking awhile. I have tried to look into other tools like AtomicParsley which appears to only support standardized tags. Likewise, I found a [suggestion to use mp4box](https://www.reddit.com/r/ffmpeg/comments/g4fey8/can_ffmpeg_edit_mp4_metadata_like_the_title/) (on Fedora, the binary is MP4Box
in the gpac
package from RpmFusion), but once again it doesn't appear to work with custom tag -- at least if it does, then for the life of me, I'm still not seeing it after reading through documentation for over half an hour.
Is there any way to do something similar to my ffmpeg
command above *without* going thru a remux and most importantly that will work for *custom* fields?
I'm [assuming](https://superuser.com/a/351720) that I can't just make ffmpeg
do an in-place, no-remux edit of metadata but it'd be awesome if I'm wrong...
Anyway, I am open to pretty much any FOSS tool / project as long as I can get it to run on Fedora (or other Linux) and there's an example of how to do what I asked. For non-FOSS stuff, I would add the additional requirements that it be no- or low-cost and not do anything too obnoxious (e.g. either no telemetry and/or it won't stop working if I use firejail
etc to block it from having network access). I'd prefer native FOSS CLI apps (easier to script) but if there's a GUI or even a freeware Windows app that will work under wine/mono/etc and it does what I'm asking, then by all means, please still mention it.
Asked by zpangwin
(1061 rep)
Dec 5, 2022, 02:42 AM
Last activity: Dec 5, 2022, 02:51 AM
Last activity: Dec 5, 2022, 02:51 AM