This Bash script helps you download a YouTube playlist using yt-dlp. It also provides an optional feature to concatenate downloaded videos into a single .mp4 file using ffmpeg.
Make sure you have the following installed:
yt-dlp(for downloading videos)ffmpeg(for video conversion and concatenation)
bash yd.sh [download_folder] <playlist_link> [con][download_folder](optional): Specifies the folder where videos will be downloaded. If not provided, defaults to/home/Download_Youtube.<playlist_link>(required): The YouTube playlist URL.[con](optional): If set tocon, all downloaded videos will be converted to.mp4(if necessary) and concatenated into a singleoutput.mp4file.
- Download a playlist to the default folder:
bash yd.sh "https://www.youtube.com/playlist?list=XYZ123" - Download a playlist to a specific folder:
bash yd.sh /path/to/folder "https://www.youtube.com/playlist?list=XYZ123" - Download and concatenate videos:
bash yd.sh /path/to/folder "https://www.youtube.com/playlist?list=XYZ123" con
- Downloads an entire YouTube playlist.
- Converts downloaded videos to
.mp4format (if not already.mp4). - Concatenates videos into a single file if the
conparameter is provided. - Cleans up intermediate files after processing.
- If the specified folder does not exist, the script will exit with an error.
- The script automatically removes unnecessary files after execution.
- Make sure
yt-dlpandffmpegare installed and accessible from the terminal. - Running the script with
conmay take additional processing time due to video conversion and merging.
Magdi