DEV Community

Stanislav Berkov
Stanislav Berkov

Posted on

Snipping tool compressed mp4

Windows Snipping Tool can record screen and product mp4 files, but these files are uncompressed. You need to run external tool to compress them. You can do it with ffmpeg + add "Compress MP4" Windows Explorer context menu item.

Install ffmpeg

Run winget install Gyan.FFmpeg command. It shall install ffmpeg

Run as administrator script

#Requires -RunAsAdministrator

$basePath = "Registry::HKEY_CLASSES_ROOT\SystemFileAssociations\.mp4\shell\CompressMP4"

New-Item -Path $basePath -Force | Out-Null
Set-ItemProperty -Path $basePath -Name "(Default)" -Value "Compress MP4"

$command = 'powershell -NoProfile -Command "$f = ''%1''; $out = $f -replace ''\.mp4$'', ''_compressed.mp4''; ffmpeg -i $f -c:v libx264 -crf 28 -preset medium -c:a aac -b:a 128k $out; pause"'

New-Item -Path "$basePath\command" -Force | Out-Null
Set-ItemProperty -Path "$basePath\command" -Name "(Default)" -Value $command

Write-Host "Added Compress MP4 context menu" -ForegroundColor Green
Enter fullscreen mode Exit fullscreen mode

It shall create context menu item.

Top comments (0)