[FFmpeg-user] subtitles again please

Stefano Sabatini stefano.sabatini-lala at poste.it
Thu Aug 25 13:55:32 CEST 2011


On date Thursday 2011-08-25 09:26:53 +0800, Rick C. encoded:
> 
> On Aug 25, 2011, at 2:00 AM, Stefano Sabatini wrote:
> 
> > On date Wednesday 2011-08-24 10:34:11 +0800, Rick C. encoded:
> >> Hi again,
> >> 
> >> I have asked in the past about hard-coding subtitles, but if I just
> >> want to add a subtitle track as a stream would someone mind giving
> >> me a working example?  I'm aware of the documentation which says
> >> this:
> >> 
> >> ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt
> >> 
> >> And in FFmpeg -formats it says it supports decoding/encoding of .srt
> >> files.  So how would I take a file without a subtitle stream and add
> >> a new one?  Something like:
> >> 
> >> ffmpeg -i mov.avi -i sub.srt output.avi
> >> 
> >> Sorry to ask again but I'm assuming since it's there in the
> >> documentation it works but I really can't figure it out.  Thanks!
> > 
> > Not very experienced about subtitles and all, AFAIK subtitles support
> > in FFmpeg is still a bit... rudimentary.
> > 
> > But if you want subtitles in output you need a format which supports
> > them, I know matroska (.mkv) should do.
> > 
> > As for hardcoding subtitles right onto the video, I'm afraid we still
> > miss that facility (subtitles filtering + video overlaying seems the
> > right solution), correct if I'm wrong.
> 
> 
> Thanks for the reply.  So what would be a working command line if the output was to .mkv for example?

$ ffmpeg -i INPUT -i SUBTITLE_FILE -y OUTPUT

then you should see something like this:
  Stream #0.0 -> #0.0: mpeg4 -> libx264
  Stream #0.1 -> #0.1: mp3 -> libvorbis
  Stream #1.0 -> #0.2: srt -> ass

You can set the subtitle output format to srt by using -scodec srt, or
forcing the copy with -scodec copy.
-- 
ffmpeg-user random tip #5
FFmpeg documentation:
http://www.ffmpeg.org/documentation.html


More information about the ffmpeg-user mailing list