Advertisement
OgreVorbis

Batch Convert Strip Audio from Static Video

Apr 24th, 2025
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.48 KB | None | 0 0
  1. *****************************************************************************************************
  2. * THIS BATCH FILE WILL CONVERT .MP4 VIDEOS INTO HIGHLY COMPRESSED, BUT GREAT SOUNDING AUDIO FILES.  *
  3. * IT IS TO BE USED IF MAYBE YOU WATCH VIDEO FORMAT PODCASTS THAT DONT NEED THE VIDEO OR OTHER       *
  4. * SITUATIONS WHERE THERE IS A POINTLESS STATIC VIDEO OF AN AUDIO RECORDING. USE THIS BATCH FILE     *
  5. * ALONG WITH FFMPEG +++ YOU MUST HAVE FFMPEG +++ TO EXTRACT THE AUDIO AND DISCARD THE VIDEO.        *
  6. *****************************************************************************************************
  7. (REMOVE ABOVE AND INCLUDING THIS - DUH!)
  8.  
  9. @echo off
  10. setlocal enabledelayedexpansion
  11.  
  12. :: Check for required parameters
  13. if "%~1"=="" (
  14.     echo Please provide the source directory as the first parameter.
  15.     echo Example: convert-to-ogg.bat "C:\Input" "C:\Output"
  16.     exit /b 1
  17. )
  18.  
  19. if "%~2"=="" (
  20.     echo Please provide the target directory as the second parameter.
  21.     echo Example: convert-to-ogg.bat "C:\Input" "C:\Output"
  22.     exit /b 1
  23. )
  24.  
  25. set "SOURCE_DIR=%~1"
  26. set "TARGET_DIR=%~2"
  27.  
  28. :: Create the target directory if it doesn't exist
  29. if not exist "%TARGET_DIR%" (
  30.     mkdir "%TARGET_DIR%"
  31. )
  32.  
  33. :: Process each .mp4 file in the source directory
  34. for %%F in ("%SOURCE_DIR%\*.mp4") do (
  35.     set "FILENAME=%%~nF"
  36.     echo Converting: %%F
  37.     ffmpeg -i "%%F" -vn -acodec libvorbis -ac 1 -aq 1 "%TARGET_DIR%\!FILENAME!.ogg"
  38. )
  39.  
  40. echo.
  41. echo Done converting all files.
  42. pause
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement