I'm making this batch script to download a video in MP4 from youtube using VLC with the command line. and it works fine for me !
@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%
But, my problem is why some URLs from Youtube dosen't work ? like this one :
https://www.youtube.com/watch?v=TGtWWb9emYI
I got this error from VLC program
Can not recognize the format of the input media
Because the owner of this video : https://www.youtube.com/watch?v=TGtWWb9emYI
has turn off the embedding , you cannot download it with vlc . Your code work fine ,If you stream the youtube video from vlc programm >> Media >> Open capture device and past your Url , you will get an error.
Also the yturls
script will display the following error when trying to download the Youtube video:
YouTubeAPIError: This video contains content from VEVO. It is restricted
from playback on certain sites or applications.