[FFmpeg-user] subtitles again please

Rick C. rickcorteza at gmail.com
Fri Aug 26 13:33:50 CEST 2011


On Aug 25, 2011, at 7:55 PM, Stefano Sabatini <stefano.sabatini-lala at poste.it> wrote:

> 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.

Ok so I was able to get this to work thank you for that!  It was successful going to .mkv but not to .avi or .mp4 (container doesn't support .srt it says).  I guess that's what you meant when you said it was limited?  Well hopefully we will see more from this in the future because it would be great! :-)  This is also nicer than hard-coding the subs...



More information about the ffmpeg-user mailing list