How can I automatically segment a mp4 video based on a list of frames

1

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)

mxbi

Posted 2015-08-12T09:51:48.523

Reputation: 191

Answers

1

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.

user482718

Posted 2015-08-12T09:51:48.523

Reputation: 9

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 – 2015-08-12T15:56:40.910