Dear Video Help community,

I am trying to burn subtitles into a video using linux command line tools like ffmpeg or mencoder.

Source files are mp4 encoded using h264 video and aac audio, I am aiming to keep the same codecs / quality as the original files. Also, the resulting video needs to play in all video players (like Windows Media Player).


The following line produces a file with burned subtitles, but I am only able to play it using mplayer or VLC.

mencoder -of mpeg -ovc lavc -lavcopts vcodec=mpeg4 -oac mp3lame -lameopts abr:br=128 -subcp utf8 -sub video_orig.srt video_orig.mp4 -o video_proc_mpeg4_mp3.mp4

After some reading I found out mencoder's muxer is broken and this needs to be fixed with another tool like ffmpeg, so I tried with:

ffmpeg -y -i video_proc_mpeg4_mp3.mp4 -vcodec copy -acodec copy video_proc_mpeg4_mp3_ffmpeg.mp4

Which gives me the following error: [mp4 @ 0x1b56e80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 480609 >= 480609


My second attempt was to re-encode the video with ffmpeg using h264 and aac

ffmpeg -i video_proc_mpeg4_mp3.mp4 -vcodec libx264 -vpre ipod320 -crf 22 -acodec aac -strict experimental -ab 128k -y video_proc_h264_aac_ffmpeg.mp4

Which produced a file that plays in all players but the video is now choppy.


I also tryed adding the subtitles while copying the original audio and video codecs

mencoder -of lavf -oac copy -fafmttag 0x706D -ovc copy -subcp utf8 -sub video_orig.srt video_orig.mp4 -o video_proc_x264_aac.mp4

This produced an identical quality file, buy with no burned subtitles


So my question is how could a get a video with similar size / quality / codecs with burned subtitles using mencoder / ffmpeg or any other console tool. Please feel free to ask any additional information you may need.