Advertisement
fakesamgregory

Bash Script: Split Audio into 10 Second Chunks with FFMPEG

Mar 29th, 2024 (edited)
921
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.38 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Define the path to the input MP3 file
  4. input_file="file.mp3"
  5.  
  6. # Define the length of each chunk in seconds (480 seconds = 8 minutes)
  7. chunk_length=480
  8.  
  9. # Create an output directory to store the chunks
  10. mkdir -p output
  11.  
  12. # Use ffmpeg to split the MP3 file into chunks
  13. ffmpeg -i "$input_file" -f segment -segment_time "$chunk_length" -c copy "output/chunk_%03d.mp3"
  14.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement