[FFmpeg-user] Can't get ffpmeg to add subtitles to mp4 files

Richard DJE richard.dje at gmail.com
Sat Jan 4 16:34:42 EET 2020


Hi Moritz,

On Sat, Jan 4, 2020 at 3:16 PM Moritz Barsnick <barsnick at gmx.net> wrote:

> On Sat, Jan 04, 2020 at 09:43:16 +0000, Ashish Jha wrote:
> > Try below mentioned command:
> >
> > ffmpeg -i input.mp4 -filter:v subtitles=subtitle.srt output.mp4
> >
> > it's working for me.
>
> If you read Richard's mail, you will notice that that is exactly what
> he tried. It fails for him though, because his input doesn't have any
> video stream, so there's nothing the "subtitles" filter can overlay
> onto.
>
> Richard needs to add an artificial video as a base for the subtitles.
> This works just fine (without the intermediate my.mp4):
>
> $ ffmpeg -i my.mp3 -f lavfi -i color=color=black,subtitles=my.srt
> -shortest my.mp4
>
> (The subtitles filter is directly chained with the artificial input
> source. It could just as well be given via "-vf" == "-filter:v", but
> doesn't need to be in this case.)
>

Thank you for your reply.

The root cause of my issue was effectively spotted by a previous reply
from *Nicolas
George *to which I couldn't reply as I didn't receive that reply but I
could read it directly on the Forum's archive.
The problem with his post is that he didn't provide any guidance.

After more search I managed to find the proper command to generate blank
videos of a specific duration.
I first played with *nullsrc* and then *color*.

But your reply *Moritz* is precise and confirm my finding but does things
in a more concise way!

In my case, I did the blank video and subtitle steps separately as I am not
too familiar with FFmpeg.

Again thank you for your reply *Moritz* and also to *Ashish Jha* and *Ted
Park* ! :)


BR,
-Richard


More information about the ffmpeg-user mailing list