FFmpeg - Drag and drop encoding

FFMPEG, video, Admin Blog

I have installed FFmpeg, but there are too many option settings and I don't know how to set them. I know the settings, but it's too much trouble to encode one file at a time with commands. In such a case, it is convenient to create a batch file like the following, so that you can encode video files by just dragging and dropping them.

In order to use this batch, you need to use "Windows PC". You also need to useVideo compression(FFmpeg setup and encoding procedure)You must place ffmpeg on the execution path according to the

Just drag the video to the .bat as below to encode it.
You can drag multiple files together. And the file name after encoding is automatically set according to the original file name.

Batch file for encoding

The second and third batches are excellent for resizing, but depending on the aspect ratio of the original video, the height may be odd and cannot be encoded.

Reduce capacity while maintaining size(↓Click to download)
https://quizgenerator.net/wp-content/uploads/bat/ffmpeg-noresize.bat

Reduced capacity to standard definition for learningBOX - 640 wide(Ibid.)
https://quizgenerator.net/wp-content/uploads/bat/ffmpeg-640.bat

Reduced capacity to high quality video plan of learningBOX - width 1280(Ibid.)
https://quizgenerator.net/wp-content/uploads/bat/ffmpeg-1280.bat

Batch File Description

The following code is from ffmpeg-1280.bat; the lines starting with ffmepg are the body.
-vf scale=1280:-2
* The size of the video is specified. The width is 1280 and the height is automatic. -2 is specified, it will be adjusted to be a multiple of 2.
-crf 22
* This is the picture quality setting. The larger the value, the worse the picture quality becomes (the capacity decreases).
-r 30
* Specifies the frame rate. If you specify a larger value, the video will be smoother (the capacity will increase).
-ac 1
* This is the specification of monauralization of audio. If monaural is good, this specification will reduce the capacity.

ECHO OFF

ECHO OFF :REPEAT
ffmpeg.exe -i %1 -vcodec libx264 -vf scale=1280:-2 -crf 22 -r 30 -y -ac 1 "%~n1.w1280.mp4"

if "%~2"=="" GOTO EXIT
shift
GOTO REPEAT
GOTO REPEAT :EXIT
pause

revision history

  • 2018.1.19 First published.
  • 2018.4.2 Changed height specification from -1 to -2 / Changed to -2 because there was an error depending on the video size
  • en_USEN