add newest shit

This commit is contained in:
2024-10-20 14:47:54 -07:00
parent b152278480
commit 4a8a0753cc
3 changed files with 130 additions and 159 deletions

View File

@@ -0,0 +1,41 @@
#!/bin/bash
# Check if the correct number of arguments is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 <top-level-directory>"
exit 1
fi
# Get the top-level directory from the argument
TOP_DIR="$1"
# Define a temporary file to store the list of files
FILE_LIST="file_list.txt"
# Remove the temporary file if it exists
rm -f "$FILE_LIST"
# Find all segment directories and sort them numerically
dirs=$(find "$TOP_DIR" -maxdepth 1 -type d -name 'segment_*' | sort -V)
# Loop over the directories
for dir in $dirs; do
segment_name=$(basename "$dir")
segment_num=$(echo "$segment_name" | sed 's/segment_//')
output_file="$dir/output_$segment_num.mp4"
if [ -f "$output_file" ]; then
echo "file '$output_file'" >> "$FILE_LIST"
else
echo "No output_$segment_num.mp4 found in $dir"
fi
done
# Run ffmpeg to concatenate the videos
ffmpeg -f concat -safe 0 -i "$FILE_LIST" -c copy output_combined.mp4
# Remove the temporary file
rm "$FILE_LIST"