[FFmpeg-user] ffmpeg: encoding sub-titles

Newton-san newton-san at rambler.ru
Thu Sep 1 19:31:34 CEST 2011


On Thu, 1 Sep 2011 18:40:40 +0530
Pekon Gupta <pekon.gupta at gmail.com> wrote:

> Hi,
> 
> Apologies for revisiting this question.. As i have googled a lot on this
> topic, and still could not find suitable answer..
> 
> (1) Is there a way to hard-code the ".srt" (text based subtitles) into the
> output video while encoding it ?
>      If yes, then please illustrate it with command-line example..
> 
> (2) how is "-newsubtitle" switch is used ?
> 
> Im using following command-line..
> "ffmpeg -i in.avi  -acodec libmp3lame  -vcodec libxvid -bf 0   out.avi   "
> 
> Please tell me how to include ".srt" subtitles to this, so that stream could
> be added in output video..
> 
> thanks..
> 
> with regards, pekon
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

You may use mplayer output & named pipe.
Example:
-==========================================
mkfifo temp.yuv
FNAME=in # input video-file, without extension

# run mplayer in background
mplayer -noass -fontconfig -font "DejaVu Sans" -subfont-autoscale 1 -subfont-text-scale 4.2 -subcp UTF-8 -subfont-outline 4 -subpos 100 -sub $FNAME.ass $FNAME.avi -vo yuv4mpeg:file=temp.yuv -noframedrop -ao null -really-quiet </dev/null &

ffmpeg -f yuv4mpegpipe -i mayo.yuv -i $FNAME.avi -vcodec libxvid -bf 0 -acodec libmp3lame -f avi -y out.avi -map 0.0 -map 1.1

-===========================================
-sub $FNAME.ass - textbased subs, for current example:  in.ass
-subcp  subs codepage
-- 
Newton-san <newton-san at rambler.ru>


More information about the ffmpeg-user mailing list