The built-in Photos app can be used to cut a portion of a video file. Sometimes, you may need to split a video or audio into multiple parts with a specific duration. It helps you share them on Twitter or any other social networking site which has a length limitation. For instance, Twitter allows you to upload videos of length not exceeding 140 seconds (2m 20s.)
To split a video into multiple equal parts, you may have to repeat the procedure multiple times if you’re using the Photos app. Instead, you may use a third-party tool to split a video (MP4, MKV, AVI, or MPG) or audio (MP3, WAV, etc.) into multiple equal parts automatically.
In this article, let’s see how to cut a selection of a video or audio and save the selection to a separate file. This article also describes how to split a video or audio into multiple equal parts.
Table of Contents
LosslessCut is a cross-platform utility (which uses FFmpeg in the backend) for extremely fast and lossless operations on video, audio, subtitle, and other related media files. The main feature of this tool is lossless trimming and cutting of video and audio files. It lets you quickly extract the good parts from your videos and discard many gigabytes of data without doing a slow re-encode and thereby losing quality.
- Download lossless-cut from GitHub and run it.
- Open an audio or video file using this utility.
- Select the time frame or segments that you want to export. You can create multiple segments as you want.
For example, to split the audio or video into equal parts of a specified length (duration), click on the Edit menu → click Segments → Create fixed duration segments. Then, input the length of each segment. In case you want to upload the segments on Twitter, then input
00:02:15.000as Twitter has a limitation of
- The segments are selected automatically. All you need to do is choose the working directory (to export the files to) and click on the Export button.
- Review the settings in the next dialog — i.e., the Export options dialog.
- Once done, click on the Export button. That’s it! The segments are now ready.
FFmpeg is a free and open-source project consisting of a software suite of libraries and programs for handling video, audio, and other multimedia files and streams. You can do pretty much any media conversion/encoding task using this console tool. There are many third-party programs such as Screen to Gif, File Converter, etc. that are bundled with FFmpeg.exe. We’ve seen how to use FFmpeg.exe to extract audio from video files.
Let’s see how to use FFmpeg.exe to split audio or video files.
This is the command line you use to extract a portion of the video (first 30 seconds) file without re-encoding it and save the selection to a file.
ffmpeg.exe -ss 00:00:00 -to 00:00:30 -i "D:\media\sample.mp4" -c copy "d:\media\sample_cut.mp4"
The above command extracts the first 30 seconds of the video and saves it to a separate file named
-ssdenotes the start time
-todenotes the end time; FFmpeg stops outputting at the specified position.
-iis the input file.
-cspecifies the codec used. In this case, no encoding is done as we used
Tip: Instead of
-to, you can also use
-t which denotes the duration, instead of ending point. For instance, specifying
-s 00:00:10 -t 50 selects from 10 seconds to 60 seconds of the audio/video.
Video frames missing? Try the encoding method
During playback, if the video file (produced using the last command) is missing video frames at the beginning or at the end, then you may use the re-encoding method. Encoding is a slow process, though. Run this command:
ffmpeg.exe -ss 00:00:00 -to: 00:00:30 -i "D:\media\sample.mp4" -c:v libx264 -c:a copy "d:\media\sample_cut.mp4"
It encodes the video (using the
libx264 encoder) but uses the same audio stream (denoted by the
copy argument.) and extracts the first 30 seconds of the video and saves it to a separate file named
You now know how to cut a portion of the audio/video file and save the selection to a file. What if you want to split a video into multiple parts with a specific duration or length? You can use the following command line for each segment you want to cut:
ffmpeg.exe -ss 00:00:00 -to 00:00:30 -i "D:\media\sample.mp4" -c: copy "d:\media\sample_part_1.mp4" ffmpeg.exe -ss 00:00:30 -to 00:01:00 -i "D:\media\sample.mp4" -c: copy "d:\media\sample_part_2.mp4" ffmpeg.exe -ss 00:01:00 -to 00:01:30 -i "D:\media\sample.mp4" -c: copy "d:\media\sample_part_3.mp4" ffmpeg.exe -ss 00:02:00 -to 00:02:30 -i "D:\media\sample.mp4" -c: copy "d:\media\sample_part_4.mp4"
That’s going to be difficult if you need to split multiple files, right? There is an easy alternative!
Let’s use the
-segment command-line argument of FFmpeg.exe. This command-line argument splits a video file into multiple parts with each one containing a specified length/duration (e.g., 60 seconds each):
ffmpeg.exe -i "D:\media\sample.mp4" -f segment -segment_time 60 -c copy -reset_timestamps 1 "d:\media\sample_%03d.mp4"
The output file names will be named sample_001.mp4, sample_002.mp4, sample_003.mp4, and so forth.
However, when using the
copy method when splitting videos, splitting may not be accurate. You can see that each part/file is not exactly 60 seconds in length. Some are 57 seconds, and some are above 60 seconds in length.
Re-encode method (for more accurate cuts)
If you want to cut videos precisely (each part with a fixed duration), you need to re-encode the video while splitting. Here is the command-line argument you use:
ffmpeg -i "D:\Media\sample.mp4" -c:v libx264 -segment_time 60 -g 9 -sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*9)" -f segment -reset_timestamps 1 "D:\Media\sample_%03d.mp4"
Here you go! All the parts are of equal length (only 1-second variation maximum), except, of course, the last clip.
To cut a portion of an audio MP3 file to a separate file, run this command:
ffmpeg.exe -ss 00:00:00 -to 00:00:10 -i "D:\media\sample.mp3" -c: copy "d:\media\sample_cut.mp3"
The above command extracts the 1st ten seconds of audio from an MP3 file and saves it to a separate file.
This command-line argument splits an MP3 file into multiple parts with each one containing a specified length/duration (e.g., 60 seconds each):
ffmpeg.exe -i "D:\media\sample.mp3" -f segment -segment_time 60 -c copy "d:\media\sample_%03d.mp3"
The output file names will be named sample_001.mp3, sample_002.mp3, sample_003.mp3, and so forth. You can see that the length of each file is equal.
That’s it! See also How To Merge Videos In Windows 10 Using the Built-In Photos App.