[FFmpeg-user] Add subtitles to trimmed mp4

Leo Butler leo.butler81 at googlemail.com
Sat Feb 13 04:10:13 EET 2021


adam smith via ffmpeg-user <ffmpeg-user at ffmpeg.org> writes:

> Hi people, I have a subtitle question; yay. 
>
> I have a 2 minute mp4 that I am going to trim using -ss and -to . 
>
> I have a SRT subtitle file with timings that will line up with the trimmed mp4. 
>
> If I try and trim the mp4 and add the subtitles at the same time, the trim is ignored and the whole media file is encoded. 
>
> ffmpeg -y -i
> /data/disposable/localised_20210212-1147-u81zpu/full_mp4.mp4 -ss 10
> -to 40 -i https://somewhere/source/subtitles/subtitles.srt

I think you want to do

ffmpeg -y -ss 10 -t 30 -i input.mp4 -ss 10 -t 30 -i input.srt ...

See

https://ffmpeg.org/ffmpeg-all.html#toc-Main-options

Leo

> -filter_complex "[0:1]fifo[vout];[0:0]afifo[01_afifo]" -map "[vout]"
> -map "[01_afifo]" -map 1 -pix_fmt yuv420p -c:v libx264 -s 1920x1080
> -profile:v high -level:v 4.1 -refs:v 2 -keyint_min 50 -b:v 15000k -r
> 25 -ac 2 -bsf:a aac_adtstoasc -c:a libfdk_aac -ar 48000 -b:a 192k
> -c:s:0 mov_text -metadata:s:s:0 language=eng -flags +global_header -f
> tee
> "[f=mp4:movflags=+faststart]/data/disposable/transcode_20210212-1147-znbqck/edit_2805.mp4"

Do you mean to you `tee' with only one output sink?



More information about the ffmpeg-user mailing list