2017-04-18 72 views
1

我正在使用该命令行使用VLC从YouTube上下载MP4视频的批处理脚本。对我来说它工作的很好!使用命令行使用VLC从YouTube下载视频

@echo off 
REM Downloading a video from youtube using VLC with the command line by (c) Hackoo 2017 
Title Si Lemhaf - Kharrej Legrinta Elli Fik by (c) Hackoo 2017 
mode con:cols=65 lines=3 & COLOR 0E 
Taskkill /IM "vlc.exe" /F >nul 2>&1 
echo. 
echo  Please wait a while ... The download is in progress ... 
set Title=Si Lemhaf - Kharrej Legrinta Elli Fik by (c) Hackoo 2017 
set "VLC_URL=http://www.videolan.org/vlc/download-windows.html" 
set "URL=https://www.youtube.com/watch?v=KDI1C27zEC0" 
set "File=SiLmehaf.mp4" 

IF /I "%PROCESSOR_ARCHITECTURE%"=="x86" (
     Set "vlc=%ProgramFiles%\VideoLAN\VLC\vlc.exe" 
    ) else (
     Set "vlc=%ProgramFiles(x86)%\VideoLAN\VLC\vlc.exe" 
) 

If Not Exist "%vlc%" (
    Cls & COLOR 0C 
    echo. 
    Echo  "The VLC program is not installed on your system" 
    TimeOut /T 5 /NoBreak>nul 
    Start "" %VLC_URL% 
    Exit 
) 

"%vlc%" -vvv "%URL%" --qt-start-minimized --qt-notification=0 --sout=#transcode{vcodec="h264",vb="512",fps="23.97",scale="1",acodec="mpga",ab="128","channels=2",samplerate="44100"}:standard{access="file",mux=mp4,dst=%File%} vlc://quit" 
REM Starting the video in fullscreen with VLC 
Start "" "%vlc%" -f --meta-title="%Title%" %File% 

但是,我的问题是为什么一些来自Youtube的URL不工作? 像这样的:

https://www.youtube.com/watch?v=TGtWWb9emYI 

我是从VLC程序此错误

不能识别输入媒体的格式

+1

我最好的猜测是,特定的视频要么没有上传为MP4,或VEVO有某种形式的副本保护它。 – SomethingDark

回答

2

因为该视频的拥有者:https://www.youtube.com/watch?v=TGtWWb9emYIturn off the embedding ,你不能用vlc下载它。您的代码工作正常,如果您从vlc programm >> Media >>流式传输YouTube视频,打开捕获设备并通过您的Url,您将收到错误消息。

还试图下载YouTube视频的时候yturls脚本会显示以下错误:

YouTubeAPIError: This video contains content from VEVO. It is restricted 
from playback on certain sites or applications.