Youtube2Audio: Difference between revisions
Jump to navigation
Jump to search
| Line 31: | Line 31: | ||
The redirects are necessary because ffmpeg encoders seem to read from stdin and garble the "while read f" loop input | The redirects are necessary because ffmpeg encoders seem to read from stdin and garble the "while read f" loop input | ||
Add pictures as mp3 tag | |||
for f in *.mp3; do | |||
b=${f/.mp3/}; | |||
echo $b; | |||
id3v2 --APIC `cat "../$b.jpg"` "$f"; | |||
done | |||
Revision as of 22:22, 24 November 2020
Youtube to Audio
Download youtube-dl or update to latest
sudo youtube-dl -U
Commands for DL a playlist
mkdir -p artist/album cd artist/album youtube-dl --extract-audio --keep-video 'album-playlist-url'
Option --embed-thumbnail seems useful, but did not work. Maybe retry later...
Commands for adding metadata
will need adapting to actual yt title audio formats. This playlist only contained video with opus (ogg vorbis) audio tracks.
mkdir meta
find . -name '*.opus' -print | while read f; do
t=${f%-???????????.opus}
t=${t/Roger Waters - /}
t=${t#*/}
a=${t%/*}
t=${t#*/}
echo "<$a><$t>"
mkdir -p "meta/$a"
ffmpeg -v 0 -i "$f" -acodec copy -metadata title="$t" -metadata artist="Roger Waters" -metadata album="$a" "meta/$a/$t.opus" </dev/zero
ffmpeg -v 0 -i "$f" -acodec mp3 -metadata title="$t" -metadata artist="Roger Waters" -metadata album="$a" "meta/$a/$t.mp3" </dev/zero
done
The redirects are necessary because ffmpeg encoders seem to read from stdin and garble the "while read f" loop input
Add pictures as mp3 tag
for f in *.mp3; do
b=${f/.mp3/};
echo $b;
id3v2 --APIC `cat "../$b.jpg"` "$f";
done