#!/bin/bash # __ __ # ____ ___ ______ / /___ ____ _____/ /__ _____ # / __ `/ / / / __ \/ / __ \/ __ `/ __ / _ \/ ___/ # / /_/ / /_/ / / / / / /_/ / /_/ / /_/ / __/ / # \__, /\__,_/_/ /_/_/\____/\__,_/\__,_/\___/_/ # /____/ # --------------------------------------------------- # Author :: Miris /// GitHub :: MirisWisdom/Albumin # --------------------------------------------------- # This simple Bash script lets you download the video # using yt-dlp, and then takes care of extracting its # audio into a file for each song w/ ffmpeg! # It does not re-encode or tag any of the audio files # due to raw preservation being its purpose. # You should run it line by line rather than blindly! # Feel free to tweak & suggest improvements! # --------------------------------------------------- # We'll be using the ID for both file and directory. VIDEO_ID='onZ4PM9PbVQ' # Create and enter the new directory. mkdir -p "${VIDEO_ID}" && cd "${VIDEO_ID}" # Download the audio file using yt-dlp. yt-dlp -x -f bestaudio "${VIDEO_ID}" -o "${VIDEO_ID}.%%(ext)s" # Figure out the downloaded file name and extension. SRC_FILE=$(ls "${VIDEO_ID}".*) # ls command should only output the downloaded file name! FILE_EXT=${SRC_FILE:12} # file id + dot = 12 characters; extension length varies! ffmpeg -ss 00:00:00 -to 00:04:24 -i "${SRC_FILE}" -vn -acodec copy "01. M☆O☆S☆O乱舞 ~まかでみ・WAっしょい!より~.${FILE_EXT}" ffmpeg -ss 00:04:24 -to 00:08:24 -i "${SRC_FILE}" -vn -acodec copy "02. 崖の上のポニョ ~崖の上のポニョ~ (赤い彗星 Mix).${FILE_EXT}" ffmpeg -ss 00:08:24 -to 00:12:24 -i "${SRC_FILE}" -vn -acodec copy "03. 銀河鉄道999 ~銀河鉄道999より~.${FILE_EXT}" ffmpeg -ss 00:12:24 -to 00:16:01 -i "${SRC_FILE}" -vn -acodec copy "04. ETERNAL BLAZE ~魔法少女リリカルなのはA’Sより~.${FILE_EXT}" ffmpeg -ss 00:16:01 -to 00:19:47 -i "${SRC_FILE}" -vn -acodec copy "05. flower of bravery ~恋姫†無双より~.${FILE_EXT}" ffmpeg -ss 00:23:55 -to 00:27:34 -i "${SRC_FILE}" -vn -acodec copy "07. 激動 ~D.GRAY-MANより~ (Pinpon Mix).${FILE_EXT}" ffmpeg -ss 00:27:34 -to 00:32:02 -i "${SRC_FILE}" -vn -acodec copy "08. UNNAMED WORLD ~二十面相の娘より~ (NFPudding Mix).${FILE_EXT}" ffmpeg -ss 00:32:02 -to 00:35:43 -i "${SRC_FILE}" -vn -acodec copy "09. やっぱり世界はあたし☆れじぇんど!! ~恋姫†無双より~.${FILE_EXT}" ffmpeg -ss 00:35:43 -to 00:39:19 -i "${SRC_FILE}" -vn -acodec copy "10. ?でわっしょい ~ひだまりスケッチ×365より~ (NFPudding Mix).${FILE_EXT}" ffmpeg -ss 00:39:19 -to 00:41:47 -i "${SRC_FILE}" -vn -acodec copy "11. 私の彼はパイロット ~超時空要塞マクロス より~ (Pinpon Mix).${FILE_EXT}" ffmpeg -ss 00:41:47 -to 00:45:19 -i "${SRC_FILE}" -vn -acodec copy "12. TRICKSTER.${FILE_EXT}" ffmpeg -ss 00:45:19 -to 00:48:37 -i "${SRC_FILE}" -vn -acodec copy "13. BLACK DIAMOND.${FILE_EXT}" ffmpeg -ss 00:48:37 -to 00:53:20 -i "${SRC_FILE}" -vn -acodec copy "14. 続く世界 ~天元突破グレンラガン -紅蓮編-より~ (NFPudding Mix).${FILE_EXT}" ffmpeg -ss 00:53:20 -to 00:58:15 -i "${SRC_FILE}" -vn -acodec copy "15. バンビーノ・バンビーナ.${FILE_EXT}" ffmpeg -ss 00:19:47 -to 00:23:55 -i "${SRC_FILE}" -vn -acodec copy "06. MASSIVE WONDERS ~魔法少女リリカルなのはStrikerS~ (NFPudding Remix).${FILE_EXT}"