Last active
November 24, 2023 04:04
-
-
Save TruncatedDinoSour/1c460468e6ad2a09644e7297802d2200 to your computer and use it in GitHub Desktop.
generate an ffmpeg command to mix all ur songs in a playlist
This file contains 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
#!/usr/bin/env bash | |
set -xeu | |
gen() { | |
printf 'ffmpeg' | |
for p in "$1"/*; do | |
printf ' -i %q' "$p" | |
done | |
echo " -c:a aac -b:a 320k -filter_complex amix=inputs=$(ls "$1" | wc -l):duration=first:dropout_transition=2:duration=longest out.aac" | |
} | |
main() { | |
rm -rf build | |
mkdir build | |
cd build | |
eval "$(gen ../playlist)" | |
ffmpeg -i out.aac -i ../cover.jpg -crf 24 -c:v copy -c:a aac -b:a 320k a.mp4 | |
ffmpeg -i a.mp4 -crf 24 -c:v copy -c:a aac -b:a 320k out.mp4 | |
rm -f a.mp4 | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.youtube.com/watch?v=3R8e-OMmxXw btw