How can I trim a very large video file?
I made a screen recording, but then accidentally left it recording overnight for an extra 6 hours. In total I think it’s around 9 hours - and the file has hit 15GB.
Luckily it managed to save to the desktop, but I’m struggling to open it to trim it down.
Finder QuickLook just becomes unresponsive and has to be force quit. QuickTime simply doesn’t open it (or at least hasn’t - but I’m pretty sure it’s not trying because it’s barely using any system resources).
I have iMovie installed but I’ve no idea how it will cope with a 15GB file - will it even be imported in a sensible amount of time?
I’m thinking the best way it to split the file into ~30 smaller files. I could then reassemble the desired ones.
Equally I’m fairly confident of where the useful content ends - around the 2:30 mark. I could calculate it more accurately if needed.
Could I do either of these things with a tool which doesn’t load the entire video into memory? I’ve used ffmpeg on Ubuntu before but I do not know if it can do something like this.
Solution 1:
ffmpeg
Use ffmpeg
to trim the video. It will take a while but should get the job done:
See Alexander Refsum Jensenius's Trim video file using FFMPEG example below for extracting 1h 10s 27 to 2h 18s 51:
ffmpeg -i input.mp4 -ss 01:10:27 -to 02:18:51 -c:v copy -c:a copy output.mp4
See also How to trim a large video with ffmpeg? where the question involves a 75GB movie file. In this case the command extracts 7 seconds from a specific starting time:
ffmpeg -ss 01:21:24 -i input.mp4 -t 7 -c copy output.mp4
Movie Splitter
You could also try my Movie Splitter but I expect if QuickTime is struggling, so will the shared AVFoundation code Movie Splitter uses. Still, give it a try as it does work with multi-gigabyte MP4/h.264 files.