How can I trim a very large video?
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.
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:
I think ffmpeg would do it. This has the advantage of not decompressing and recompressing your file, so it should be quick. Use the -c copy
argument to achieve this.
ffmpeg -i input.mp4 -ss 00:02:30 -t 00:10:00 -c copy output.mp4
To explain the above command...
-
ffmpeg
is the application -
-i input.mp4
is your input file -
-ss 00:02:30
starting point (HH:MM:SS) -
-t 00:10:00
duration of clip (ten minutes long) -
-c copy
copy audio and video without re-encoding -
output.mp4
output file
See this link for more.
Additionally, a comment in the GitHub page (mentioned in the link above) suggests placing -ss 00:02:30
before -i input.mp4
to speed up things. You can test both routes using time
. Compare
time ffmpeg -i input.mp4 -ss 00:02:30 -t 00:10:00 -c copy output.mp4
and
time ffmpeg -ss 00:02:30 -i input.mp4 -t 00:10:00 -c copy output.mp4
Solution 2:
You can try lossless-cut.
www.github.com/mifi/lossless-cut