← Back to Blog

๐ŸŽฌ How to Separate MP4 Files Using FFmpeg

๐ŸŽฌ How to Separate MP4 Files Using FFmpeg Ever worked on a long video that you needed to split into smaller parts? Today, I'm sharing how I used FFmpeg to break down my video into 4-minute segments.

๐ŸŽฌ How to Separate MP4 Files Using FFmpeg

Ever worked on a long video that you needed to split into smaller parts? Today, I'm sharing how I used FFmpeg to break down my video into 4-minute segments. I'll walk you through the command line steps to achieve this, along with some troubleshooting tips if things don't go smoothly.

๐Ÿ’ก What I Wanted to Achieve:

I needed to separate a long video file into 4-minute chunks to make it easier to handle. Here's how I approached it:

๐Ÿ› ๏ธ Step-by-Step Guide:

  • Open Terminal on your Mac.

  • Navigate to the folder where your MP4 file is stored.

cd ~/Downloads

  • Run the following FFmpeg command to split your video:

ffmpeg -i v23-0ct6.mp4 -c copy -map 0:v -map 0:a -f segment -segment_time 00:04:00 -reset_timestamps 1 -segment_format_options movflags=+faststart output%03d.mp4

  • -i v23-0ct6.mp4: This is your input video file.

  • -c copy: This ensures that the video and audio streams are copied without re-encoding (faster processing).

  • -map 0:v -map 0:a: Maps the video and audio streams to output files.

  • -f segment: Instructs FFmpeg to split the video into segments.

  • -segment_time 00:04:00: This sets the length of each segment to 4 minutes.

  • -reset_timestamps 1: Ensures each segment starts at timestamp 0.

  • output%03d.mp4: This names the output files output001.mp4, output002.mp4, and so on.

๐Ÿš€ Troubleshooting:

If you get an error like:

Error opening input: No such file or directory

Make sure the input file name is correct and in the same directory you're running the command from.

My initial mistake:
I was trying to run the command with a .mp4 file extension that didn't exist! Once I changed the file extension to .mov, it worked perfectly:

ffmpeg -i v23-0ct6.mov -c copy -map 0:v -map 0:a -f segment -segment_time 00:04:00 -reset_timestamps 1 -segment_format_options movflags=+faststart output%03d.mp4

๐Ÿšจ Pro Tip: Always check the file extension of your input video before running the command. Sometimes, it's a small detail that can trip you up!


๐ŸŒŸ Wrapping Up:

Using FFmpeg is a powerful way to split your video files. With just a few lines of code, you can easily break down a long video into smaller chunks, making it easier to upload, share, or work with.


๐Ÿ”— Connect with me:

๐Ÿš€ Let's keep learning and creating together!


Imported from rifaterdemsahin.com ยท 2025