Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- set bitrate=128
- if "%~1"=="" goto :help
- set "file=%~1"
- set "image=%~2"
- if not exist "%image%" goto :set_cover
- goto :webm
- :help
- echo Usage: %0 SONG [IMAGE]
- goto :quit
- :set_cover
- ffmpeg -y -i "%file%" -an -vcodec copy "tmp.cover.jpg"
- if exist "tmp.cover.jpg" (
- set "image=tmp.cover.jpg"
- ) else (
- set "image=cover.jpg"
- )
- :webm
- for %%f in ( "%file%" ) do (
- set filename=%%~nf
- )
- ffprobe "%file%" 2>1.fftmp
- findstr /ric:" *TITLE *: " 1.fftmp >2.fftmp
- set /p title=<2.fftmp
- set "title=%title:~22%"
- if exist "%image%" (
- ffmpeg -i "%image%" -i "%file%" -c:v libvpx-vp9 -crf 20 -vf scale=-1:480 -pix_fmt yuv420p -c:a libopus -b:a %bitrate%K -f webm -metadata title="%title%" "%filename%.webm"
- ) else (
- ffmpeg -i "%file%" -c:v libvpx-vp9 -crf 20 -vf scale=-1:480 -pix_fmt yuv420p -c:a libopus -b:a %bitrate%K -f webm -metadata title="%title%" "%filename%.webm"
- )
- del *.fftmp
- if exist tmp.cover.jpg (
- del tmp.cover.jpg
- )
- :quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement