Skip to content

Instantly share code, notes, and snippets.

@djibe
Last active November 10, 2024 18:09
Show Gist options
  • Save djibe/663816265eebea352e644b47bfa0a1b2 to your computer and use it in GitHub Desktop.
Save djibe/663816265eebea352e644b47bfa0a1b2 to your computer and use it in GitHub Desktop.
ffpeg : Encode all video files in folders
FOR /F "tokens=*" %%G IN ('dir /b *.avi')
DO ffmpeg.exe -hide_banner -i "%%G" -acodec aac -b:a 128k -ac 2 -strict -2 -c:v libx265 -crf 22 -filter:v "scale=1280:-2,unsharp=5:5:1.0:5:5:0.0" -sws_flags lanczos -b:v 1024k -profile:v main -preset medium -tune film -async 1 -vsync 1 "%%~nG.mp4"

for %i in (*.mp4) do ffmpeg -i "%i" "%~ni.mp3"

https://stackoverflow.com/questions/5784661/how-do-you-convert-an-entire-directory-with-ffmpeg
for PRESET in $(seq 7 -1 5); do for CRF in "$(seq 35 -5 20)"; do ffmpeg -probesize 9223372036854775807 -analyzeduration 9223372036854775807 -fflags +genpts+igndts -i in.mkv -map 0 -c:v libsvtav1 -crf "${CRF}" -preset "${PRESET}" -svtav1-params:v:0 enable-overlays=1:enable-tf=0:fast-decode=0:film-grain=0:film-grain-denoise=0:keyint=120:scd=1:tune=0 -c:a libopus -b:a "" -vbr on -mapping_family 1 -filter:a aformat=channel_layouts="7.1|6.1|5.1|5.0|quad|3.0" -c:s webvtt -map_chapters -1 -map_metadata -1 "out-${CRF}.mkv"; done; done
@djibe
Copy link
Author

djibe commented Jul 5, 2024

WIP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment