Advertisement
gdunc

Checks for free space before remux

Dec 27th, 2022
1,341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.36 KB | None | 0 0
  1. rem pp.cmd
  2. @echo off
  3.  
  4. rem FILESIZE = size in bytes of input file
  5. set FILESIZE=%~z2
  6. rem DESTDRV = destination drive volume, (used to check free space)
  7. set DESTDRV=P:
  8. rem DESTPATH = destination path of remuxed file, (no trailing \)
  9. set DESTPATH=%DESTDRV%\model caps
  10.  
  11. rem Check for enough free space on destination before remux, fail if not
  12. wmic LogicalDisk where "DeviceID='%DESTDRV%' and FreeSpace > %FILESIZE%" get DeviceID 2>&1 | find /i "%DESTDRV%" >nul || exit 1
  13. ffmpeg -i "%~2" -y -c:v copy -c:a copy -bsf:a aac_adtstoasc "%DESTPATH%\%~n2.mp4" && del "%~2"
  14.  
  15. rem Want to create a site\model directory for the recordings?
  16. rem Comment out the line above and uncomment the two below, (change the drive - obviously).
  17.  
  18. rem mkdir "%DESTPATH%\%~3" 2>nul
  19. rem ffmpeg -i "%~2" -y -c:v copy -c:a copy -bsf:a aac_adtstoasc "%DESTPATH%\%~3\%~n2.mp4" && del "%~2"
  20.  
  21. rem '-movflags faststart' not required unless you're going to stream the resultant MP4
  22. rem '&&' indicates following command will only execute if previous was successful
  23. rem '||' indicates following command will only execute if previous command failed
  24.  
  25. rem Args passed as follows for standalone CTBRec
  26. rem directory=%1
  27. rem file=%2
  28. rem model=%3
  29. rem site=%4
  30. rem unixtime=%5
  31.  
  32. rem Learn some DOS commands people, it ain't that hard
  33. rem https://www.robvanderwoude.com/batchstart.php
  34. rem https://www.dostips.com/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement