#!/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='4eEKvs6e_MU' # 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:03:04 -i "${SRC_FILE}" -vn -acodec copy "01. Alone Again (by Aqqas Malik).${FILE_EXT}" ffmpeg -ss 00:03:04 -to 00:06:08 -i "${SRC_FILE}" -vn -acodec copy "02. Gasoline (by me and Girg).${FILE_EXT}" ffmpeg -ss 00:06:08 -to 00:10:45 -i "${SRC_FILE}" -vn -acodec copy "03. Sacrifice (by Loft Music).${FILE_EXT}" ffmpeg -ss 00:10:45 -to 00:13:00 -i "${SRC_FILE}" -vn -acodec copy "04. How Do I Make You Love Me?.${FILE_EXT}" ffmpeg -ss 00:13:00 -to 00:16:04 -i "${SRC_FILE}" -vn -acodec copy "05. Can't Feel My Face (by menon).${FILE_EXT}" ffmpeg -ss 00:16:04 -to 00:19:59 -i "${SRC_FILE}" -vn -acodec copy "06. Take My Breath (by me and Girg).${FILE_EXT}" ffmpeg -ss 00:19:59 -to 00:22:06 -i "${SRC_FILE}" -vn -acodec copy "07. Hurricane (by menon).${FILE_EXT}" ffmpeg -ss 00:22:06 -to 00:25:09 -i "${SRC_FILE}" -vn -acodec copy "08. The Hills (by menon).${FILE_EXT}" ffmpeg -ss 00:25:09 -to 00:27:51 -i "${SRC_FILE}" -vn -acodec copy "09. Often (by menon).${FILE_EXT}" ffmpeg -ss 00:27:51 -to 00:29:45 -i "${SRC_FILE}" -vn -acodec copy "10. Crew Love (by menon).${FILE_EXT}" ffmpeg -ss 00:29:45 -to 00:33:46 -i "${SRC_FILE}" -vn -acodec copy "11. Starboy (by menon).${FILE_EXT}"