Have you ever ever ever had a chronic audio document that you just wanted to damage down into smaller, further manageable pieces? If so, you’re in excellent fortune because it’s if truth be told a lovely easy procedure!
In this article, I’m going to show you the way you’ll be able to use a simple bash script on your Mac to split your audio document into numerous smaller information, every spherical 8-10 minutes long, or basically any duration you need. So let’s get started!
To get this to art work, your Mac will need the ones two portions installed, Homebrew and FFmpeg.
How to Arrange Homebrew
Arrange Homebrew for many who haven’t already; you’ll do this via opening a Terminal window and entering the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/arrange/HEAD/arrange.sh)"
How to Arrange FFmpeg
Once Homebrew is installed, run the following command to place in FFmpeg:
brew arrange ffmpeg
Wait for the set as much as end, which it’ll take a while, and FFmpeg it will be ready to use.
Splitting an Audio Record into Smaller Chunks
With every Homebrew and FFmpeg installed, we nowadays are ready to split the massive audio document into smaller pieces.
Open your favorite code editor, paste the following bash script into it, and save it as ‘splitaudio.sh‘.
#!/bin/bash # Define the path to the input MP3 document input_file="document.mp3" # Define the duration of every bite in seconds (480 seconds = 8 minutes) chunk_length=480 # Create an output list to store the chunks mkdir -p output # Use ffmpeg to split the MP3 document into chunks ffmpeg -i "$input_file" -f segment -segment_time "$chunk_length" -c reproduction "output/chunk_percent03d.mp3"
input_file="document.mp3" with the determine of your audio document.
|Filename is ‘meeting.mp3‘||
|Filename is ‘meeting.mp3‘, inside ‘audio‘ folder||
Chunk_length decides how long every output audio document should be, in seconds. If you want to have them to be 10 minutes every, then your
chunk_length should be 600.
The overall line throughout the code determines where every bite of the audio document it will be saved, and its document naming prefix.
ffmpeg -i "$input_file" -f segment -segment_time "$chunk_length" -c reproduction "output/chunk_percent03d.mp3".
In our code, the output filename construction
output/chunk_percent03d.mp3, which is in a position to save every bite throughout the ‘output‘ list with a filename of chunk_001.mp3, chunk_002.mp3, and so on.
Ensure that each one changes in ‘splitaudio.sh‘ is saved, for many who haven’t already. Next, we will need to make it executable.
In Terminal, type throughout the following command and hit Enter.
chmod +x splitaudio.sh
In spite of everything, run the bash script with the following command:
That’s it. You’ll have your audio document reduce up into smaller chunks, and saved right through the output folder.
1. How to uninstall Homebrew?
- Open the Terminal app on your Mac.
- Type the following command and hit Enter:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/arrange/HEAD/uninstall.sh)"
- Practice the turns on to uninstall Homebrew. You’ll be asked to enter your password.
- As quickly because the uninstallation process is complete, you’ll test that Homebrew has been uninstalled via typing the following command throughout the Terminal and hitting Enter:
If Homebrew has been uninstalled successfully, you’ll have to see a “command now not came upon” error message.
2. How to uninstall FFmpeg?
Open the Terminal app on your Mac and type throughout the following command.
brew uninstall ffmpeg
Practice the suggested to complete the uninstallation process.
The submit The right way to Break up Audio Report into Smaller Chunks on Your Mac seemed first on Hongkiat.