One list, one run

Cut a pack of clips from one long video

Updated Commands run November 21, 2026Test pattern with a burned clockffmpeg 6.1.1, bash

Scissors over a video timeline, with three upright phone screens and one square frame below.

Short answer

Write the clips down once, as a list of name, start and end, and let one loop cut them all. Three rows gave us three vertical 1080 x 1920 files in 39 seconds, and a second pass gave the same three as squares. There is one trap worth knowing before you start: without the -nostdin option, ffmpeg swallows the rest of your list and only the first clip is made. With it, every row runs.

Trim a video (one clip, in the browser)

Key takeaways

  • The cut list is a plain text file: name,start,end on each line, times as hours:minutes:seconds.
  • One loop made three 9:16 clips of 15, 25 and 10 seconds from a 120 second source in 39 seconds on our server.
  • Leave out -nostdin and only the first clip is written. We reproduced it: one file instead of three.
  • An end time past the end of the video is not an error; the clip simply stops where the video does.
  • Change one filter in the loop to get square files for a feed post from the same list.

Write the cut list

Watch the video once, or read its transcript, and write a line for each clip. Three values separated by commas: a short name with no commas in it, where the clip starts, where it ends. Save it as cuts.csv next to the video.

hook,00:00:05,00:00:20
main-point,00:00:40,00:01:05
ending,00:01:50,00:02:30
Our test list: three clips from a two-minute file. The last row deliberately runs past the end.

The list is the real product here. It is readable, you can fix a time without touching anything else, and next month you can re-export every clip in a new shape from the same file.

Run the loop

One loop, shown under the table. It reads one line, splits it at the commas, cuts that span, crops the middle to 9:16 and saves a file named after the first column. Then the next line.

What the three rows produced
RowAsked forClip lengthSize
hook0:05 to 0:2015 s6.2 MB
main-point0:40 to 1:0525 s10.4 MB
ending1:50 to 2:3010 s4.2 MB
while IFS=, read -r name start end; do ffmpeg -nostdin -ss "$start" -to "$end" -i long.mp4 -vf "crop=ih*9/16:ih,scale=1080:1920" -c:v libx264 -crf 20 -c:a aac "$name.mp4"; done < cuts.csv
Reads cuts.csv a line at a time and writes one vertical clip per line. Exit 0; three files in 39 seconds.

Source: our run. The third clip is 10 seconds, not 40, because the video ends at 2:00. ffmpeg cut what existed and reported success. The sizes are large for their length because a moving test pattern is hard to compress; real footage at this setting is usually smaller.

Why does -nostdin matter?

This is the trap. The loop feeds the cut list in through standard input, and ffmpeg also listens on standard input, for keyboard commands. Left alone, the first ffmpeg run eats the remaining lines of your list as if you had typed them. The loop then finds nothing left to read and stops.

We ran the same loop without the option. One file came out, hook.mp4, and no error was shown. With -nostdin, all three. If a batch ever produces only its first clip, this is the first thing to check.

What else can go wrong with the list?

Edge cases we ran
In the listWhat happened
A name with a space ("two words")Worked: the file is "two words.mp4", because the name is quoted in the command
An end time after the end of the videoWorked: the clip stops where the video stops
An empty last lineThat pass failed with an error and wrote no file; the earlier rows were fine
No -nostdinOnly the first row was cut

Two more to avoid, which we did not need to test to know: a comma inside a name splits the line in the wrong place, and a list saved by a spreadsheet may have quotes around every value. Keep it plain text.

The same clips in another shape

Swap the filter and the output name. This version takes a square from the middle of the frame, for feed posts:

while IFS=, read -r name start end; do ffmpeg -nostdin -ss "$start" -to "$end" -i long.mp4 -vf "crop=ih:ih,scale=1080:1080" -c:v libx264 -crf 20 -c:a aac "$name-square.mp4"; done < cuts.csv
Square 1080 x 1080 clips from the same list, saved with -square in the name. Exit 0.

For a wide version, drop the -vf part entirely. Three passes over one list give you a folder with every clip in three shapes, named so they sort together.

Does the center crop suit every clip?

No. The loop crops the middle of the frame for every row. That fits a presenter filmed head-on and fails when the subject is off to one side. For those clips, add a fourth column with the crop position and use it in the filter, or cut them wide here and reframe them one by one. The talking-head guide has the arithmetic for the position.

Free tools:Crop a fixed box out of a videoTrim a video

Limits of this test

The loop was run in bash on Linux; macOS behaves the same, and on Windows it needs Git Bash or WSL. The source is a two-minute test pattern, so timing on an hour of camera footage will differ. Cuts are re-encoded, which makes the start exact and costs time. Nothing here picks the moments; the list is yours to write.

Do it in your browser

Free Koldflux tools, no account needed.

Trim a video (one clip, in the browser)Crop a fixed box out of a video

Questions people ask

How do I cut many clips from one video at once?

Put name, start and end for each clip in a text file and loop ffmpeg over it. The one-line loop is on this page.

Why does my ffmpeg loop only process the first line?

ffmpeg read the rest of the list from standard input. Add -nostdin right after the word ffmpeg.

What time format does the cut list use?

Hours, minutes and seconds, such as 00:01:50. Plain seconds, such as 110, also work with -ss and -to.

Can I make vertical and square versions from the same list?

Yes. Run the loop again with a different crop filter and a different output name.

Does this work on Windows?

The loop is bash. On Windows run it in Git Bash or WSL, or rewrite the loop for PowerShell.

Related

More guides on this topic

Sources and how we checked

  1. commands.log: both loops with exit codes, clip lengths and four edge cases (our run, November 21, 2026) (checked 2026-11-21)
  2. make-tests.sh: builds the test video and the cut list and runs the loops (Koldflux, shell) (checked 2026-11-21)
  3. FFmpeg documentation: -nostdin, -ss, -to (checked 2026-11-21)

On November 21, 2026 we made a 120 second test video with a burned clock and a three-row cut list, ran the loop with ffmpeg 6.1.1 in bash for vertical and square output, and repeated it without -nostdin, with a spaced name, with an empty line and with an end past the file.