Last active
April 14, 2024 22:29
-
-
Save milleniumbug/6aae4cc5b77303d73be07cc74923fa6f to your computer and use it in GitHub Desktop.
download video from YouTube, extract music and normalize volume
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
param( | |
[string]$url | |
) | |
yt-dlp ` | |
$url ` | |
--quiet ` | |
--extract-audio ` | |
--audio-format mp3 ` | |
--audio-quality 3 ` | |
--embed-thumbnail ` | |
--embed-metadata ` | |
--exec 'mp3gain -q -r -c "{}"' |
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
#!/bin/bash | |
yt-dlp \ | |
--quiet \ | |
--extract-audio \ | |
--audio-format mp3 \ | |
--audio-quality 3 \ | |
--embed-thumbnail \ | |
--embed-metadata \ | |
"$@" \ | |
--exec 'mp3gain -q -r -c {} > /dev/null && echo {}' |
FYI
mp3gain
is no longer available in repositories, does not compile and has been replaced withr128gain
.- ReplayGain 2.0 targets the same loudness as ReplayGain 1.0 specification, but utilizes the improved ITU BS.1770 algorithm for measuring original tracks.
mp3gain
is based on ReplayGain 1.0 specification.
Improved script: https://gist.github.com/madjoe/b981fa7f3f81089a37257e366c1ef581
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank You, perfect. Just a couple of notations. I'm now running Ubuntu under Win 10 (Subsystem for Linux) and then I had to change from two "&&" to just one "&". It wasn't necessary under native Linux???.
I've also added a couple of lines so that the finished file is also tagged (even a Picture, only in YouTube):
#!/bin/bash
read -p ' Title : ' title
read -p 'Artist : ' artist
read -p ' Album : ' album
read -p ' Genre : ' genre
youtube-dl
"$1" \
--quiet \
--extract-audio \
--audio-format mp3 \
--audio-quality 3 \
--embed-thumbnail \
--exec 'mp3gain -q -r -c -s i {} > /dev/null & echo -n {}' \
|xargs -0 mid3v2 -t "$title" -a "$artist" -A "$album" -g "$genre"