added split audio
This commit is contained in:
27
split_audio.sh
Executable file
27
split_audio.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Split long audio files into smaller segments for easier transcription
|
||||||
|
# Usage: ./split_audio.sh <input_file> [segment_length_minutes]
|
||||||
|
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
echo "Usage: $0 <input_file> [segment_length_minutes]"
|
||||||
|
echo "Example: $0 my_long_audio.wav 10"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
input_file="$1"
|
||||||
|
segment_length="${2:-10}" # Default 10 minutes
|
||||||
|
|
||||||
|
if [ ! -f "$input_file" ]; then
|
||||||
|
echo "Error: File '$input_file' not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
basename="${input_file%.*}"
|
||||||
|
extension="${input_file##*.}"
|
||||||
|
|
||||||
|
echo "Splitting '$input_file' into ${segment_length}-minute segments..."
|
||||||
|
|
||||||
|
ffmpeg -i "$input_file" -f segment -segment_time $((segment_length * 60)) -c copy -reset_timestamps 1 "${basename}_part_%03d.${extension}"
|
||||||
|
|
||||||
|
echo "Done! Created segments:"
|
||||||
|
ls -la "${basename}_part_"*."${extension}" 2>/dev/null
|
||||||
Reference in New Issue
Block a user