FFmpeg learning (4) - Embed subtitles to the video

Use FFMPEG command video embedded subtitles

Some of the film's video and subtitle are separated, if embedded subtitles in the video, then it will be more convenient to watch, no extra subtitle file to load before playing.

In Linux, you can use ffmpeg command to achieve the above functions.

ffmpeg -i infile.mp4 -i infile.srt -c copy -c:s mov_text outfile.mp4

Note, -c copy -c: s mov_text order is very important, because it is short. Or may use the following options -c: v copy -c: a copy -c: s mov_text, in this set of options, the order is not important.

Which, -i option is used to specify the file to be read, here is a video file (subtitle file srt and ass format will be accepted) and subtitle files.

However, for the Matroska video file format (extension mkv), the above command will display an error message: Subtitle codec 94213 is not supported, you should use the following command:

ffmpeg -i infile.mkv -i infile.srt -c copy -c:s srt outfile.mkv

Note: .srt files need to use utf-8 encoding is critical.

Published 295 original articles · won praise 37 · views 30000 +

Guess you like

Origin blog.csdn.net/tianshan2010/article/details/104737417