How to convert a script from youtube-dl

后端 未结 1 1881
旧时难觅i
旧时难觅i 2021-01-24 20:31

There is a bash/batch file script:

ffmpeg -i `youtube-dl https://www.twitch.tv/zero` -vf fps=fps=60, scale=1920x1080 -c         


        
相关标签:
1条回答
  • 2021-01-24 20:45

    Please, pay attention to some points below:

    • So, if I really understand your question, and it is about batch file/cmd in Windows, you would need to put the path to ffmpeg.exe in a variable, so it can be accessible to youtube-dl found it.
    • Or, in my sample above, in same path and in variable argument tool, so, youtube-dl amd ffmepg.exe are in same folder/path = .\\.
    • The link in this question, is offline, so I changed this link to an another online:

    I’ll save this code by name yt-DL.cmd

    Copy only a specific time by: Only edit _tag_1 value: -t 00:60:00

       cls && @echo off & setlocal enableextensions enabledelayedexpansion 
    
        :: do some with the bat file, after then,  for all links need `call :_yd_dl` %1
    
        call :_yd_dl %1
        echo/ is done^^!!
    
        goto :eof
    
        :_yd_dl
    
        set "_tag_00=%1"
        set "_tag_01= -t 00:60:00 -v error -stats -vf fps=fps=60,scale=1920x1080 -c:v libx264 -preset superfast -c:a copy "
        for /f %%i in ('.\youtube-dl.exe -g !_tag_00! ^<nul ') do .\ffmpeg.exe  -i "%%i" !_tag_01! .\output.mp4
    
        exit /b 
    

    copy full video by:

      cls && @echo off & setlocal enableextensions enabledelayedexpansion 
    
        :: do some with the bat file, after then,  for all links need `call :_yd_dl` %1
    
        call :_yd_dl %1
        echo/ is done^^!!
    
        goto :eof
    
        :_yd_dl
    
        set "_tag_0=%1"
        set "_tag_1=--ignore-errors --abort-on-error --ignore-config --flat-playlist --geo-bypass "
        set "_tag_2=--restrict-filenames --no-part --no-cache-dir --write-thumbnail --prefer-ffmpeg "
        set "_tag_3=--ffmpeg-location .\ --postprocessor-args  -i "%%(title)s.%%(ext)s" -vf fps^=fps^=60^,"
        set "_tag_4=scale^=1920x1080 -c:v libx264 -b:v 500k -preset superfast -c:a copy -f segment -segment_time "
        set "_tag_5=60 %%^(title^)s.mp4"
    
        youtube-dl "!_tag_0!" -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" -o "%%^(title^)s.%%^(ext^)s" !_tag_1!!_tag_2!!_tag_3!!_tag_4!!_tag_5!
    
        exit /b
    
    0 讨论(0)
提交回复
热议问题