
IOS 11 and OSX 11 now support HEVC playback, but you have to make sure you use FFmpeg 3.4 or higher, and then add -tag:v hvc1 to your encode, or else you won't be able to play the video on your Apple device.įor VP9 we have to change both the video and the audio codec, as well as the file extension of the ouput video. 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.

