Skip to content

This repo provides a GUI program to compress various kinds of media, while minimizing the loss to quality.

Notifications You must be signed in to change notification settings

PeteJobi/CompressMedia

Repository files navigation

Compress Media

This repo provides a GUI for compressing media files of various types, while minimizing the loss to quality. Only supports Windows 10 and 11 (not tested on other versions of Windows). Powered by FFMPEG.

Screenshot (277)

How to build

You need to have at least .NET 9 runtime installed to build the software. Download the latest runtime here. If you're not sure which one to download, try .NET 9.0 Version 9.0.203

In the project folder, run the below

dotnet publish -c Release -p:Platform=x64 -p:WindowsAppSDKSelfContained=true -p:WindowsPackageType=None

When that completes, go to \bin\Release\net<version>-windows\win-x64 and you'll find the CompressMedia.exe.

Run without building

You can also just download the release builds if you don't wish to build manually. Unfortunately packages created in WinUI 3 have to be signed with a certificate, and certificates sourced from trusted companies cost hundreds of dollars. If you wish to install the package, you'll have to install a certificate signed by myself, as described here. You only need to do this once - future updates will not require different certificates.

How to use

When you open the program, you will be prompted to upload a media file. Once that is done, you will be taken to the compress interface page. The file types supported are mp4, mkv, mov, avi, mp3, wav, jpg, jpeg, png and gif. The available compression methods vary by file type. Click one of the radio buttons to select a compression method. All methods are explained below:

  • Target File Size: This option is available for video and audio files. It reduces the file size by reducing the bitrate so the file size roughly matches the target. It's possible for the output file size to overshoot the target specified. If you must avoid that, tick the Don't exceed target box. But this is not recommended, as the encoding may be less efficient and you'll get a worse quality.
  • Target Bitrate: This option is available for video and audio files. It reduces the file size by reducing the bitrate to the specified target. For audio files, you only have a fixed set to choose from: 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 kb/s. Any options that are higher than the original bitrate are excluded. For video files, you can enter any bitrate, and you also have the option to make the program not to exceed the target.
  • Target Resolution: This option is available for video, image and gif files. It reduces the file size by reducing the resolution. The options available to choose from are 144, 360, 480, 720, 1080, 1440 and 2160p. Any options that are higher than the original resolution are excluded. There is also a "custom" option if you want a resolution that's not among the available options. If you select that, you are able to enter any value for the width or height, and when you enter either one of them, the other is automatically adjusted to keep the aspect ratio.
  • Target Frame Rate: This options is available for video and gif files. It reduces the file size by reducing the frames per second the file contains. The options available are 1, 5, 10, 15, 24, 30, 50, 60, 72, 90, 100, 120, 144, 200 and 240 fps. Any options that are higher than the original frame rate are excluded.
  • Constant Rate Factor (CRF): This option is available for video files. It reduces the file size by aiming for a consistent quality level across the video rather than a fixed bitrate. Complex, detail-rich scenes will use more bits, while simple or static scenes will use less. The result is that bits are saved in scenes that don't need them. The bitrate of the resulting file is variable and not constant unlike when you use the Target bitrate option. The range available to choose from for CRF is 10 to 40, and the default is 25 (this default is constant and does not depend on the input file). Lower CRF values mean higher quality and larger files, while higher CRF values mean stronger compression and smaller files. There's also the Preset options which are fast, medium and slow. The default is medium. fast option means it'll take a shorter time to encode the file, but it won't be as efficient and you'll get a larger file for the same CRF value. slow option means it'll take a longer time to encode, but it will be more efficient and you'll get a smaller file for the same CRF value. CRF is a more efficient method than Target File Size or Target Bitrate to compress video files, but it's not possible to predict file size from a given CRF value. If you care more about quality than the file size, then experiment with the available range of CRF values until you get your preferred output file size.
  • Audio Rate (AR): This option is available for audio files. It reduces file size by reducing the audio sampling rate. The options available are 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100 and 48000 kHz. Any options that are higher than the original frame rate are excluded. Note that this method isn't a very effective way to reduce audio file size, particularly for mp3 files.
  • Quality Factor (QA): This option is available for audio files. It reduces the file size by aiming for a consistent quality level across the audio rather than a fixed bitrate. Complex audio passages will use more bits, while simpler passages will use fewer. The result is that bits are saved in passages that don't need them. The bitrate of the result is variable bitrate (VBR) and not constant unlike when you use the Target bitrate option. The range available to choose from is 0 to 9, and the default is 2 (this default is constant and does not depend on the input file). Lower values mean higher quality and larger files; higher values mean stronger compression and smaller files. Quality Factor is a more efficient method than Target File Size or Target Bitrate to compress audio files, but it's not possible to predict file size from a given Quality Factor value. If you care more about quality than the file size, then experiment with the available range of values until you get your preferred output file size.
  • Quality Factor (QV): This option is available for jpg image files. It reduces the file size by reducing the compression level for the image. The range available to choose from is 2 to 20, and the default is 5 (this default is constant and does not depend on the input file). Lower values produce higher quality and larger files, while higher values produce stronger compression and smaller files.

When you're done setting up parameters, click the Compress button to start the process. You'll get a bar showing you the progress. The output file will be saved in the same folder as the input file and with the same name but with _"COMPRESSED" appended to it.

About

This repo provides a GUI program to compress various kinds of media, while minimizing the loss to quality.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages