Advertisement
Guest User

Song 2 Webm

a guest
Apr 6th, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.96 KB | None | 0 0
  1. @echo off
  2. set bitrate=128
  3.  
  4. if "%~1"=="" goto :help
  5. set "file=%~1"
  6. set "image=%~2"
  7. if not exist "%image%" goto :set_cover
  8. goto :webm
  9.  
  10. :help
  11. echo Usage: %0 SONG [IMAGE]
  12. goto :quit
  13.  
  14. :set_cover
  15. ffmpeg -y -i "%file%" -an -vcodec copy "tmp.cover.jpg"
  16. if exist "tmp.cover.jpg" (
  17.     set "image=tmp.cover.jpg"
  18. ) else (
  19.     set "image=cover.jpg"
  20. )
  21.  
  22. :webm
  23. for %%f in ( "%file%" ) do (
  24.     set filename=%%~nf
  25. )
  26.  
  27. ffprobe "%file%" 2>1.fftmp
  28. findstr /ric:" *TITLE *: " 1.fftmp >2.fftmp
  29. set /p title=<2.fftmp
  30. set "title=%title:~22%"
  31.  
  32. if exist "%image%" (
  33.     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"
  34. ) else (
  35.     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"
  36. )
  37.  
  38. del *.fftmp
  39. if exist tmp.cover.jpg (
  40.     del tmp.cover.jpg
  41. )
  42. :quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement