问题描述
有一个bash / batch文件脚本:
There is a bash/batch file script:
ffmpeg -i `youtube-dl https://www.twitch.tv/zero` -vf fps=fps=60, scale=1920x1080 -c:v libx264 -b:v 500k -preset superfast -c:a copy -f segment -segment_time 60 test.mp4
该脚本不是我的,但允许您录制视频零件的帧速率恒定。不幸的是,在cmd中它不适用于我。已经尝试了一切,我不知道错误是什么。
The script is not mine, but it allows you to record video with a constant frame rate of parts. Unfortunately in cmd it does not work for me. Already tried everything, I do not know what the error is.
我正在得到没有这样的文件或目录
。
尝试'youtube-dl https://www.twitch.tv/zero'
,出现相同的错误
我尝试了 youtube-dl https://www.twitch.tv/zero
,错误: youtube-dl https://www.twitch.tv/zero:无效的参数
我在做什么错?作者保证他在Linux上工作
What am I doing wrong? The author assures that he works on linux
更新
我尝试了 ffmpeg -i $(youtube-dl -f best -g https://www.twitch.tv/zero)....
相同的错误
更新2
为什么视频大小超过500 Mb?我在做什么错了?
Why the video size exceeds 500 Mb? What am I doing wrong?
代码
cls && @echo off & setlocal enableextensions enabledelayedexpansion
set "_tag_00=https://www.twitch.tv/avagg"
set "_tag_01=--ignore-errors --abort-on-error --ignore-config --flat-playlist --geo-bypass "
set "_tag_02=--restrict-filenames --no-part --no-cache-dir --write-thumbnail --prefer-ffmpeg "
set "_tag_03=--ffmpeg-location .\ --postprocessor-args -i "%%(title)s.%%(ext)s" -vf fps^=fps^=60^,"
set "_tag_04=scale^=1920x1080 -c:v libx264 -b:v 500k -preset superfast -c:a copy -f segment -segment_time "
set "_tag_05=60 %%^(title^)s.mp4"
youtube-dl "!_tag_00!" -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!
Pause
更新3
推荐答案
请支付注意,请注意以下一些要点:
- 因此,如果我真的了解您的问题,以及它与Windows中的批处理文件/ cmd有关,您需要将路径放在
ffmpeg.exe
变量,以便youtube-dl
找到它即可。 - 或者,在上面的示例中,相同的路径和变量参数工具,因此youtube-dl amd
ffmepg.exe
位于同一文件夹/路径=.\\
。 - 此
- 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 toyoutube-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:
我将按名称保存此代码 yt-DL .cmd
I’ll save this code by name yt-DL.cmd
仅通过以下方式复制特定时间:仅编辑 _tag_1
值: -t 00:60:00
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
副本完整视频,作者:
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
这篇关于如何从youtube-dl转换脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!