42 lines
1.2 KiB
Bash
Executable File
42 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Check if all required arguments are provided
|
|
if [ $# -lt 2 ]; then
|
|
echo "Usage: $0 <file_list.txt> <output_file>"
|
|
echo ""
|
|
echo "Arguments:"
|
|
echo " <file_list.txt> Text file containing a list of files to concatenate."
|
|
echo " <output_file> Path to the output video file."
|
|
echo ""
|
|
echo "Example:"
|
|
echo " $0 file_list.txt output.mp4"
|
|
echo ""
|
|
echo "Notes:"
|
|
echo " - The <file_list.txt> must contain file paths in the following format:"
|
|
echo " file 'video1.mp4'"
|
|
echo " file 'video2.mp4'"
|
|
echo " - All files in the list must have the same codec, resolution, and frame rate."
|
|
exit 1
|
|
fi
|
|
|
|
# Assign input arguments to variables
|
|
file_list=$1
|
|
output_file=$2
|
|
|
|
# Check if the file list exists
|
|
if [ ! -f "$file_list" ]; then
|
|
echo "Error: The file list '$file_list' does not exist."
|
|
exit 1
|
|
fi
|
|
|
|
# Run the ffmpeg command
|
|
ffmpeg -f concat -safe 0 -i "$file_list" -c copy "$output_file"
|
|
|
|
# Check if the ffmpeg command succeeded
|
|
if [ $? -eq 0 ]; then
|
|
echo "Concatenation completed successfully. Output saved to '$output_file'."
|
|
else
|
|
echo "Error: ffmpeg failed to concatenate the files."
|
|
exit 1
|
|
fi
|