E.g. for the first audio track (a:0
). This example also resets the title of the audio track.
ffmpeg -i Godzilla.vs..Megalon.1973.1080p.mp4 \
-c copy \
\
-metadata:s:a:0 language=jpn \
-metadata:s:a:0 title="" \
\
OUTPUT.mp4
- The
:s
here is for per-stream metadata - Language code is in ISO 639-2, so "the three letter language codes".
- Best to get the language code using
ffprobe
, becauseffmpeg
would just ignore a wrong code
ffmpeg -i Example_Video.mkv -metadata title= -c copy out.mkv
To remove all subtitle tracks:
ffmpeg -i "in.mkv" -c copy -sn "out.mkv"
It's all Greek to me. Use something like this:
#!/bin/bash
# Remove the czech stuff...
#
# this reads from in/ and writes to out/. best to investigate using ffprobe, to
# get the metadata values exactly right.
set -e # stop on error
mkdir -p out/
for in_ in "in/"*.mkv; do
out="out/${in_#in/}" # remove in/ prefix + add out/
out_tmp="$(mktemp "out/tmp-XXXXX-${in_#in/}")"
# for the ffmpeg options, see comments at the end.
ffmpeg \
-i "$in_" \
\
-map 0 \
\
-map -0:a:m:language:ces \
-map -0:a:m:language:hun \
\
-map -0:s:m:language:ces \
-map -0:s:m:language:hun \
-map -0:s:m:language:ukr \
\
-c copy \
\
-metadata title="" \
-metadata DESCRIPTION="" \
\
-metadata:s:a:m:language:deu title="" \
-metadata:s:a:m:language:eng title="" \
-metadata:s:a:m:language:fra title="French (original)" \
\
-metadata:s:s:m:title:'němčina' title='' \
-metadata:s:s:m:title:'angličtina' title='' \
-metadata:s:s:m:title:'angličtina [CC]' title='English [CC]' \
-metadata:s:s:m:title:'francouzština [CC]' title='French [CC]' \
\
-y \
"$out_tmp"
mv "$out_tmp" "$out"
done
# -map 0
# selects all streams (wouldn't pick up all streams otherwise)
#
# -map -0:a:m:language:ces
# deselects audio track ("a") in czech language. for subtitles, it's "s"
#
# -metadata ...
# sets/resets metadata for the whole file or specific streams