How do I chop the first 20 seconds off every video in a folder?

I guess there's an ffmpeg command that would do this.

I have a folder full of a bunch of videos that have an unnecessary 20 second plate at the start.

I don't want to re-encode them or change anything else, just chop off that intro.

1

1 Answer

mkdir output
for f in *.mp4; do ffmpeg -i "$f" -ss 20 -map 0 -c copy "output/$f"; done

This will need to cut on a keyframe for non intra-frame formats (most "consumer" videos these days are non-intra), so it may not cut at exactly 20 seconds.

If your inputs are intra (such as DV), or if you know a keyframe is at or near 20 seconds then move -ss before the -i and it will process somewhat faster.

If you must cut exactly at 20 seconds then you'll need to re-encode: remove the -c copy, but again, it's format dependent if you'll need to do that.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like