

For example, the below query will copy the audio ( -c:a copy) from input.mp4 and convert the video to a VP9 codec ( -c:v vp9) with a bit rate of 1M/s ( -b:v), all bundled up in a Matroska container ( output.mp4).įfmpeg -i input.mp4 -c:a copy -c:v vp9 -b:v 1M output.mp4Īnother technique to improve video quality is to use the -r option to change the frame rate.

It’s sometimes difficult to predict what will happen without putting something to the test. In other situations, it may only affect the file size. Changing bitrates can sometimes make a significant impact on subjective quality. The ability of humans to see and hear isn’t as simple and straightforward as we’d like to believe. The most straightforward technique is to alter the bitrate, with -b flag, which may or may not result in a difference in quality. There are a few techniques that influence the quality of a video when it is compressed to a lower size. Using one of the well supported and used libraries will take care of some common issues that you might otherwise encounter - having to load different binaries for different processor types, and some tricky issues with native library reloading to avoid crashes on subsequent invocations of the wrapper.īecause this approach uses the standard ffmpeg cmd line syntax for commands it also means you should be able to search and find help easily on multiple different operations (as anyone using ffmpeg in 'normal' model will use the same syntax for the ffmpeg command itself).Before we dive into the tutorial steps, let's understand how FFmpeg works in general. There are several fairly well used wrappers available on GitHub - the ones below are particularly well featured and documented (note, I have not used these as they were not so mature when I was looking at this previously, but if I was doing something like this again now I would definitely build on one of these): The wrapper approach may be the easiest is you simply want to get the functionality working quickly. Directly use the ffmpeg libraries, or more accurately the libraries that ffmpeg uses.use a wrapper around the ffmpeg command line C program.

