Change metadata settings in mp4 files
Similarly to how I needed to change audio settings in mkv files, I noticed I had some .mp4 files with the wrong metadata
Rename an audio or video track
I had one file where the audio was labeled as English, but was in fact Spanish.
Similarly to to the mkv file, everything worked correctly; it is the fact that the video player (correctly) showed the language as "English", confusing the end user.
With ffmpeg, it is possible to change the associated metadata:
ffmpeg -hide_banner -i input.mp4 -c copy -metadata:s:a:0 language=spa output.mp4 Like for MKV file, valid language codes are the ISO 639-2 codes.
A video track normally is not associated with a language, thus it is fine to leave or set them as undefined (und).
Print properties of file
ffprobe can be used to print information about the mp4 file.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : master
date : 20260107
encoder : Lavf62.3.100
Duration: 00:49:01.65, start: 0.000000, bitrate: 4621 kb/s
Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 4490 kb/s, 25 fps, 25 tbr, 90k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0] The same file, after changing the language of the audio track:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : master
date : 20260107
encoder : Lavf62.3.100
Duration: 00:49:01.65, start: 0.000000, bitrate: 4621 kb/s
Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 4490 kb/s, 25 fps, 25 tbr, 90k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:1[0x2](spa): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0] Change metadata
An MP4 file also has a title in the file metadata. In this case, the title was "master", rather unhelpful.
To change it, use the following command
ffmpeg -hide_banner -i input.mp4 -c copy -metadata title="new title" output.mp4 To remove it, leave the new title unset:
ffmpeg -hide_banner -i input.mp4 -c copy -metadata title= output.mp4 Banner
In all examples, I’ve used -hide_banner to avoid ffmpeg and ffprobe from filling the screen with useless information, unless you want to report a bug.
While the ffmpeg authors have their reason for adding this banner, the fact that there is no global option to disable it irks me.
Also, the fact that ffprobe always prints the data to stderr is not user-friendly. If you want to pipe it somewhere, for example, in a pager like less, or grep the output, you have to remember to redirect stderr to stdout first.
You could drop a couple of wrapper scripts, but that should not be necessary for a sane user experience:
#!/bin/sh
set -o errexit
set -o nounset
exec /usr/bin/ffprobe -hide_banner "$@" 2>&1; #!/bin/sh
set -o errexit
set -o nounset
exec /usr/bin/ffmpeg -hide_banner "$@";
If you have questions, comments, or found typos, the notes are not clear, or there are some errors; then just contact me.