How may I burn srt subtitles to video with avconv?
Solution 1
Why subtitles
filter is missing
Libav tends to ignore features from FFmpeg, so avconv
and their counterfeit "ffmpeg
" (removed as of 14.04) do not support libass, and therefore does not support the subtitles
video filter among many other filters.
How to fix
You have several options to get the real ffmpeg
from FFmpeg:
-
Download a
ffmpeg
binary - The easiest option. - Compile - Allows full customization.
- Use mc3man's PPA - For 14.04 users
- Upgrade your Ubuntu - FFmpeg returned in 15.04
Usage
Hardsubs
This will "burn" the subtitles into the video, but of course requires that the video be re-encoded:
ffmpeg -i video.mkv -vf subtitles=subtitle.srt -codec:a copy output.mkv
Filters require re-encoding. See the FFmpeg H.264 Encoding Guide for encoding suggestions.
Since you probably do not want to re-encode the audio this example just stream copies (re-muxes) it.
Softsubs
Consists of a susbtitle stream that is muxed into the file. Any player worth using will allow you to turn the subtitles on and off and choose from other subtitle streams that may be present. Does not require any re-encoding.
ffmpeg -i video.mkv -i subtitle.srt -codec copy -map 0 output.mkv
Solution 2
ffmpeg
is not exactly the same as avconv
. See this about burning subtitles with avconv
.
There is another option, easier and with GUI: Avidemux. Install it with:
sudo apt-get install avidemux
Open a video file, then go to Video
, choose a video encoder (anything else than Copy
), Filters
and Subtitles
. Choose the Subtitler
filter:
Related videos on Youtube
neuront
Updated on September 18, 2022Comments
-
neuront over 1 year
System : Xubuntu 13.04 x64
I've found usage of this functionality in ffmpeg here
ffmpeg -i video.avi -vf subtitles=subtitle.srt out.avi
but it doesn't work. I get an error
No such filter: 'subtitles'
on that. Same thing happens if I replace
ffmpeg
byavconv
.So I tried downloading the
libav
source here and compile. Again I'm frustrated when I run./configure --enable-libass
in the source directory, and this time I got
Unknown option "--enable-libass"
I wonder if this is a very particular thing that
avconv
doesn't support at all. And-
Ciro Santilli OurBigBook.com about 3 years
-
-
neuront almost 10 yearsThanks for introducing that tool to me. But I still need a CLI approach (I need to merge videos on a server).
-
Cornelius almost 10 years@neuront I just found this ubuntuforums.org/showthread.php?t=1155877