Feb 1, 2018

Using ffmpeg presets in two clicks with windows Send To menu

The first part of FFMPEG lifehack for all video pros. Here you'll find a trick to get ffmpeg into your everyday workflow and to integrate it right into Windows Send To menu in this manner:

It's really easy and efficient way of transcoding your files which offers you better quality and better control of you output videos. You can have pretty many presets and do your conversions it 2 clicks (unfortunately Send To does not support sub menus, I've checked it)

1. You need to download FFMPEG itself from here, it's free. Install it, usually it's path to c:\Program Files\ffmpeg

2. Create a new text file with this text
@echo off
"c:\Program Files\ffmpeg\bin\ffmpeg.exe" -i %1 -c:v libx264 -preset slow -crf 18 -c:a copy %1_output.mp4
pause
Save it, give it a desired name, and give it the extension .bat

3. Put this file to any convenient location for your presets. Create the shortcut for this file (drag + Alt) and place this shortcut file into %userprofile%/SendTo
You can rename it to get rid of Shortcut in the name, just do not change the .lnk extension. You can also change the icon of this shortcut in its file properties, this icon will be used in the Send To menu. If you can not find SendTo folder try search or look into ...\AppData\Roaming\Microsoft\Windows\SendTo

4. So basically you just did it. Now you can right click on any file and navigate to Send To item. You'll find your new preset item there. This .bat file will run ffmpeg to convert whatever you clicked to mp4 h264 video and it will place it into same folder with _output added to your filename.

This particular bat preset creates video of h264 high 4:2:2 L3.1, yuv422p and copies the source audio track into the new file as is. You can keep these presets in your cloud, and your shortcuts can refer to them so if you change your presets the changes are always in sync. You'll probably need to refer to ffmpeg docs to make more presets, but here I'll give you some very basic hints:

1. The bitrate is set by -crf parameter, values are from 0 (lossless) up to 53 (and up to 63 for 10-bit colour), the scale is exponential.
2.  -preset paramter also affects the bitrate
3. -c parameter defines the codec, -c:v for video, -c:a for audio (refer to encoders doc)

There're actually many GUIs for ffmpeg, but unfortunately I wasn't satisfied by any of those and many of them are not free. Using ffmpeg also makes you in charge of keeping your files compatible with your video players and any hardware you're going to use. To avoid such problems use -profile parameter in your presets, the profiles are codec-specific, so you'll definitely have to refer to the codecs docs here (video encoders, audio encoders). Here I'll give a few more .bat file presets I usually use:

h264 mp4 420p constrained to level 3.0 standard (compatible with most software), lower bitrate
@ECHO OFF
IF %1.==. (
ECHO [-------------- SendTo FFmpeg converter ---------------]
ECHO [     NO FILE SPECIFIED                                ]
ECHO [------------------------------------------------------]
) ELSE (
"c:\Program Files\ffmpeg\bin\ffmpeg.exe" -v warning -i %1 -c:v libx264 -profile:v baseline -level 3.0 -pix_fmt yuv420p -preset slow -crf 24 -c:a aac -b:a 128k -y %1_420_constrL3.mp4
ECHO [-------------- SendTo FFmpeg converter ---------------]
ECHO [     SERVED                                           ]
ECHO [------------------------------------------------------]
)
PAUSE
h264 mp4 422p medium quality, slower better compression algo, less compatible
@ECHO OFF
IF %1.==. (
ECHO [-------------- SendTo FFmpeg converter ---------------]
ECHO [     NO FILE SPECIFIED                                ]
ECHO [------------------------------------------------------]
) ELSE (
"c:\Program Files\ffmpeg\bin\ffmpeg.exe" -v warning -i %1 -c:v libx264 -preset slower -crf 16 -pix_fmt yuv422p -c:a copy -y %1_422_medium_slower.mp4
ECHO [-------------- SendTo FFmpeg converter ---------------]
ECHO [     SERVED                                           ]
ECHO [------------------------------------------------------]
)
PAUSE
h264 mp4 422p high quality and better compression algo, less compatible too
@ECHO OFF
IF %1.==. (
ECHO [-------------- SendTo FFmpeg converter ---------------]
ECHO [     NO FILE SPECIFIED                                ]
ECHO [------------------------------------------------------]
) ELSE (
"c:\Program Files\ffmpeg\bin\ffmpeg.exe" -v warning -i %1 -c:v libx264 -preset slower -crf 8 -pix_fmt yuv422p -c:a copy -y %1_422_highest_slower.mp4
ECHO [-------------- SendTo FFmpeg converter ---------------]
ECHO [     SERVED                                           ]
ECHO [------------------------------------------------------]
)
PAUSE