I am using youtube-dl and ffmpeg to create a youtube downloader and converter (for personal use). I am trying to download a video and convert it to MP4.
The problem I have, is that youtube-dl
downloads the video in a variety of formats. Is there a way that I can download the video and then tell FFMPEG
to convert it, not knowing the current file type?
I tried using a *
wild card but that results in an error.
@echo off
title youtube downloader
set /p name= URL:
echo Select a type. (vid/mp3/mp4)
set /p type=
IF /i "%type%"=="vid" goto vid
IF /i "%type%"=="mp3" goto mp3
IF /i "%type%"=="mp4" goto mp4
:vid
youtube-dl %name%
goto commonexit
:mp3
youtube-dl -x --audio-format mp3 %name%
goto commonexit
:mp4
youtube-dl -o video %name%
ffmpeg -i video.* video.mp4 -hide_banner
:commonexit
pause