Have you ever ever had a protracted audio record that you simply sought after to wreck down into smaller, extra manageable items? If this is the case, you’re in good fortune as it’s in fact a sexy simple process!

On this article, I’m going to turn you how you can use a easy bash script to your Mac to separate your audio record into a number of smaller recordsdata, each and every round 8-10 mins lengthy, or mainly any period you wish to have. So let’s get began!

split large audio file

Prerequisite

To get this to paintings, your Mac will want those two parts put in, Homebrew and FFmpeg.

The right way to Set up Homebrew

Set up Homebrew for those who haven’t already; you’ll do that through opening a Terminal window and getting into the next command:

/bin/bash -c "$(curl -fsSL https://uncooked.githubusercontent.com/Homebrew/set up/HEAD/set up.sh)"
The right way to Set up FFmpeg

As soon as Homebrew is put in, run the next command to put in FFmpeg:

brew set up ffmpeg

Watch for the set up to finish, which it is going to take a little time, and FFmpeg will probably be able to make use of.

Splitting an Audio Report into Smaller Chunks

With each Homebrew and FFmpeg put in, we at the moment are able to separate the huge audio record into smaller items.

Step 1.

Open your favourite code editor, paste the next bash script into it, and reserve it as ‘splitaudio.sh‘.

#!/bin/bash

# Outline the trail to the enter MP3 record
input_file="record.mp3"

# Outline the period of each and every chew in seconds (480 seconds = 8 mins)
chunk_length=480

# Create an output listing to retailer the chunks
mkdir -p output

# Use ffmpeg to separate the MP3 record into chunks
ffmpeg -i "$input_file" -f phase -segment_time "$chunk_length" -c replica "output/chunk_percent03d.mp3"
Step 2.

Exchange record.mp3 in input_file="record.mp3" with the identify of your audio record.

Examples:

Filename is ‘assembly.mp3
input_file="assembly.mp4"
Filename is ‘assembly.mp3‘, inside of ‘audio‘ folder
input_file="audio/assembly.mp4"

Chunk_length makes a decision how lengthy each and every output audio record will have to be, in seconds. If you wish to have them to be 10 mins each and every, then your chunk_length will have to be 600.

The general line within the code determines the place each and every chew of the audio record will probably be stored, and its record naming prefix.


ffmpeg -i "$input_file" -f phase -segment_time "$chunk_length" -c replica "output/chunk_percent03d.mp3".

In our code, the output filename development output/chunk_percent03d.mp3, which is able to save each and every chew within the ‘output‘ listing with a filename of chunk_001.mp3, chunk_002.mp3, and so forth.

Step 3.

Be certain that all adjustments in ‘splitaudio.sh‘ is stored, for those who haven’t already. Subsequent, we can want to make it executable.

In Terminal, sort within the following command and hit Input.

chmod +x splitaudio.sh
Step 4.

In any case, run the bash script with the next command:

/splitaudio.sh

That’s it. You will have your audio record cut up into smaller chunks, and stored throughout the output folder.

final result

FAQ:

1. The right way to uninstall Homebrew?
  1. Open the Terminal app to your Mac.
  2. Sort the next command and hit Input:
    /bin/bash -c "$(curl -fsSL https://uncooked.githubusercontent.com/Homebrew/set up/HEAD/uninstall.sh)"
  3. Observe the activates to uninstall Homebrew. You can be requested to go into your password.
  4. As soon as the uninstallation procedure is whole, you’ll check that Homebrew has been uninstalled through typing the next command within the Terminal and hitting Input:
    brew --version

If Homebrew has been uninstalled effectively, you will have to see a “command no longer discovered” error message.

2. The right way to uninstall FFmpeg?

Open the Terminal app to your Mac and sort within the following command.

brew uninstall ffmpeg

Observe the instructed to finish the uninstallation procedure.

The put up The right way to Break up Audio Report into Smaller Chunks on Your Mac gave the impression first on Hongkiat.

WordPress Website Development Source: https://www.hongkiat.com/blog/split-large-audio-mac/

[ continue ]