If you've analyzed any videos in our v2 API yet or are looking to do so in the future, that's great! To ensure that our infrastructure runs smoothly for this functionality, we have enabled limits on the file size and video lengths that you can predict against, specifically:
- 10MB file size limit for URLs,
- 10MB file size limit for local files, and
- 10 minutes in length (for anything)
If your videos do exceed these limits, don’t worry! We've got you covered in this tutorial so that you can break these into smaller parts. You'll just need to take advantage of an open source tool called GPAC which can quickly split your videos.
Step 1: Installing GPAC
The first step to do here is to install GPAC software using the installers on their website. If you're on a Mac you can install with homebrew, as that would simply require a command of:
brew install gpac
in your Mac's terminal. If you don't have a Mac then you'll be totally fine since GPAC is built for Windows, Linux and Android too.
You can also get the source code from GitHub via:
git clone https://github.com/gpac/gpac.git
Step 2: Breaking The Videos Down
The next step to do is to get these videos below 10-80 MB (for a local file or URL, respectively) and under 10 minutes with GPAC's mp4box command!
By File Size:
To split your video into several 80MB files, you can use the "-splits" flag with the command below:
mp4box -splits 80000 filename.mp4
...with 80,000 equaling the "kilobytes" that you want to set as the limit. This will take your "filename.mp4" video and output it into a bunch of 80MB files in the same directory. If you want to split your videos into 10 MB chunks instead, you would put 10000 as the parameter.
By Video Length:
Likewise, to split your video into 10 minute segments, you can use the "-split" (singular) command:
mp4box -split 600 filename.mp4
...with 600 meaning "seconds" here. Your video will now be split into smaller 10 minute chunks, and if they're all below the required MB limit you can then upload them to the API!
Step 3: Upload your new files to our API!
For more documentation on GPAC and Mp4BOX feel free to visit https://gpac.wp.imt.fr/mp4box/mp4box-documentation/
Happy Video Analyzing!