how to add a text stream (subtitle) into a .mp4 or .m4v
I use ffmpeg to convert video us开发者_Go百科ing H264 for video encoding, and FAAC for audio encoding. The output should be .mp4 or m4v in order to play on both Android and iPhone. I want to add a subtitle STREAM to video file using ffmpeg, but the ffmpeg's documentation doesnt help much.
Can anyone help me with this?
Is it possible for you to use mencoder instead of ffmpeg? If yes, I would suggest the following:
mencoder input.avi -sub subtitles.sub -ovc lavc -oac copy -o output.mp4
For ffmpeg you can also try out the following command, although I have no way to guarantee it is actually working:
ffmpeg -i inputfile.avi -i subtitlefile.srt outputfile.avi -newsubtitle
I have this command works under windows7:
ffmpeg -i input.mkv -filter_complex [0:v][0:s]overlay[v] -map [v] -map 0:a -acodec libvo_aacenc -ac 2 -ar 48000 -ab 320k output.mp4
You can refer to http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20burn%20subtitles%20into%20the%20video#picturebasedsubtitles for official descriptions.
精彩评论