Snippet: quickly re-encoding video files w/ ffmpeg on Windows

Recently I constantly find myself having to re-encode yt-dlp‘d video files before sending/posting them somewhere.

Here’s a super simple .bat that you can drop in your PATH (along with ffmpeg) to make this fast:

reencode path_to_file optional_crf

For example:
reencode myvid.mp4

Custom encoding quality:
reencode myvid.mp4 30

  • The script transcodes the file to H.264+Opus, appends _x264 to the filename and changes the extension to .mp4.
  • Adjust transcoding quality by providing the CRF after the filename.
    • Useful for tweaking the file size, eg. when you’re trying to fit under Discord’s 8MB attachment size limit.
    • If you omit this argument, the default value is 23.
    • Values in the range of 17-28 give good results, but the full range is 0-51, where 0 is lossless and 51 is loss…ful.
  • You can also switch the encoding -preset to match your personal patience level.
  • See this H.264 encoding guide for a nice summary of all available settings.