#!/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='_sI_Ps7JSEk' # 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:30 -i "${SRC_FILE}" -vn -acodec copy "01. All of Me (Gerald Marks/Seymor Simons).${FILE_EXT}" ffmpeg -ss 00:04:30 -to 00:08:15 -i "${SRC_FILE}" -vn -acodec copy "02. The The A-Train (Billy Streyhorn).${FILE_EXT}" ffmpeg -ss 00:08:15 -to 00:11:49 -i "${SRC_FILE}" -vn -acodec copy "03. Al the Things You Are (Jerome Kern/Oscar Hammerstein).${FILE_EXT}" ffmpeg -ss 00:11:49 -to 00:16:52 -i "${SRC_FILE}" -vn -acodec copy "04. Satin Doll (Duke Ellington/Billy Strayhorne).${FILE_EXT}" ffmpeg -ss 00:16:52 -to 00:21:06 -i "${SRC_FILE}" -vn -acodec copy "05. Fly Me to the Moon (Bart Howard).${FILE_EXT}" ffmpeg -ss 00:21:06 -to 00:26:20 -i "${SRC_FILE}" -vn -acodec copy "06. Autumn Leaves (Jodeph Kosma/Jacqes Prevert).${FILE_EXT}" ffmpeg -ss 00:26:20 -to 00:32:05 -i "${SRC_FILE}" -vn -acodec copy "07. My Romance (Richard Rogers/Lorenz Hart).${FILE_EXT}" ffmpeg -ss 00:32:05 -to 00:35:44 -i "${SRC_FILE}" -vn -acodec copy "08. Take Five (Paul Desmonds).${FILE_EXT}" ffmpeg -ss 00:35:44 -to 00:39:14 -i "${SRC_FILE}" -vn -acodec copy "09. How High the Moon (William Morgan Lewis/Hancy Hamilton).${FILE_EXT}" ffmpeg -ss 00:39:14 -to 00:42:58 -i "${SRC_FILE}" -vn -acodec copy "10. The More I See You (Harry Warren/Mack Gordon).${FILE_EXT}" ffmpeg -ss 00:42:58 -to 00:46:38 -i "${SRC_FILE}" -vn -acodec copy "11. Someday My Prince Will Come (Frank Churchill/Larry Morey).${FILE_EXT}" ffmpeg -ss 00:46:38 -to 00:49:50 -i "${SRC_FILE}" -vn -acodec copy "12. Don't Mean A Thing (Duke Ellington/Irving Mills).${FILE_EXT}"