diff --git a/Apps/yt-dlp/download.cmd b/Apps/yt-dlp/download.cmd new file mode 100644 index 0000000..4d1aae7 --- /dev/null +++ b/Apps/yt-dlp/download.cmd @@ -0,0 +1,19 @@ +@echo off + +:: Download video from the internet + +set url=%* + +::echo %url% + +:: yt-dlp --format "bestvideo[ext=mkv][height<='1080']+bestaudio/best" https://www.youtube.com/watch?v= + +::"C:\Users\kbram\Downloads\media_download\yt-dlp" --sleep-interval 5 --max-sleep-interval 10 --format "bestvideo[ext=mkv][height<=1080]+bestaudio/best" "%url%" +::"C:\Users\kbram\Downloads\media_download\yt-dlp" --sleep-interval 5 --max-sleep-interval 10 --postprocessor-args "VideoConvertor:-vcodec libx265" --recode-video mkv --format "bestvideo[height<=1080]+bestaudio/best" "%url%" +"C:\Users\kbram\Downloads\media_download\yt-dlp" --postprocessor-args "VideoConvertor:-vcodec libx265" --recode-video mkv --format "bestvideo[height<=1080]+bestaudio/best" "%url%" + +set url= + + + + diff --git a/Apps/yt-dlp/download_v2.cmd b/Apps/yt-dlp/download_v2.cmd new file mode 100644 index 0000000..490b9c1 --- /dev/null +++ b/Apps/yt-dlp/download_v2.cmd @@ -0,0 +1,43 @@ +@echo off +REM Batch Script for downloading videos with yt-dlp from YouTube and other websites, accepting URL as input via command line. + +REM Clear any previous download commands to avoid conflicts +setlocal ENABLEEXTENSIONS +set LC_ALL=C & SET _='' & setLOCAL ENGLISH + +REM Accept a video URL as command-line argument (no prompt) and verify its presence +IF "%~1"=="" ( + ECHO No input provided. Usage: scriptname "https://www.youtube.com/watch?v=VIDEO_ID" & GOTO EndScript +) ELSE (SET InputUrl=%~1 & ECHO %InputUrl%) + +REM Define yt-dlp path and format for downloading videos up to 1080p in MKV container with the best audio quality +set "YT_DL_CMD=yt-dl.exe --format "bestvideo[height<=1080]&bestaudio[ext=mp3,quality=5][codec:bestaudio]" + +REM Run yt-dlp to download videos and extract the output filename for ffmpeg use +FOR /F delims== %%A IN ('%YT_DL_CMD%') DO SET "YT_DL_COMMAND=%%A" + +SET "OUTPUTFILE=downloaded_video.mkv" + +REM Execute yt-dlp command and pipe the output to ffmpeg for conversion if necessary +call :DownloadAndConvert "%InputUrl%" "%OutputFile%" +GOTO EndScript + +:DownloadAndConvert +set "VideoUrl=%~1" +set "OutputFile=%~2" +REM Inform about processing download... +echo Processing download of %VideoUrl%... +%YT_DL_COMMAND% -o "%OutputFile%" "%VideoUrl%" && ( + REM Use ffmpeg to convert audio track if not already in AAC format and output MKV file + ffmpeg -i "%OutputFile%.mp3" -c:v copy -c:a aac "%OutputFile%.aac" && ( + Echo Conversion to AAC complete. MKV video is ready with audio track in the same folder as MP3 file. + REM The final .mkv file will be located at "%OutputFile%".mkv + ) || ( + ECHO Failed to convert video, make sure ffmpeg is installed and available in PATH or provide full path for FFMPEG command here. + ) +GOTO EndScript + +:EndScript +REM Documentation of the script can be found below this line +REM Usage instructions are provided above as a comment when running the batch file from the command prompt. +REM Ensure yt-dlp and ffmpeg executables are accessible or provide full paths in variables YT_DL_CMD and FFMPEG_COMMAND respectively before execution. \ No newline at end of file diff --git a/Apps/yt-dlp/yt-dlp.exe b/Apps/yt-dlp/yt-dlp.exe new file mode 100644 index 0000000..5b72abe Binary files /dev/null and b/Apps/yt-dlp/yt-dlp.exe differ