Created
March 23, 2024 12:01
-
-
Save tcoppex/b4a6f082f542e82c75828c1e0a72a137 to your computer and use it in GitHub Desktop.
Create a single file mix from a youtube playlist.
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
#!/bin/bash | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <id_de_la_playlist>" | |
exit 1 | |
fi | |
playlist_id="$1" | |
temp_dir=$(mktemp -d) | |
./yt-dlp_linux -x --audio-format mp3 --output "$temp_dir/%(title)s.%(ext)s" "https://www.youtube.com/playlist?list=$playlist_id" | |
cd "$temp_dir" || exit 1 | |
rename "s/'//g" *.mp3 | |
for f in *.mp3; do echo "file '$PWD/$f'"; done > list.txt | |
ffmpeg -f concat -safe 0 -i list.txt -acodec libmp3lame -q:a 2 final_mix.mp3 | |
mv final_mix.mp3 "$OLDPWD"/ | |
cd "$OLDPWD" || exit 1 | |
rm -rf "$temp_dir" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment