#!/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='MP9evk0f7Qg' # 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:02:29 -i "${SRC_FILE}" -vn -acodec copy "01. 1- Hungry Face.${FILE_EXT}" ffmpeg -ss 00:02:29 -to 00:04:53 -i "${SRC_FILE}" -vn -acodec copy "02. 2- Jaguar.${FILE_EXT}" ffmpeg -ss 00:04:53 -to 00:09:00 -i "${SRC_FILE}" -vn -acodec copy "03. 3- The Huts.${FILE_EXT}" ffmpeg -ss 00:09:00 -to 00:12:35 -i "${SRC_FILE}" -vn -acodec copy "04. 4- Kill Jester.${FILE_EXT}" ffmpeg -ss 00:12:35 -to 00:15:25 -i "${SRC_FILE}" -vn -acodec copy "05. 5- This Messiah Needs Watching.${FILE_EXT}" ffmpeg -ss 00:15:25 -to 00:17:09 -i "${SRC_FILE}" -vn -acodec copy "06. 6- Whisky Time.${FILE_EXT}" ffmpeg -ss 00:17:09 -to 00:21:06 -i "${SRC_FILE}" -vn -acodec copy "07. 7- Special N.${FILE_EXT}" ffmpeg -ss 00:21:06 -to 00:24:52 -i "${SRC_FILE}" -vn -acodec copy "08. 8- Relative Hysteria.${FILE_EXT}" ffmpeg -ss 00:24:52 -to 00:28:43 -i "${SRC_FILE}" -vn -acodec copy "09. 9- Fridge Magic.${FILE_EXT}" ffmpeg -ss 00:28:43 -to 00:32:50 -i "${SRC_FILE}" -vn -acodec copy "10. 10- Portugal.${FILE_EXT}" ffmpeg -ss 00:32:50 -to 00:36:24 -i "${SRC_FILE}" -vn -acodec copy "11. 11- Eagle Tax.${FILE_EXT}" ffmpeg -ss 00:36:24 -to 00:39:14 -i "${SRC_FILE}" -vn -acodec copy "12. 12- Modern.${FILE_EXT}" ffmpeg -ss 00:39:14 -to 00:45:13 -i "${SRC_FILE}" -vn -acodec copy "13. 13- What Are They Doing In Heaven Today?.${FILE_EXT}" ffmpeg -ss 00:45:13 -to 00:49:50 -i "${SRC_FILE}" -vn -acodec copy "14. 14- Wizard Motor.${FILE_EXT}"