#!/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='Iqco1TYoxF0' # 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:06:48 -i "${SRC_FILE}" -vn -acodec copy "1. I. 𝔄𝔤𝔞𝔦𝔫𝔰𝔱 𝔑𝔞𝔱𝔲𝔯𝔢.${FILE_EXT}" ffmpeg -ss 00:06:48 -to 00:14:38 -i "${SRC_FILE}" -vn -acodec copy "2. II. 𝔄𝔰𝔥𝔢𝔰.${FILE_EXT}" ffmpeg -ss 00:14:38 -to 00:20:18 -i "${SRC_FILE}" -vn -acodec copy "3. III. 𝔗𝔥𝔢 𝔘𝔫𝔟𝔢𝔞𝔯𝔞𝔟𝔩𝔢 𝔙𝔦𝔰𝔦𝔬𝔫.${FILE_EXT}" ffmpeg -ss 00:20:18 -to 00:23:51 -i "${SRC_FILE}" -vn -acodec copy "4. IV. 𝔉𝔯𝔲𝔰𝔱𝔯𝔞𝔱𝔦𝔬𝔫𝔰.${FILE_EXT}" ffmpeg -ss 00:23:51 -to 00:30:47 -i "${SRC_FILE}" -vn -acodec copy "5. V. 𝔒𝔫𝔢 𝔏𝔞𝔰𝔱 𝔖𝔱𝔢𝔭.${FILE_EXT}" ffmpeg -ss 00:30:47 -to 00:38:57 -i "${SRC_FILE}" -vn -acodec copy "6. VI. 𝔖𝔭𝔢𝔠𝔱𝔯𝔢.${FILE_EXT}" ffmpeg -ss 00:38:57 -to 00:46:34 -i "${SRC_FILE}" -vn -acodec copy "7. VII. 𝔚𝔬𝔲𝔫𝔡𝔰 𝔚𝔥𝔦𝔠𝔥 𝔑𝔢𝔳𝔢𝔯 ℌ𝔢𝔞𝔩.${FILE_EXT}" ffmpeg -ss 00:46:34 -to 00:51:31 -i "${SRC_FILE}" -vn -acodec copy "8. VIII. 𝔘𝔫𝔯𝔢𝔞𝔩.${FILE_EXT}" ffmpeg -ss 00:51:31 -to 01:09:54 -i "${SRC_FILE}" -vn -acodec copy "9. IX. 𝔑𝔢𝔳𝔢𝔯 ℭ𝔬𝔪𝔢𝔰 𝔖𝔦𝔩𝔢𝔫𝔠𝔢.${FILE_EXT}"