8

FFmpeg is now supporting 10-bit and 12-bit encoding for x265, But I couldn't find the proper command line options for encode them in those bit depths.

Can someone specify that options?

1 Answer 1

11

If you have an appropriately configured modern version of FFmpeg and x265, (the repository FFmpeg under Zesty Zapus 17.04 falls into this category), you should find encoding with 8, 10 and 12bit fairly straightforward.

I illustrate a sample command line for each below:

1. 8bit HEVC encoding with FFmpeg...

Check the capability of your installed version of x265 for 8bit encoding as follows:

andrew@illium~$ x265 -V
x265 [info]: HEVC encoder version 2.4
x265 [info]: build info [Linux][GCC 7.1.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA4 FMA3 LZCNT BMI1
andrew@illium~$ 

Here you will see that my own copy has capabilities for 8|10|12 bit encoding. An installation of FFmpeg compiled against this version of x265 can produce a decent 8bit encode with the following command:

ffmpeg -i input.mp4 \
       -c:v libx265 -preset medium -crf 28 -pix_fmt yuv420p \
       -c:a aac -b:a 128k \
       output_8bit.mp4

You can of course vary any of these settings to suit your specific needs...

2. 10bit HEVC encoding with FFmpeg...

Check the capability of your installed version of x265 for 10bit encoding as follows:

andrew@illium~$ x265 -V -D10
x265 [info]: HEVC encoder version 2.4
x265 [info]: build info [Linux][GCC 7.1.0][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA4 FMA3 LZCNT BMI1
andrew@illium~$ 

Here you will see that my own copy has capabilities for 10 bit encoding. An installation of FFmpeg compiled against this version of x265 can produce a decent 10bit encode with the following command:

ffmpeg -i input.mp4 \
       -c:v libx265 -preset medium -crf 28 -pix_fmt yuv420p10le \
       -c:a aac -b:a 128k \
       output_10bit.mp4

And this should see you through...

3. 12bit HEVC encoding with FFmpeg...

Check the capability of your installed version of x265 for 12bit encoding as follows:

andrew@illium~$ x265 -V -D12
x265 [info]: HEVC encoder version 2.4
x265 [info]: build info [Linux][GCC 7.1.0][64 bit] 12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA4 FMA3 LZCNT BMI1
andrew@illium~$ 

Here you will see that my own copy has capabilities for 12bit encoding. An installation of FFmpeg compiled against this version of x265 can produce a decent 12bit encode with the following command:

ffmpeg -i input.mp4 \
       -c:v libx265 -preset medium -crf 28 -pix_fmt yuv420p12le  \
       -c:a aac -b:a 128k \
       output_12bit.mp4

Once again experimentation with some of the ancillary parameters should give you exactly the results you are after...

Notes:

  1. If you are unsure of which pixel formats (for the vital -pix_fmt FFmpeg setting) are supported by your copy of FFmpeg and libx265 the following command will show the details:

     ffmpeg -h encoder=libx265 2>/dev/null | grep pixel 
    
  2. FFmpeg and H.265 Encoding Guide: Base information on HEVC encoding with FFmpeg, nothing on 8|10|12 bit encoding though...

  3. Zesty Zapus (17.04) has a slightly older but fully configured x265:

      andrew@ilium:~$ x265 -V
      x265 [info]: HEVC encoder version 2.3
      x265 [info]: build info [Linux][GCC 6.3.0][64 bit] 8bit+10bit+12bit
      x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX LZCNT
      andrew@ilium:~$ 
    

    and thus can encode to all 3 possible bit depths...

5
  • A quick shortcut to see bit depths that the compiled libx265 supports, is to run ffmpeg -h encoder=libx265 | grep pixel. My build has Supported pixel formats: yuv420p yuv422p yuv444p gbrp yuv420p10le yuv422p10le yuv444p10le gbrp10le yuv420p12le yuv422p12le yuv444p12le gbrp12le gray gray10le gray12le
    – Gyan
    Jun 6, 2017 at 9:14
  • @Mulvya That is great! I have added this into my answer, thanks :)
    – andrew.46
    Jun 6, 2017 at 9:38
  • 10-bit HEVC works perfectly by ubuntu zesty default packages. Jun 6, 2017 at 13:39
  • @DanialBehzadi Great to hear! What about 8 and 12 bit? I have not tested on Zesty with defaults...
    – andrew.46
    Jun 6, 2017 at 21:31
  • @andrew.46 8-bit is default and works out of the box. I could encode 12-bits, but I was unable to decode it with Totem (Not supported) or VLC (Green Screen, but voice works). Jun 7, 2017 at 11:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .