Simple command line Python script that splits video into multi chunks. Under the hood script uses FFMpeg so you will need to have that installed. No transcoding or modification of video happens, it just get's split properly.
Run python ffmpeg-split.py -h to see the options. Here are few samples of how it could be used:
This splits big_video_file.mp4 into chunks, and the size of chunk is 10 seconds. Each chunk will be suffixed with numeric index, for example big_video_file-0.mp4, big_video_file-1.mp4, etc.
Spliting video into euqal chunks with some extra options
This splits big_video_file.mp4 into 2 video files, video1.mp4 and video2.mp4. The video1.mp4 is a 34 seconds clip, starting from 0:00 to 0:34 of the big_video_file.mp4.
Alternatively, you can use a manifest.csv file to accomplish the task above.
start_time - number of seconds into the video or start time
length - length of the video in seconds. The end time of the video is calculated by the start_time plus the length of the video.
rename_to - name of the video clip to be saved
end_time - end time of the video
Additional Arguments
-v or --vcodec ffmpeg video codec to be used.
-a or --acodec ffmpeg audio codec to be used.
-m or --manifest manifest file to control the splitting of videos.
-f or --file video file to split.
-s or --split-size seconds to evenly split the videos
-e or --extra extra optional options for ffmpeg, e.g. '-e -threads 8' to use 8 threads to speed up.
Notes:
The -s and -m options should not be used together. If they are, -m option takes precedent over the -s option
Known Issues with ffmpeg
There might be some videos that aren't showing properly after splitting the source video with ffmpeg. To resolve this, use the -v option and pass in the associated video codec for the source video or video format. For example, mp4 videos use h264 video codec. Therefore, running the command python ffmpeg-split.py -f example.mp4 -s -v h264, may resolve this issue.