#!/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='99sszBwlSXo' # 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 04:06:00 -i "${SRC_FILE}" -vn -acodec copy "01. Bon Beat.${FILE_EXT}" ffmpeg -ss 04:06:00 -to 08:04:00 -i "${SRC_FILE}" -vn -acodec copy "02. Jump In.${FILE_EXT}" ffmpeg -ss 08:04:00 -to 12:43:00 -i "${SRC_FILE}" -vn -acodec copy "03. Chérie.${FILE_EXT}" ffmpeg -ss 12:43:00 -to 17:29:00 -i "${SRC_FILE}" -vn -acodec copy "04. Do It to Me.${FILE_EXT}" ffmpeg -ss 17:29:00 -to 21:29:00 -i "${SRC_FILE}" -vn -acodec copy "05. Sugar Sugar.${FILE_EXT}" ffmpeg -ss 21:29:00 -to 25:57 -i "${SRC_FILE}" -vn -acodec copy "06. Love Somebody.${FILE_EXT}" ffmpeg -ss 25:57 -to 30:36 -i "${SRC_FILE}" -vn -acodec copy "07. Rococo.${FILE_EXT}" ffmpeg -ss 30:36 -to 33:53 -i "${SRC_FILE}" -vn -acodec copy "08. Divider.${FILE_EXT}" ffmpeg -ss 33:53 -to 37:54 -i "${SRC_FILE}" -vn -acodec copy "09. Say Say.${FILE_EXT}" ffmpeg -ss 37:54 -to 41:47 -i "${SRC_FILE}" -vn -acodec copy "10. Just You.${FILE_EXT}"