#!/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='c1uKkE7tVwk' # 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:39 -i "${SRC_FILE}" -vn -acodec copy "01. Lửng Lơ - MASEW x BRAY ft. RedT x Ý Tiên.${FILE_EXT}" ffmpeg -ss 00:03:39 -to 00:06:39 -i "${SRC_FILE}" -vn -acodec copy "02. Vương Vấn - TVk, Hana Cẩm Tiên.${FILE_EXT}" ffmpeg -ss 00:06:39 -to 00:10:47 -i "${SRC_FILE}" -vn -acodec copy "03. Ngôi Sao Cô Đơn - J97 (Jack).${FILE_EXT}" ffmpeg -ss 00:10:47 -to 00:14:33 -i "${SRC_FILE}" -vn -acodec copy "04. Cuối Cùng Thì - J97 (Jack).${FILE_EXT}" ffmpeg -ss 00:14:33 -to 00:18:56 -i "${SRC_FILE}" -vn -acodec copy "05. Bên Trên Tầng Lầu - Tăng Duy Tân.${FILE_EXT}" ffmpeg -ss 00:18:56 -to 00:22:09 -i "${SRC_FILE}" -vn -acodec copy "06. Rằng Em Mãi Ở Bên - Bích Phương.${FILE_EXT}" ffmpeg -ss 00:22:09 -to 00:24:42 -i "${SRC_FILE}" -vn -acodec copy "07. See Tình - Hoàng Thùy Linh.${FILE_EXT}" ffmpeg -ss 00:24:42 -to 00:28:24 -i "${SRC_FILE}" -vn -acodec copy "08. Đắm - Xesi, Ricky Star.${FILE_EXT}" ffmpeg -ss 00:28:24 -to 00:31:49 -i "${SRC_FILE}" -vn -acodec copy "09. Thương Một Người Mất Cả Tương Lai.${FILE_EXT}" ffmpeg -ss 00:31:49 -to 00:34:35 -i "${SRC_FILE}" -vn -acodec copy "10. Hạnh Phúc Đó Em Không Có - Lương Minh Trang.${FILE_EXT}" ffmpeg -ss 00:34:35 -to 00:37:52 -i "${SRC_FILE}" -vn -acodec copy "11. Dancin Remix.${FILE_EXT}" ffmpeg -ss 00:37:52 -to 00:40:51 -i "${SRC_FILE}" -vn -acodec copy "12. Face - Nuest.${FILE_EXT}" ffmpeg -ss 00:40:51 -to 00:45:52 -i "${SRC_FILE}" -vn -acodec copy "13. Tay Trái Chỉ Trăng - Tát Đỉnh Đỉnh.${FILE_EXT}" ffmpeg -ss 00:45:52 -to 00:49:03 -i "${SRC_FILE}" -vn -acodec copy "14. Mang Chủng - Âm Huyết Thi Thính.${FILE_EXT}" ffmpeg -ss 00:49:03 -to 00:52:03 -i "${SRC_FILE}" -vn -acodec copy "15. Anh Yêu Vội Thế - Lala Trần.${FILE_EXT}" ffmpeg -ss 00:52:03 -to 00:55:13 -i "${SRC_FILE}" -vn -acodec copy "16. Beautiful Monster - SooBin x Binz.${FILE_EXT}" ffmpeg -ss 00:55:13 -to 00:58:15 -i "${SRC_FILE}" -vn -acodec copy "17. Kỳ Vọng Sai Lầm.${FILE_EXT}" ffmpeg -ss 00:58:15 -to 01:01:15 -i "${SRC_FILE}" -vn -acodec copy "18. Cứu Vãn Kịp Không - Vương Anh Tú.${FILE_EXT}" ffmpeg -ss 01:01:15 -to 01:04:03 -i "${SRC_FILE}" -vn -acodec copy "19. Phải Chia Tay Thôi - Hương Ly.${FILE_EXT}" ffmpeg -ss 01:04:03 -to 01:08:12 -i "${SRC_FILE}" -vn -acodec copy "20. Lonely x Hey Hey Hey.${FILE_EXT}" ffmpeg -ss 01:08:12 -to 01:11:53 -i "${SRC_FILE}" -vn -acodec copy "21. Phong Dạ Hành - Tưởng Tuyết Nhi.${FILE_EXT}" ffmpeg -ss 01:11:53 -to 01:17:40 -i "${SRC_FILE}" -vn -acodec copy "22. Fiction - BEATS.${FILE_EXT}"