[FFmpeg-user] Help: How to add subtitles to a video created from images?

Gyan ffmpeg at gyani.pro
Fri Feb 15 07:49:08 EET 2019



On 15-02-2019 10:49 AM, Srinidhi S wrote:
> I am trying to use ffmpeg to create a video from images and add subtitles to the video.
> The following is the command that I am using
> ffmpeg -f concat -i input.txt -i 02-38-2019-112729.m4a -vf "scale=1280:720,subtitles=subtitles.srt" -pix_fmt yuv420p output.mp4
>
> where input.txt is a text file in the following format
> file 'IMG_0001.JPG'
> duration 2
> file 'IMG_0002.JPG'
> duration 50
> file 'IMG_0002.JPG'
>
> and subtitles.srt is a subtitle file. I find that while the video is generated, the subtitles are not present.
>
> Can anyone point out what I am doing wrong?
Already pointed out in your Q at video stack exch

Frames must exist within the time intervals of the subtitles. You can 
use the fps filter to generate a CFR stream before applying subtitles.

But to keep VFR, you'll need to create duplicate entries in your 
textfile, with suitable duration values.

Gyan




More information about the ffmpeg-user mailing list