FFMPEG mkv to mp4 conversion loses subtitles

ffmpegsubtitlesvideo conversion

Currently trying to convert my mkv library to mp4 (Iphone 6 plus)

I've managed to get to mkv to mp4 conversion correctly, but I'm missing the subtitles part (SRT)

Here's my code:

dir/b/s *.mkv >mkvlist.txt   ///////// this gets a list of all the mkv files on the directory

for /F "delims=;" %%F in (mkvlist.txt) do ffmpeg.exe  -i "%%F" -format mp4 -vcodec copy -acodec aac -strict -2 -sn "%%~dF%%~pF%%~nF.mp4"   ///////////// this makes the conversion

del mkvlist.txt     ////// this deletes the txt file

I would like to include subtitles into the scrip, but I´m having trouble inserting the correct name for the subtitles into the script (since this is a multiple conversion batch).

Best Answer

MP4 does not support SRT. You can either use softsubs or hardsubs.

softsubs

Subtitles that consist as a separate stream in the file. They can be toggled on/off by the player, and do not require the video stream to be re-encoded.

ffmpeg -i input.mkv -c copy -c:s mov_text output.mp4

Player support for timed text softsubs in MP4 can be rather poor. You'll just have to try it.

hardsubs

Hardsubs are "burned" into the video so the video must be re-encoded.

ffmpeg -i input.mkv -vf subtitles=input.mkv output.mp4

See the susbtitles filter documentation for more info such as how to select a particular subtitle stream if there is more than one.

Related Question