Just how can I make use of ffmpeg to divide MPEG video clip right into 10 min portions?
There is usually a demand outdoors resource or energetic programmer area to release huge video clip sectors online. (Meet-up video clips, campouts, computerese ...) Being that I am a programmer and also not a videographer I have no need to hand over the added scrape on a costs Vimeo account. Just how after that do I take a 12.5 GB (1:20:00) MPEG computerese video clip and also cut it right into 00:10:00 sectors for very easy posting to video clip sharing websites?
Note the specific spelling of the different layout is
-ss mm:ss.xxx. I battled for hrs attempting to make use of the instinctive - yet - incorrect
$ man ffmpeg | grep -C1 position
- ss placement
Seek to offered time placement in secs. "hh :mm :ss [. xxx ] " syntax is additionally sustained.
$ ffmpeg -i source-file.foo -ss 0 -t 600 first-10-min.m4v $ ffmpeg -i source-file.foo -ss 600 -t 600 second-10-min.m4v $ ffmpeg -i source-file.foo -ss 1200 -t 600 third-10-min.m4v ...
Covering this up right into a manuscript to do it in a loop would not be tough.
Be cautious that if you attempt to compute the variety of models based upon the period result from an
ffprobe call that this is approximated from the ordinary little bit price at the beginning of the clip and also the clip's documents dimension unless you offer the
-count_frames argument, which reduces its procedure substantially.
An additional point to be knowledgeable about is that the placement of the
-ss alternative on the command line matters. Where I have it currently is slow-moving yet exact. The first variation of this solution offered the fast but inaccurate choice. The connected write-up additionally defines a mostly-fast-but-still-accurate choice, which you spend for with a little intricacy.
All that apart, I do not assume you actually intend to be reducing at specifically 10 mins for each and every clip. That will certainly place cuts right in the center of sentences, also words. I assume you need to be making use of a video clip editor or gamer to locate all-natural cut factors simply shy of 10 mins apart.
Thinking your documents remains in a layout that YouTube can approve straight, you do not need to reencode to get sectors. Simply pass the all-natural cut factor offsets to
ffmpeg, informing it to pass the inscribed A/V via unblemished by utilizing the "duplicate" codec :
$ ffmpeg -i source.m4v -ss 0 -t 593.3 -c copy part1.m4v $ ffmpeg -i source.m4v -ss 593.3 -t 551.64 -c copy part2.m4v $ ffmpeg -i source.m4v -ss 1144.94 -t 581.25 -c copy part3.m4v ...
-c copy argument informs it to replicate all input streams (sound, video clip, and also possibly others, such as captions ) right into the result as-is. For straightforward A/V programs, it amounts the extra verbose flags
-c:v copy -c:a copy or the old-style flags
-vcodec copy -acodec copy. You would certainly make use of the extra verbose design when you intend to replicate just one of the streams, yet re-encode the various other. As an example, years ago there was an usual exercise with QuickTime documents to compress the video clip with H. 264 video clip yet leave the sound as uncompressed PCM; if you stumbled upon such a documents today, you can improve it with
-c:v copy -c:a aac to recycle simply the audio stream, leaving the video clip unblemished.
The start factor for every single command over after the first is the previous command's start factor plus the previous command's period.