I'm told it's possible to embed subtitles (.srt) into video files (.avi) using ffmpeg, but I can't find any mention of it in the man page. Is this possible? What command do I use?
-
A solution that worked for me with ffmpeg: ffmpeg.org/trac/ffmpeg/wiki/…user31388– user313882013-01-29 16:08:33 +00:00Commented Jan 29, 2013 at 16:08
3 Answers
From Pier's link, specifically:
ffmpeg -i video.avi -vf subtitles=subtitle.srt out.avi
This creates a hard-sub ("burns" the subtitles into the video images) so you can't hide the subtitles and the change is irreversible!
I've used this successfully with the current static git ffmpeg release.
-
Doesn't work. "Output file #0 does not contain any stream"Rubi Shnol– Rubi Shnol2018-04-08 09:53:51 +00:00Commented Apr 8, 2018 at 9:53
-
This filter requires ffmpeg to be compiled with --enable-libass, according documentation.Nakamoto– Nakamoto2021-03-26 02:33:50 +00:00Commented Mar 26, 2021 at 2:33
-
Thx, resulting subtitles was smaller than i am used to, i would increase 50%. Someone mention:
subtitles=subtitle.srt:force_style='Fontsize=20'ffmpeg.org/ffmpeg-all.html16851556– 168515562022-01-14 16:24:06 +00:00Commented Jan 14, 2022 at 16:24
From man ffmpeg:
Subtitle options:
-scodec codec Force subtitle codec ('copy' to copy stream).
-newsubtitle Add a new subtitle stream to the current output stream.
-slang code Set the ISO 639 language code (3 letters) of the current subtitle stream.
So:
ffmpeg -newsubtitle subtitles.srv -i video.avi ...
-
If I use instead of
...result.avithis command does not workAt least one output file must be specifiedxralf– xralf2011-10-27 11:01:31 +00:00Commented Oct 27, 2011 at 11:01 -
3Of course,
...means "and whatever other options you need".Shawn J. Goff– Shawn J. Goff2011-10-27 11:09:03 +00:00Commented Oct 27, 2011 at 11:09 -
Sufficient is
ffmpeg -newsubtitle subtitles.srt -i video.avi result.avibut this ends with the message above. I hoped that result.avi is output file. I tried it with-o result.avitoo but without success.xralf– xralf2011-10-27 11:22:47 +00:00Commented Oct 27, 2011 at 11:22 -
1I don't know why this didn't work for me (maybe wrong file or problem with ffmpeg). I tried this command instead
mencoder movie.avi -sub movie.srt -o movie.hardsubs.avi -oac copy -ovc lavc -lavcopts vbitrate=1200xralf– xralf2011-11-08 10:07:22 +00:00Commented Nov 8, 2011 at 10:07 -
@ShawnJ.Goff: This did not work for me either. What version of ffmpeg are you using, and what OS?Faheem Mitha– Faheem Mitha2012-04-07 20:52:51 +00:00Commented Apr 7, 2012 at 20:52
ffmpeg developers are working with subtitle support, but as far as I know it's only working in the latest ffmpeg. mencoder will burn subtitles instantly, if you want to try that instead.