Youtube2Audio

From JoBaPedia
Jump to navigation Jump to search

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 --embed-thumbnail 'playlist-url'

Commands for adding metadata

will need adapting to actual yt title formats

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 -i "$f" -acodec copy -metadata title="$t" -metadata artist="Roger Waters" -metadata album="$a" "meta/$a/$t.opus"
done