Advertisement
spookymunky

hvec

Oct 5th, 2023
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. pushd "%2"
  2.  
  3. ::Default variables
  4. SET paths=paths.txt
  5. ::paths lets you put a bunch of folder paths in a text file and run this across those, instead of individually. I use this to run overnight on a LOT of footage folders at once. Thanks to Aayla for a lot of these upgrades
  6. ::Fun tip - select your folders (15 max at a time) and shift+right-click and click "copy as paths"
  7. SET /A ffmpeg_qv=26
  8. ::change CQP value here so you only have to type it once. 22 is lossless for HEVC.
  9.  
  10. ::for /R %%A in (*.mp4, *.avi, *.mov, *.wmv, *.ts, *.m2ts, *.mkv, *.mts) do (
  11. :: echo Processing %%A
  12. :: ffmpeg -hwaccel auto -i "%%A" -pix_fmt p010le -map 0:v -map 0:a -c:v hevc_nvenc -rc constqp -qp 21 -b:v 0K -c:a libfdk_aac -vbr 5 -movflags +faststart fps=30 -vf scale=-1:720 "%%A~dnpA_CRF%ffmpeg_qv%_HEVC.mp4"
  13. :: echo Processed %%A
  14. ::)
  15. ::pause
  16. ::Test if the paths file exists and iterate through it
  17. if EXIST %paths% (
  18. for /f "tokens=*" %%a in (%paths%) do (
  19. echo Changing to directory %%a
  20. pushd "%%a"
  21. CALL :ffmpeg
  22. )
  23. ) else (
  24. ::It doesn't exist
  25. CALL :ffmpeg
  26. )
  27. pause
  28. EXIT /B %ERRORLEVEL%
  29. ::Don't run the function when they're first defined because that's a thing Batch does for some reason???
  30. :ffmpeg
  31. for /R %%A in (*.mp4, *.avi, *.mov, *.wmv, *.ts, *.m2ts, *.mkv, *.mts) do (
  32. echo Processing "%%A"
  33. ffmpeg -hwaccel auto -i "%%A" -map 0:v -map 0:a -map_metadata 0 -c:v hevc_nvenc -rc constqp -qp %ffmpeg_qv% -b:v 0K -c:a aac -b:a 128k -movflags +faststart -movflags use_metadata_tags -r 30 -vf scale=-1:720 "%%A~dnpA_CRF%ffmpeg_qv%_HEVC.mp4"
  34. ::"-pix_fmt p010le" is setting it to 10-bit instead of 420 8-bit, which is what I had before
  35. :: "-map_metadata 0" copies all metadata from source file
  36. :: "-movflags +faststart" helps with audio streaming
  37. echo Processed %%A
  38. )
  39. GOTO :EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement