BrettSheleski / comchap

Commercial detection script to add chapters into video file
MIT License
136 stars 26 forks source link

faster seek time when cutting with FFmpeg #44

Open jakeman2048 opened 4 years ago

jakeman2048 commented 4 years ago

Apparently adding the "-ss" before "-i", fast seek is utilized. I'm seeing 2.5x faster cuts overall with this change.

Reference: https://trac.ffmpeg.org/wiki/Seeking#Cuttingsmallsections

jakeman2048 commented 4 years ago

Actually, this might affect the duration since it might seek inaccurately in certain instances.

When used as an input option (before -i), seeks in this input file to position. Note that in most formats it is not possible to seek exactly, so ffmpeg will seek to the closest seek point before position. When transcoding and -accurate_seek is enabled (the default), this extra segment between the seek point and position will be decoded and discarded. When doing stream copy or when -noaccurate_seek is used, it will be preserved.

I guess some testing is necessary. This works perfectly on my MPEG-TS files though.