[FFmpeg-devel] subtitles filter and -ss

Gyan Doshi ffmpeg at gyani.pro
Sun May 3 18:33:58 EEST 2020



On 03-05-2020 08:36 pm, Manolis Stamatogiannakis wrote:
> Hello,
>
> I've noticed what appears to be a bug/missing feature in the subtitles
> filter: when "-ss" is used for the input, it is not applied to the
> subtitles stream. E.g., for the following command line, the video playback
> will start on 20:10, but the subtitles will start from 00:00.
>
> ffmpeg -re -ss 20:10.00 -i input.mp4
>          -vf subtitles=subs.srt \
>          -c:v libx264 crf 25 -c:a aac -ab 160k \
>          -strict experimental \
>          -f flv $RTMP_URL
>
> This should be fairly straightforward to fix and review, so I'd like to
> directly submit a patch rather than opening a bug and having someone else
> fix it. As I'm not an expert with the ffmpeg internals, I'd like some
> guidance on implementing a proper fix.
>
> What would be considered more appropriate:
> (a) automatically skipping the subtitles for the time specified by -ss?
> (b) adding a shift option to the subtitles filter that allows shifting
> subtitles time by specific time?
> (c) something else I can't think of?

-ss executes a seek for that input. The subtitles filter does not have 
access to that data. You can add an option to the subtitles filter that 
also carries out a seek. And make sure to adjust timestamps depending on 
the seek match.

Gyan


More information about the ffmpeg-devel mailing list