[FFmpeg-user] How to split webm files quickly?

Ferdi Scholten ferdi at sttc-nlp.nl
Wed Jul 5 09:44:16 EEST 2023

On 05-07-2023 06:35, Peng Yu wrote:
>> Not at all. See
>> http://www.ffmpeg.org/ffmpeg-formats.html#segment_002c-stream_005fsegment_002c-ssegment
> I am confused with the many options shown in the examples. Could you
> show me the command on how to split input.webm into 15-minute
> segments? Thanks.
First of all, splitting video without re encoding is only possible on 
keyframes, those might be at regular intervals, and/or on scene changes, 
and or on random points where the encoder deemed them necessary. They 
can be minutes apart, or make up the entire video.

The only way to make sure that the 15 minute segments are indeed 15 
minutes and without losing any video in between is to re encode the 
video! Depending on the codec, your hardware spec's and other settings, 
this might take a long time.

simplest command to do this:

ffmpeg -i input.webm -force_key_frames 900 -c:a copy -f segment 
-segment_time 900 %d.webm

This will re encode your video with the default settings for the .webm 
container, force a keyframe at every 900 seconds and create a 900 second 
segments. Audio will be copied over. You might/should also want to 
specify encoder settings to ensure video quality and or codec used, webm 
containers can use several video codecs.

More information about the ffmpeg-user mailing list