So I have a ~400GB .mkv file I wanted to upload to YouTube, unfortunately for me YouTube has a 256GB limit. So I Googled if I could split the file with FFMPEG and found the following article (FFMPEG Splitting MP4 with Same Quality), to sum up I ran the following command (I'm on Windows):
%UserProfile%\Downloads\ffmpeg-5.1.1-full_build\bin\ffmpeg.exe -i largefile.mp4 -t 02:30:23 -c copy smallfile1.mkv -ss 02:30:23 -c copy smallfile2.mkv
Reading the text from the last post it appears both of the time stamps needed to be the same, for part 1 it would be the end time, for part 2 it would be the start time.
This was taking forever, it was doing smallfile1.mkv
first and it was getting maybe 1 GB every 20 minutes or so, all while putting my CPU at 100% usage. My rough math is it would have taken 137 hours for the first file to complete. Ain't nobody got time for that!
So next I found this post (https://stackoverflow.com/questions/18444194/cutting-the-videos-based-on-start-and-end-time-using-ffmpeg) and ended up making 2 commands:
%UserProfile%\Downloads\ffmpeg-5.1.1-full_build\bin\ffmpeg.exe -ss 00:00:00 -to 02:30:23 -i largefile.mp4 -c copy smallfile1.mkv
and
%UserProfile%\Downloads\ffmpeg-5.1.1-full_build\bin\ffmpeg.exe -ss 02:30:20 -to 05:04:31 -i largefile.mp4 -c copy smallfile2.mkv
But this was much faster, it maxed out my HDD usage but not my CPU (I have 2 drives so my computer was usable while this was running), I knew it was working right away because I had 1 GB in only a matter of seconds. It was about 30 minutes of conversion per file and I was ready to start uploading.
What did I do wrong in the first one? Why would it be so inefficient and take dramatically longer? I could have likely stitched these together with 1 command simply by running
%UserProfile%\Downloads\ffmpeg-5.1.1-full_build\bin\ffmpeg.exe -ss 00:00:00 -to 02:30:23 -i largefile.mp4 -c copy smallfile1.mkv && %UserProfile%\Downloads\ffmpeg-5.1.1-full_build\bin\ffmpeg.exe -ss 02:30:20 -to 05:04:31 -i largefile.mp4 -c copy smallfile2.mkv
(notice the space &&
space in-between the 2 commands) but I was alright on keeping an eye on the progress while I worked on other things.
I skipped this in my explanation but while troubleshooting this I tried converting this to a .mp4 (in hopes to keep the same quality) which seemed to work, the file size was pretty similar and looked about the same quality. Here's the link (https://askubuntu.com/questions/50433/how-to-convert-mkv-file-into-mp4-file-losslessly) and the following command:
%UserProfile%\Downloads\ffmpeg-5.1.1-full_build\bin\ffmpeg.exe -i input.mkv -codec copy output.mp4
My final splits I also converted to .mp4 but while I was testing it was about the same speed if not faster to specify my output files as .mkv. Trying the original command with my full file converted to .mp4 and by converting from .mkv to .mp4 also does the same high CPU slow progress.
I have my solution for the future but I'm really curious why the other one didn't work so I can make my life easier in the future.
Edit: Formatting.