#!/bin/bash # File containing the list of file paths log_file="file_paths_log.txt" output_file="output.mp3" file_list="filelist.txt" # Create a new filelist echo "" > $file_list # Read the file paths from the log file and prepare the filelist for ffmpeg concat demuxer while IFS= read -r filePath; do echo "file '$filePath'" >> $file_list done < "$log_file" # Construct the ffmpeg command to concatenate the files with a 0.5s delay ffmpeg_command="ffmpeg -f concat -safe 0 -i $file_list -filter_complex \"adelay=500|500\" -c:a libmp3lame -q:a 2 \"$output_file\"" # Execute the ffmpeg command echo "Running command: $ffmpeg_command" eval $ffmpeg_command