Created
April 22, 2025 19:11
-
-
Save wommy/bf7e4659970bffa249c0770a7986df96 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assuming you are in the target directory in a Bash terminal | |
# 1. Get directory name and define list file name | |
current_dir_name=$(basename "$(pwd)") | |
list_file="${current_dir_name}_list.txt" | |
# 2. Generate the list of files recursively into the named list file | |
find . -type f -name "*.mp4" | sed "s/^/file '/;s/$/'/" > "$list_file" | |
# 3. Define output video name and run FFmpeg -c copy | |
output_file="${current_dir_name}_combined_mega_video.mp4" | |
ffmpeg -f concat -safe 0 -i "$list_file" -c copy "$output_file" | |
# --- If the above command fails, manually run this one --- | |
# 4. Define re-encoded output video name and run FFmpeg with re-encoding | |
# output_file_reencoded="${current_dir_name}_combined_mega_video_reencoded.mp4" | |
# ffmpeg -f concat -safe 0 -i "$list_file" -c:v libx264 -c:a aac "$output_file_reencoded" | |
# Optional: Clean up the named list file | |
# rm "$list_file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment