I am using Handbrake to convert various movies to MP4 format, so they can be played by iPhone/Ipad… but by default Handbrake does not include the subtitles inside the output files.
I am looking for a batch solution that would allow me to do this (so I can do 20-30 files at once, not only one by one).
Best Answer
You might use
mkvextract
to extract subtitles:brew install mkvtoolnix;for f in *.mkv;do set $(mkvmerge -i "$f"|awk -F'[ :/)]' '/^Track ID [0-9]+: subtitles/{print $3,tolower($7);exit}');[[ $1 ]]&&mkvextract tracks "$f" "$1:${f%mkv}$2";done
Then use the external subtitles with the mp4 files.
The mp4 container doesn't support srt or ass subtitles, but it does support ttxt (MPEG-4 Part 17) and VobSub (sub and idx files). I couldn't get
ffmpeg -i input.mkv -c copy -scodec mov_text output.mp4
to work though, or at least the subtitles weren't displayed by VLC or QuickTime Player.