Last active
July 1, 2024 16:14
-
-
Save jonasfroeller/232eb80b219ab08db3755c421a3872f8 to your computer and use it in GitHub Desktop.
The best ytdl config I have.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
color 0A | |
REM dependencies of the watermark remover | |
REM python -m pip install numpy scipy imageio | |
REM apt install python3-scipy python3-numpy python3-imageio | |
REM set paths | |
SET YOUTUBE_DL_PATH=A:\VideoDownloader\youtube-dl-nightly.exe | |
SET FFMPEG_PATH=C:\ProgramData\chocolatey\lib\ffmpeg\tools\ffmpeg\bin\ffmpeg.exe | |
SET OUTPUT_PATH=D:\Downloads | |
ECHO ====================================================================================================================== | |
ECHO. | |
SET /P URL="[Enter video URL] " | |
ECHO. | |
ECHO ====================================================================================================================== | |
ECHO. | |
REM download video | |
%YOUTUBE_DL_PATH% -f "(bestvideo[height>2160][vcodec^=av01]/bestvideo[height>2160][vcodec^=vp9]/bestvideo[height>1440][vcodec^=av01]/bestvideo[height>1440][vcodec^=vp9][fps>30]/bestvideo[height>1440][vcodec^=vp9]/bestvideo[height>1080][vcodec^=av01]/bestvideo[height>1080][vcodec^=vp9][fps>30]/bestvideo[height>1080][vcodec^=vp9]/bestvideo[height>720][vcodec^=av01]/bestvideo[height>720][vcodec^=vp9][fps>30]/bestvideo[height>720][vcodec^=vp9]/bestvideo[height>240][vcodec^=av01]/bestvideo[vcodec^=vp9][fps>30]/bestvideo[height>240][vcodec^=vp9]/best[height>240]/bestvideo[vcodec^=av01]/bestvideo[vcodec^=vp9]/bestvideo)+(bestaudio[asr=48000]/bestaudio)/bestaudio[ext=opus]/best" --verbose --write-sub --all-subs --embed-subs --add-metadata --ffmpeg-location "%FFMPEG_PATH%" --external-downloader ffmpeg --user-agent "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" --merge-output-format mkv --output "%OUTPUT_PATH%\%%(title)s.%%(ext)s" %URL% | |
REM create mp4 version(s) | |
for %%I in ("%OUTPUT_PATH%\*.mkv") do ( | |
SET "INPUT_FILE=%%I" | |
CALL :PROCESS_FILE "%%I" | |
) | |
GOTO :EOF | |
:PROCESS_FILE | |
SET "INPUT_FILE=%~1" | |
SET "FILE_NAME=%~n1" | |
%FFMPEG_PATH% -i "%INPUT_FILE%" -c:v libx264 -crf 28 "%OUTPUT_PATH%\%FILE_NAME%.mp4" | |
REM Check if watermark removal is needed | |
SET /P REMOVE_WATERMARK="Remove watermark (yes/no)? " | |
IF /I "%REMOVE_WATERMARK%"=="yes" ( | |
REM Call the watermark removal script | |
start cmd /k remove_watermark.bat "%OUTPUT_PATH%\%FILE_NAME%.mp4" | |
) | |
GOTO :EOF | |
ECHO. | |
ECHO ====================================================================================================================== | |
ECHO. | |
ECHO Done! | |
REM links | |
REM https://github.com/ytdl-org/ytdl-nightly/releases, https://github.com/BtbN/FFmpeg-Builds/releases | |
REM https://github.com/ytdl-org/youtube-dl?tab=readme-ov-file, https://github.com/edinsuta/youtube-dl-batch/tree/master | |
REM https://askubuntu.com/questions/486297/how-to-select-video-quality-from-youtube-dl, https://superuser.com/questions/1669750/download-specific-resolution-with-youtube-dl, | |
REM https://stackoverflow.com/questions/19752533/how-do-i-set-chocolatey-to-install-applications-onto-another-drive | |
REM godlike base config source: https://www.reddit.com/r/DataHoarder/comments/hy8vnp/the_ultimate_youtubedl_config_to_always_get_the/ | |
REM other configs: https://github.com/TheFrenchGhosty/TheFrenchGhostys-Ultimate-YouTube-DL-Scripts-Collection/blob/master/scripts/Watch%20Scripts/Watch%20on%20PC%20Script/Watch%20on%20PC.sh | |
PAUSE | |
EXIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
remove_watermark.bat
: https://gist.github.com/jonasfroeller/5b08c148ab2192452e555afe0e840283