This command takes an input file and transcodes it to H.264 with an .mp4 wrapper, audio is transcoded to AAC. The libx264 codec defaults to a “medium” preset for compression quality and a CRF of 23. CRF stands for constant rate factor and determines the quality and file size of the resulting H.264 video. A low CRF means high quality and large file size; a high CRF means the opposite.
ffmpeg
starts the command
@@ -302,7 +303,9 @@
-c:v libx264
tells FFmpeg to encode the video stream as H.264
-pix_fmt yuv420p
libx264 will use a chroma subsampling scheme that is the closest match to that of the input. This can result in Y′CBCR 4:2:0, 4:2:2, or 4:4:4 chroma subsampling. QuickTime and most other non-FFmpeg based players can’t decode H.264 files that are not 4:2:0. In order to allow the video to play in all players, you can specify 4:2:0 chroma subsampling.
-c:a aac
encode audio as AAC.
- AAC is the codec most often used for audio streams within an .mp4 container.
+ AAC is the codec most often used for audio streams within an .mp4
+ container.
+
-map 0:a
maps all audio tracks (default is first two)
output_file
path, name and extension of the output file
In order to optimize the file for streaming, you can add this preset: