What is the different of h264 and libx264

6,402

There is no encoder named h264. Using -codec:v h264/-c:v h264/-vcodec h264 is just an alias that points to which H.264 encoder is the default.

The default encoder depends on how your ffmpeg was configured, but for most users it will be libx264.

It is recommended to use the name of the specific H.264 encoder you want. This will avoid ambiguity, so you can be sure which encoder you're using. Especially if you are using the same command on different computers or different ffmpeg versions as the default H.264 encoder may be different. For example, use -c:v libx264 instead of -c:v h264.

You can see which encoder is the default with ffmpeg -h encoder=h264. This will list all available H.264 encoders supported by your ffmpeg. The default encoder is listed first.

Note that there is a specific decoder named h264. It is the built-in FFmpeg H.264 decoder. FFmpeg does not have a built-in H.264 encoder: it uses external libraries instead, such as libx264.

Share:
6,402
Med Lexo
Author by

Med Lexo

Updated on September 18, 2022

Comments

  • Med Lexo
    Med Lexo over 1 year

    I notice there is argument available for --enable-encoder=h264,libx264 suppose I am converting the video looselessly Which one default ffmpeg will use? h264 or libx264?

    And how about the quality different beteen this 2? I don't care about file size and speed. Looseless is fast enough, but I care for the quality more

  • pigeonburger
    pigeonburger over 3 years
    And what about when you use h264_qsv for hardware acceleration? Does that just instruct the default h264 encoder to use QuickSync?
  • Elisa Cha Cha
    Elisa Cha Cha over 3 years
    @pigeonburger h264_qsv is a specific encoder. If it is the only H.264 encoder that your ffmpeg supports then it is the default encoder, so using -c:v h264_qsv or -c:v h264 would both result in h264_qsv being used. -c:v h264 is just an alias.