I have a 7 hour long h.264 video made up of 1600 shorter videos and I have a csv file with a list of frames at which I need the longer video to be cut at.

Is there any way that I can automatically segment the longer video into lots of smaller videos (so that each video is individually watchable) based on the locations of the frames in the csv, and then name these individual files with names such as video1.mp4, video2.mp4 etc? I've read that this would most likely use FFmpeg but I'm not sure how I would go about writing a script to do this automatically.

I have access to both a Windows and Mac machine. (and can install linux if necessary)


You can cut videos according to frame with handbrake (although it converts video). However it can't cut them automatically taking frame data from a CSV file. You need to select the start frame and end frame manually.

Maybe x264.exe with command line can help.

  • It turns out that you can use Handbrake from a commandline, setting the in and out points (which I can automatically calculate in a script) I will try this and see if it works – mxbi Aug 12 '15 at 15:56

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.