[FFmpeg-user] Add subtitles to trimmed mp4

adam smith adamsmith79 at icloud.com
Sat Feb 13 12:46:57 EET 2021



> On 13 Feb 2021, at 02:10, Leo Butler via ffmpeg-user <ffmpeg-user at ffmpeg.org> wrote:
> 
> 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 <https://ffmpeg.org/ffmpeg-all.html#toc-Main-options>
> 
> Leo

Thanks Leo. 
I gave it a try but the same thing happened regarding the subtitle position and the in point of the media appeared less accurate and had black at the start.
I believe this is because -ss prior to the file path does a quick seek to the closest key frame to the desired timing, whereas -ss after the file path decodes all the data to find the actual specified timing.


> 
>> -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?

My command is put together by a script I created and its configured to be able to write to multiple outputs, so tee is needed, in this test though I am only supplying a single output path and I didn’t write the script well enough to adapt the command. It doesn’t appear to do any harm, although you are right its a bit shit.


If you have any other ideas, keep them coming :)

Thanks
Adam



More information about the ffmpeg-user mailing list