
To tanscode to H.265/HEVC instead, all we do is change libx264 to libx265: ffmpeg -i input.mp4 -c:v libx265 -b:v 15M -pix_fmt yuv420p -c:a aac -b:a 192K output.mp4 However, a more reasonable example, which includes setting an audio codec, setting the pixel format and both a video and audio bitrate, would be: ffmpeg -i input.mp4 -c:v libx264 -b:v 30M -pix_fmt yuv420p -c:a aac -b:a 192K output.mp4 The simplest example to transcode an input video to H.264: ffmpeg -i input.mp4 -c:v libx264 output.mp4
-t sets the time or duration of the output. -ss seeks to the given timestamp in the format HH:MM:SS. -map allows you to specify streams inside a file. -pix_fmt sets the pixel format of the output video, required for some input files and so recommended to always use and set to yuv420p for playback. -r sets the frame rate of the output video. -vf sets so called video filters, which allow you to apply transformations on a video like scale for changing the resolution and setdar for setting an aspect ratio. -b:a sets the audio bitrate of the output video. Options include aac for use in combination with H.264 and H.265/HEVC, libvorbis for VP9, and copy if you want to preserve the audio codec of the input video -c:a sets the audio codec you want to use. -b:v sets the video bitrate, use a number followed by M to set value in Mbit/s, or K to set value in Kbit/s. Options include libx264 for H.264, libx265 for H.265/HEVC, libvpx-vp9 for VP9, and copy if you want to preserve the video codec of the input video -c:v sets the video codec you want to use. -i is follwed by the path to the input video.
ffmpeg calls the FFmpeg application in the command line window, could also be the full path to the FFmpeg binary or.
That's why I decided to create this cheat sheet which shows some of the most often used commands. FFmpeg is one of the most powerful tools for video transcoding and manipulation, but it's fairly complex and confusing to use.