ffmpeg cut same video to multiple pieces For the project that I'm working on I have to cut some parts of same video with some subtitles. So I made a bash file that executes multiple ffmpeg commands like this.

ffmpeg -i input.mp4 -vf scale="w=640:h=-2",drawtext="fontfile=/usr/share/fonts/truetype/msttcorefonts/verdana.ttf: textfile='1.txt': fontcolor=white: fontsize=20: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=((h-text_h)/2)+90:" -ss 00:00:45.674 -to 00:00:50.093 -async 1 ./out/1.mp4

ffmpeg -i input.mp4 -vf scale="w=640:h=-2",drawtext="fontfile=/usr/share/fonts/truetype/msttcorefonts/verdana.ttf: textfile='2.txt': fontcolor=white: fontsize=20: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=((h-text_h)/2)+90:" -ss 00:00:49.344 -to 00:00:52.971 -async 1 ./out/2.mp4


but it fast for first times (start) of the input file, it gets slower if I want to start seeking from middle or near end of input. So it gets nearly 7-8 minutes for 22. minute of the input file...

ffmpeg -i input.mp4 -vf scale="w=640:h=-2",drawtext="fontfile=/usr/share/fonts/truetype/msttcorefonts/verdana.ttf: textfile='226.txt': fontcolor=white: fontsize=20: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=((h-text_h)/2)+90:" -ss 00:22:23.345 -to 00:22:25.846 -async 1 ./out/226.mp4


Anybody knows better way to do that?
Can I do that without seeking file each time? (Because it seems this is a seeking problem to me....)
Use ss/to as input options. This seeks at the demuxer stage, which is much faster.

ffmpeg -ss 00:22:23.345 -to 00:22:25.846 -i input.mp4 ...


You'll need a very recent build of ffmpeg (> Nov 19 2017)