VideoHelp Forum


Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!


Try StreamFab Downloader and download streaming video from Youtube, Netflix, Amazon! Download free trial.


+ Reply to Thread
Results 1 to 13 of 13
Thread
  1. Member WinSpirit's Avatar
    Join Date
    Sep 2002
    Location
    Computers room
    Search Comp PM
    A Simple command-line batch file i made to download internet video from many sites.
    It use the excellent youtube-dl command line utility.

    how to use:
    1 - Download youtube-dl and the latest version of ffmpeg
    2 - Create a folder, put these downloaded files in this folder
    3 - Create this .bat file with a text editor
    4 - In the .bat file, edit the download path for your preference, and save it in the same folder
    5 - Create a Windows shortcut to the batch file
    6 - Bdl-click the shortcut... paste the video url , select option ... that's it!

    this is the .bat file:

    @ECHO OFF

    SET DnBest=--hls-prefer-native --add-metadata -f best
    SET DnBestAudVid=--hls-prefer-native --add-metadata
    SET DnBestUnmerge=--hls-prefer-native --add-metadata -f "bestvideo,bestaudio"
    SET DnBestMP4_MPA=--hls-prefer-native --add-metadata -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best"
    SET DnBestMP4_AAC=--hls-prefer-native --add-metadata -f "bestvideo[ext=mp4]+bestaudio[ext=aac]/best[ext=mp4]/best"
    SET DnMP3=--write-all-thumbnails --hls-prefer-native --add-metadata --embed-thumbnail -f bestaudio/best -x --audio-quality 1 --audio-format mp3
    SET DnAAC=--write-all-thumbnails --hls-prefer-native --add-metadata --embed-thumbnail -f bestaudio/best -x --audio-quality 1 --audio-format aac
    SET DnM4A=--write-all-thumbnails --hls-prefer-native --add-metadata --embed-thumbnail -f bestaudio/best -x --audio-quality 1 --audio-format m4a

    SET Destination="D:\Downloads\Video/%%(title)s.%%(ext)s"

    if not -%1-==-- SET URL=%*
    if -%1-==-- goto fopNew

    :top
    CLS
    ECHO URL: %URL%
    ECHO ----------------------
    ECHO Available operations:
    ECHO ----------------------
    ECHO .
    ::This prints the list of the operations

    ECHO 1. Best already on site
    ECHO 2. Best Audio and Best Video
    ECHO 3. Best (no merge)
    ECHO 4. Best MP4 and M4A
    ECHO 5. Best MP4 and AAC
    ECHO 6. MP3 (Audio)
    ECHO 7. AAC (Audio)
    ECHO 8. M4A (Audio)
    ECHO -
    ECHO f. List all possible formats
    ECHO u. Auto-update
    ECHO n. Process New File
    ECHO x. Quit
    ECHO -

    ::Ask the user to choose the operation they want

    SET /P operation=Which operation would you like to do?:
    if "%operation%"=="n" goto fopNew
    if "%operation%"=="N" goto fopNew
    if "%operation%"=="1" goto fop1
    if "%operation%"=="2" goto fop2
    if "%operation%"=="3" goto fop3
    if "%operation%"=="4" goto fop4
    if "%operation%"=="5" goto fop5
    if "%operation%"=="6" goto fop6
    if "%operation%"=="7" goto fop7
    if "%operation%"=="8" goto fop8
    if "%operation%"=="f" goto fopFormat
    if "%operation%"=="F" goto fopFormat
    if "%operation%"=="u" goto fopUpdate
    if "%operation%"=="U" goto fopUpdate
    goto fopQuit


    :fop1
    ECHO Best:
    youtube-dl %DnBest% -o %Destination% %URL%
    pause
    goto top

    :fop2
    ECHO Best Audio and Best Video:
    youtube-dl %DnBestAudVid% -o %Destination% %URL%
    pause
    goto top

    :fop3
    ECHO Best No Merge:
    youtube-dl %DnBestUnmerge% -o %Destination% %URL%
    pause
    goto top

    :fop4
    ECHO Best MP4 and MPa:
    youtube-dl %DnBestMP4_MPA% -o %Destination% %URL%
    pause
    goto top

    :fop5
    ECHO Best MP4 and AAC:
    youtube-dl %DnBestMP4_AAC% -o %Destination% %URL%
    pause
    goto top

    :fop6
    ECHO MP3:
    youtube-dl %DnMP3% -o %Destination% %URL%
    pause
    goto top

    :fop7
    ECHO AAC:
    youtube-dl %DnAAC% -o %Destination% %URL%
    pause
    goto top

    :fop8
    ECHO M4A:
    youtube-dl %DnM4A% -o %Destination% %URL%
    pause
    goto top

    :fopFormat
    ECHO List of all possible formats:
    youtube-dl -F %URL%
    pause
    goto top

    :fopUpdate
    ECHO Updates:
    youtube-dl -U
    pause
    goto top

    :fopNew
    SET /P URL=Please enter the video URL:
    goto top

    :fopQuit
    Have fun!
    Shine as you should !
    Quote Quote  
  2. what do you mean Bdl-click the shortcut... paste the video url , select option ... that's it! ??????????????
    What is Bdl-click ??
    Quote Quote  
  3. Member
    Join Date
    Jan 2012
    Location
    Victoria, Australia
    Search Comp PM
    Originally Posted by bestork View Post
    What is Bdl-click ??
    He means Dbl click, i.e. Double Click.
    Quote Quote  
  4. I'm a Super Moderator johns0's Avatar
    Join Date
    Jun 2002
    Location
    canada
    Search Comp PM
    WinSpirit-Thanks for the bat file,works just fine.
    I think,therefore i am a hamster.
    Quote Quote  
  5. Member hydra3333's Avatar
    Join Date
    Oct 2009
    Location
    Australia
    Search Comp PM
    Thanks.

    I use these
    REM download the BEST regardless of file extension
    "%youtube_dl_exe%" --no-call-home --console-title --verbose --ignore-config --prefer-ffmpeg --ffmpeg-location "%ffmpeg_location%" --buffer-size 64k --no-mtime --console-title --force-ipv4 --no-mark-watched --ignore-errors --restrict-filenames --format "bestvideo+bestaudio" %theURL%

    "%youtube_dl_exe%" --no-call-home --console-title --verbose --ignore-config --prefer-ffmpeg --ffmpeg-location "%ffmpeg_location%" --buffer-size 64k --no-mtime --console-title --force-ipv4 --no-mark-watched --ignore-errors --restrict-filenames --format "best" %theURL%
    So I must look up what your flags do !
    Code:
    --hls-prefer-native 
    --add-metadata
    --write-all-thumbnails
    --embed-thumbnail
    edit: it's at https://github.com/ytdl-org/youtube-dl#options
    Quote Quote  
  6. Member
    Join Date
    Sep 2006
    Location
    United States
    Search Comp PM
    Hi WinSpirit,
    Did you ever update your helpful YouTube-dl batch file to use YouTube-dlp? If so, would you please post the .bat file update? I don't understand programming enough to modify your original .bat file gem.

    Regards,
    creakndale
    Quote Quote  
  7. Originally Posted by creakndale View Post
    Hi WinSpirit,
    Did you ever update your helpful YouTube-dl batch file to use YouTube-dlp? If so, would you please post the .bat file update? I don't understand programming enough to modify your original .bat file gem.

    Regards,
    creakndale
    Just find and replace youtube-dl with yt-dlp.exe
    I tried, and it works, at least for the 4th option that I tried.
    Code:
    URL: https://www.youtube.com/watch?v=o6csW0D2eS0
    ----------------------
    Available operations:
    ----------------------
    .
    1. Best already on site
    2. Best Audio and Best Video
    3. Best (no merge)
    4. Best MP4 and M4A
    5. Best MP4 and AAC
    6. MP3 (Audio)
    7. AAC (Audio)
    8. M4A (Audio)
    -
    f. List all possible formats
    u. Auto-update
    n. Process New File
    x. Quit
    -
    Which operation would you like to do?:4
    Best MP4 and MPa:
    [youtube] o6csW0D2eS0: Downloading webpage
    [youtube] o6csW0D2eS0: Downloading android player API JSON
    [info] o6csW0D2eS0: Downloading 1 format(s): 137+140
    [download] Destination: D:\Downloads\Video\THE METAVERSE WILL UNLEASH IMAGINATION.f137.mp4
    [download] 100% of 182.10MiB in 00:13
    [download] Destination: D:\Downloads\Video\THE METAVERSE WILL UNLEASH IMAGINATION.f140.m4a
    [download] 100% of 6.30MiB in 00:00
    [Merger] Merging formats into "D:\Downloads\Video\THE METAVERSE WILL UNLEASH IMAGINATION.mp4"
    Deleting original file D:\Downloads\Video\THE METAVERSE WILL UNLEASH IMAGINATION.f140.m4a (pass -k to keep)
    Deleting original file D:\Downloads\Video\THE METAVERSE WILL UNLEASH IMAGINATION.f137.mp4 (pass -k to keep)
    [Metadata] Adding metadata to "D:\Downloads\Video\THE METAVERSE WILL UNLEASH IMAGINATION.mp4"
    Here's the code
    Code:
    @ECHO OFF
    
    SET DnBest=--hls-prefer-native --add-metadata -f best
    SET DnBestAudVid=--hls-prefer-native --add-metadata
    SET DnBestUnmerge=--hls-prefer-native --add-metadata -f "bestvideo,bestaudio"
    SET DnBestMP4_MPA=--hls-prefer-native --add-metadata -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best"
    SET DnBestMP4_AAC=--hls-prefer-native --add-metadata -f "bestvideo[ext=mp4]+bestaudio[ext=aac]/best[ext=mp4]/best"
    SET DnMP3=--write-all-thumbnails --hls-prefer-native --add-metadata --embed-thumbnail -f bestaudio/best -x --audio-quality 1 --audio-format mp3
    SET DnAAC=--write-all-thumbnails --hls-prefer-native --add-metadata --embed-thumbnail -f bestaudio/best -x --audio-quality 1 --audio-format aac
    SET DnM4A=--write-all-thumbnails --hls-prefer-native --add-metadata --embed-thumbnail -f bestaudio/best -x --audio-quality 1 --audio-format m4a
    
    SET Destination="D:\Downloads\Video/%%(title)s.%%(ext)s"
    
    if not -%1-==-- SET URL=%*
    if -%1-==-- goto fopNew
    
    :top
    CLS
    ECHO URL: %URL%
    ECHO ----------------------
    ECHO Available operations:
    ECHO ----------------------
    ECHO .
    ::This prints the list of the operations
    
    ECHO 1. Best already on site
    ECHO 2. Best Audio and Best Video
    ECHO 3. Best (no merge)
    ECHO 4. Best MP4 and M4A
    ECHO 5. Best MP4 and AAC
    ECHO 6. MP3 (Audio)
    ECHO 7. AAC (Audio)
    ECHO 8. M4A (Audio)
    ECHO -
    ECHO f. List all possible formats
    ECHO u. Auto-update
    ECHO n. Process New File
    ECHO x. Quit
    ECHO -
    
    ::Ask the user to choose the operation they want
    
    SET /P operation=Which operation would you like to do?:
    if "%operation%"=="n" goto fopNew
    if "%operation%"=="N" goto fopNew
    if "%operation%"=="1" goto fop1
    if "%operation%"=="2" goto fop2
    if "%operation%"=="3" goto fop3
    if "%operation%"=="4" goto fop4
    if "%operation%"=="5" goto fop5
    if "%operation%"=="6" goto fop6
    if "%operation%"=="7" goto fop7
    if "%operation%"=="8" goto fop8
    if "%operation%"=="f" goto fopFormat
    if "%operation%"=="F" goto fopFormat
    if "%operation%"=="u" goto fopUpdate
    if "%operation%"=="U" goto fopUpdate
    goto fopQuit
    
    
    :fop1
    ECHO Best:
    ytdlp.exe %DnBest% -o %Destination% %URL%
    pause
    goto top
    
    :fop2
    ECHO Best Audio and Best Video:
    ytdlp.exe %DnBestAudVid% -o %Destination% %URL%
    pause
    goto top
    
    :fop3
    ECHO Best No Merge:
    ytdlp.exe %DnBestUnmerge% -o %Destination% %URL%
    pause
    goto top
    
    :fop4
    ECHO Best MP4 and MPa:
    ytdlp.exe %DnBestMP4_MPA% -o %Destination% %URL%
    pause
    goto top
    
    :fop5
    ECHO Best MP4 and AAC:
    ytdlp.exe %DnBestMP4_AAC% -o %Destination% %URL%
    pause
    goto top
    
    :fop6
    ECHO MP3:
    ytdlp.exe %DnMP3% -o %Destination% %URL%
    pause
    goto top
    
    :fop7
    ECHO AAC:
    ytdlp.exe %DnAAC% -o %Destination% %URL%
    pause
    goto top
    
    :fop8
    ECHO M4A:
    ytdlp.exe %DnM4A% -o %Destination% %URL%
    pause
    goto top
    
    :fopFormat
    ECHO List of all possible formats:
    ytdlp.exe -F %URL%
    pause
    goto top
    
    :fopUpdate
    ECHO Updates:
    ytdlp.exe -U
    pause
    goto top
    
    :fopNew
    SET /P URL=Please enter the video URL:
    goto top
    
    :fopQuit
    Quote Quote  
  8. Member
    Join Date
    Sep 2006
    Location
    United States
    Search Comp PM
    [ss]vegeta,

    Works great. Thank you so much !!

    creakndale
    Quote Quote  
  9. Member
    Join Date
    Sep 2006
    Location
    United States
    Search Comp PM
    Hi. Back again hoping for some help with WinSpirit's .bat file with later versions of yt-dlp.
    Per [SS]vegeta's post... when a new version of yt-dlp.exe is released, I've been replacing the older version with the later version. This has worked great through the 2023-12-30 version of yt-dlp. Starting with yt-dlp version release 2024-03-10 through the current 2024-07-09 version, when running the .bat file and paste the url the program just hangs. I've continued using the old 2023-12-30 version but now when it runs it gives error messages and aborts.
    Has anyone run into this and know of a solution?

    creakndale
    Quote Quote  
  10. First, the link suggested by lomero is recommended more than this script.

    I have implemented some very minor changes as the original script mostly still works. Challenge for the operator may be the usage of ytdlp as opposed to the correct name of yt-dlp.

    Code:
    @echo off
    echo+
    
    title %cd%\%0 
    
    rem set DnBest=--no-warnings --hls-prefer-native --add-metadata -f best
    set DnBest=--no-warnings
    set DnBestAudVid=--no-warnings --hls-prefer-native --add-metadata
    set DnBestUnmerge=--no-warnings --hls-prefer-native --add-metadata -f "bestvideo,bestaudio"
    set DnBestMP4_MPA=--no-warnings --hls-prefer-native --add-metadata -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best"
    set DnBestMP4_AAC=--no-warnings --hls-prefer-native --add-metadata -f "bestvideo[ext=mp4]+bestaudio[ext=aac]/best[ext=mp4]/best"
    set DnMP3=--no-warnings --write-all-thumbnails --hls-prefer-native --add-metadata --embed-thumbnail -f bestaudio/best -x --audio-quality 1 --audio-format mp3
    set DnAAC=--no-warnings --write-all-thumbnails --hls-prefer-native --add-metadata --embed-thumbnail -f bestaudio/best -x --audio-quality 1 --audio-format aac
    set DnM4A=--no-warnings --write-all-thumbnails --hls-prefer-native --add-metadata --embed-thumbnail -f bestaudio/best -x --audio-quality 1 --audio-format m4a
    
    set Destination=%USERPROFILE%\Downloads\Video/%%(title)s.%%(ext)s
    
    rem https://forum.videohelp.com/threads/388113-Simple-Youtube-dl-Bat-file-for-easy-download
    
    if not -%1-==-- set url=%*
    if -%1-==-- goto fopNew
    
    :top
    
    cls
    
    echo+
    echo File Name : %~n0
    
    
    echo+
    echo url : %url%
    echo+
    
    echo ----------------------
    echo Available operations:
    echo ----------------------
    echo .
    
    ::This prints the list of the operations
    
    echo 1. Best already on site
    echo 2. Best Audio and Best Video
    echo 3. Best (no merge)
    echo 4. Best MP4 and M4A
    echo 5. Best MP4 and AAC
    echo 6. MP3 (Audio)
    echo 7. AAC (Audio)
    echo 8. M4A (Audio)
    echo -
    echo f. List all possible formats
    echo u. Auto-update
    echo n. Process New File
    echo x. Quit
    echo -
    
    rem goto end
    
    ::Ask the user to choose the operation they want
    
    set /p operation=Which operation would you like to do?
    if "%operation%"=="n" goto fopNew
    if "%operation%"=="N" goto fopNew
    if "%operation%"=="1" goto fop1
    if "%operation%"=="2" goto fop2
    if "%operation%"=="3" goto fop3
    if "%operation%"=="4" goto fop4
    if "%operation%"=="5" goto fop5
    if "%operation%"=="6" goto fop6
    if "%operation%"=="7" goto fop7
    if "%operation%"=="8" goto fop8
    if "%operation%"=="f" goto fopFormat
    if "%operation%"=="F" goto fopFormat
    if "%operation%"=="u" goto fopUpdate
    if "%operation%"=="U" goto fopUpdate
    goto fopQuit
    
    :fop1
    echo+
    echo Best:
    echo+
    yt-dlp %DnBest% -o %Destination% %url%
    echo+
    pause
    goto top
    
    :fop2
    echo+
    echo Best Audio and Best Video:
    echo+
    yt-dlp %DnBestAudVid% -o %Destination% %url%
    echo+
    pause
    goto top
    
    :fop3
    echo+
    echo Best No Merge:
    echo+
    yt-dlp %DnBestUnmerge% -o %Destination% %url%
    echo+
    pause
    goto top
    
    :fop4
    echo+
    echo Best MP4 and MPa:
    echo+
    yt-dlp %DnBestMP4_MPA% -o %Destination% %url%
    echo+
    pause
    goto top
    
    :fop5
    echo+
    echo Best MP4 and AAC:
    echo+
    yt-dlp %DnBestMP4_AAC% -o %Destination% %url%
    echo+
    pause
    goto top
    
    :fop6
    echo+
    echo MP3:
    echo+
    yt-dlp %DnMP3% -o %Destination% %url%
    echo+
    pause
    goto top
    
    :fop7
    echo+
    echo AAC:
    echo+
    yt-dlp %DnAAC% -o %Destination% %url%
    echo+
    pause
    goto top
    
    :fop8
    echo+
    echo M4A:
    echo+
    yt-dlp %DnM4A% -o %Destination% %url%
    echo+
    pause
    goto top
    
    :fopFormat
    echo+
    echo List of all possible formats:
    echo+
    yt-dlp --no-warnings --quiet -F %url%
    echo+
    pause
    goto top
    
    :fopUpdate
    echo+
    echo Updates:
    echo+
    yt-dlp -U
    pause
    goto top
    
    :fopNew
    set /p url=Please enter the video url:
    goto top
    
    :fopQuit
    
    :end
    echo+
    echo Program Complete
    echo+
    
    pause
    Quote Quote  
  11. I have another simple script for downloading free materials from YouTube.


    @echo off
    set /p "url=Enter the URL of the video: "
    yt-dlp -F %url%
    set /p "video_id=Enter the video format ID: "
    set /p "audio_id=Enter the audio format ID: "
    yt-dlp -f %video_id%+%audio_id% %url%
    echo Download complete.
    pause
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!