Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to use subtitles from an external file while converting a video with FFmpeg? The file extension of the subtitles is .stl or .vob.

share|improve this question

migrated from stackoverflow.com Nov 27 '09 at 16:37

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer 1

Yes.

ffmpeg -i input1.mp4 -i input2.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast output.mkv

This will take subtitles in from the srt, and every stream from the MP4. It should work with most subtitle formats. This particular command line will copy all audio and subtitle streams, while converting the video to x264 at reasonable quality settings.

ffmpeg can also automatically choose a matching subtitle format for the output, e.g. it will convert the .srt subtitles to ASS for the following command:

ffmpeg -i input1.mp4 -i input2.srt -map 0 -map 1 -c:a copy -c:v libx264 -crf 23 -preset veryfast output.mkv

As of version 1.2, it will decode the following subtitle formats:

  • HDMV Presentation Graphic Stream subtitles
  • JACOsub subtitle
  • MicroDVD subtitle
  • MPL2 subtitle
  • PJS (Phoenix Japanimation Society) subtitle
  • RealText subtitle
  • SAMI subtitle
  • SubViewer subtitle
  • SubViewer v1 subtitle
  • raw UTF-8 text
  • VPlayer subtitle
  • WebVTT subtitle
  • DVB subtitles
  • DVD subtitles
  • MOV text
  • SubRip subtitle with embedded timing
  • SSA (SubStation Alpha) / ASS (Advanced SSA) subtitle
  • SubRip subtitle
  • XSUB
share|improve this answer
    
I got mixed results with the auto-conversion, but trying to copy subtitles with MKV (which supports virtually anything) should work fine. –  slhck Apr 19 '13 at 9:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.