#!/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='4cEKAYnxbrk' # 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 -to 05:12 -i "${SRC_FILE}" -vn -acodec copy "01. Grassy Plains.${FILE_EXT}" ffmpeg -ss 05:12 -to 09:13 -i "${SRC_FILE}" -vn -acodec copy "02. La Luna.${FILE_EXT}" ffmpeg -ss 09:13 -to 12:32 -i "${SRC_FILE}" -vn -acodec copy "03. Until Dawn.${FILE_EXT}" ffmpeg -ss 12:32 -to 15:36 -i "${SRC_FILE}" -vn -acodec copy "04. Panalour.${FILE_EXT}" ffmpeg -ss 15:36 -to 18:31 -i "${SRC_FILE}" -vn -acodec copy "05. If Onsrfderdfly.${FILE_EXT}" ffmpeg -ss 18:21 -to 22:03 -i "${SRC_FILE}" -vn -acodec copy "06. Atlas.${FILE_EXT}" ffmpeg -ss 22:03 -to 26:01 -i "${SRC_FILE}" -vn -acodec copy "07. Brot.${FILE_EXT}" ffmpeg -ss 26:01 -to 29:51 -i "${SRC_FILE}" -vn -acodec copy "08. Pause.${FILE_EXT}" ffmpeg -ss 29:51 -to 33:14 -i "${SRC_FILE}" -vn -acodec copy "09. Flora.${FILE_EXT}" ffmpeg -ss 33:14 -to 36:22 -i "${SRC_FILE}" -vn -acodec copy "10. Endless.${FILE_EXT}" ffmpeg -ss 36:22 -to 38:27 -i "${SRC_FILE}" -vn -acodec copy "11. In Space.${FILE_EXT}" ffmpeg -ss 38:27 -to 41:46 -i "${SRC_FILE}" -vn -acodec copy "12. Reverie.${FILE_EXT}" ffmpeg -ss 41:46 -to 43:47 -i "${SRC_FILE}" -vn -acodec copy "13. Rain.${FILE_EXT}" ffmpeg -ss 43:47 -to 46:09 -i "${SRC_FILE}" -vn -acodec copy "14. Other Side.${FILE_EXT}" ffmpeg -ss 46:09 -to 49:44 -i "${SRC_FILE}" -vn -acodec copy "15. Fireflies.${FILE_EXT}" ffmpeg -ss 49:44 -to 51:26 -i "${SRC_FILE}" -vn -acodec copy "16. All The Same.${FILE_EXT}" ffmpeg -ss 00:00 -to 05:12 -i "${SRC_FILE}" -vn -acodec copy "01. Grassy Plains.${FILE_EXT}" ffmpeg -ss 05:12 -to 09:13 -i "${SRC_FILE}" -vn -acodec copy "02. La Luna.${FILE_EXT}" ffmpeg -ss 09:13 -to 12:32 -i "${SRC_FILE}" -vn -acodec copy "03. Until Dawn.${FILE_EXT}" ffmpeg -ss 12:32 -to 15:36 -i "${SRC_FILE}" -vn -acodec copy "04. Panalour.${FILE_EXT}" ffmpeg -ss 15:36 -to 18:31 -i "${SRC_FILE}" -vn -acodec copy "05. If Onsrfderdfly.${FILE_EXT}" ffmpeg -ss 18:21 -to 22:03 -i "${SRC_FILE}" -vn -acodec copy "06. Atlas.${FILE_EXT}" ffmpeg -ss 22:03 -to 26:01 -i "${SRC_FILE}" -vn -acodec copy "07. Brot.${FILE_EXT}" ffmpeg -ss 26:01 -to 29:51 -i "${SRC_FILE}" -vn -acodec copy "08. Pause.${FILE_EXT}" ffmpeg -ss 29:51 -to 33:14 -i "${SRC_FILE}" -vn -acodec copy "09. Flora.${FILE_EXT}" ffmpeg -ss 33:14 -to 36:22 -i "${SRC_FILE}" -vn -acodec copy "10. Endless.${FILE_EXT}" ffmpeg -ss 36:22 -to 38:27 -i "${SRC_FILE}" -vn -acodec copy "11. In Space.${FILE_EXT}" ffmpeg -ss 38:27 -to 41:46 -i "${SRC_FILE}" -vn -acodec copy "12. Reverie.${FILE_EXT}" ffmpeg -ss 41:46 -to 43:47 -i "${SRC_FILE}" -vn -acodec copy "13. Rain.${FILE_EXT}" ffmpeg -ss 43:47 -to 46:09 -i "${SRC_FILE}" -vn -acodec copy "14. Other Side.${FILE_EXT}" ffmpeg -ss 46:09 -to 49:44 -i "${SRC_FILE}" -vn -acodec copy "15. Fireflies.${FILE_EXT}" ffmpeg -ss 49:44 -to 51:26 -i "${SRC_FILE}" -vn -acodec copy "16. All The Same.${FILE_EXT}" ffmpeg -ss 00:00 -to 05:12 -i "${SRC_FILE}" -vn -acodec copy "01. Grassy Plains.${FILE_EXT}" ffmpeg -ss 05:12 -to 09:13 -i "${SRC_FILE}" -vn -acodec copy "02. La Luna.${FILE_EXT}" ffmpeg -ss 09:13 -to 12:32 -i "${SRC_FILE}" -vn -acodec copy "03. Until Dawn.${FILE_EXT}" ffmpeg -ss 12:32 -to 15:36 -i "${SRC_FILE}" -vn -acodec copy "04. Panalour.${FILE_EXT}" ffmpeg -ss 15:36 -to 18:31 -i "${SRC_FILE}" -vn -acodec copy "05. If Onsrfderdfly.${FILE_EXT}" ffmpeg -ss 18:21 -to 22:03 -i "${SRC_FILE}" -vn -acodec copy "06. Atlas.${FILE_EXT}" ffmpeg -ss 22:03 -to 26:01 -i "${SRC_FILE}" -vn -acodec copy "07. Brot.${FILE_EXT}" ffmpeg -ss 26:01 -to 29:51 -i "${SRC_FILE}" -vn -acodec copy "08. Pause.${FILE_EXT}" ffmpeg -ss 29:51 -to 33:14 -i "${SRC_FILE}" -vn -acodec copy "09. Flora.${FILE_EXT}" ffmpeg -ss 33:14 -to 36:22 -i "${SRC_FILE}" -vn -acodec copy "10. Endless.${FILE_EXT}" ffmpeg -ss 36:22 -to 38:27 -i "${SRC_FILE}" -vn -acodec copy "11. In Space.${FILE_EXT}" ffmpeg -ss 38:27 -to 41:46 -i "${SRC_FILE}" -vn -acodec copy "12. Reverie.${FILE_EXT}" ffmpeg -ss 41:46 -to 43:47 -i "${SRC_FILE}" -vn -acodec copy "13. Rain.${FILE_EXT}" ffmpeg -ss 43:47 -to 46:09 -i "${SRC_FILE}" -vn -acodec copy "14. Other Side.${FILE_EXT}" ffmpeg -ss 46:09 -to 49:44 -i "${SRC_FILE}" -vn -acodec copy "15. Fireflies.${FILE_EXT}" ffmpeg -ss 49:44 -to 51:26 -i "${SRC_FILE}" -vn -acodec copy "16. All The Same.${FILE_EXT}"