How to burn subtitles into the video

You can burn text subtitles with one of two filters: subtitles or ass.

subtitles  filter

As of Nov 29, 2012 you can also simply use the subtitles filter:

ffmpeg -i video.avi -vf subtitles=subtitle.srt out.avi

This filter requires ffmpeg to be compiled with --enable-libass (if you are building FFmpeg yourself, look for the libass-dev package on Debian-like distributions).

ass filter

Using FFmpeg's ass video filter (see Wikipedia for  Advanced SubStation Alpha), we can draw text of the subtitles into the movie, like this:

ffmpeg -i video.avi -vf "ass=subtitle.ass" out.avi

As with the subtitles filter, this filter requires ffmpeg to be compiled with --enable-libass.

If your subtitle is in SubRipMicroDVD or any other supported text subtitles, you have to convert it to ASS before using the filter:

ffmpeg -i subtitle.srt subtitle.ass

For Windows users  this link may be useful, as you have to setup font paths just right to get libass to work

picture based subtitles

You can burn "picture based" subtitles into a movie as well (for instance, dvdsub is a type of picture based overlay subtitles), by using the overlay filter to overlay the images. Here is an example - an MKV with dvdsub subtitles in a separate stream:

ffmpeg -i input.mkv -filter_complex "[0:v][0:s]overlay[v]" -map [v] -map 0:a <output options> output.mkv

If you have multiple subtitle streams, you can select which one to use by replacing [0:s] with [0:s:0] to select the first subtitle stream or [0:s:1] to select the second subtitle stream, and so on. See also the official documentation; search for "hardcode".

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值