[FFmpeg-user] what's command line to transcode video with libx265 8/10bit

qw applemax82 at 163.com
Thu May 9 14:22:17 EEST 2019


the command of 'ffmpeg -h encoder=libx265' print the following message:

Encoder libx265 [libx265 H.265 / HEVC]:
    General capabilities: delay threads 
    Threading capabilities: auto
    Supported pixel formats: yuv420p yuv422p yuv444p gbrp yuv420p10le yuv422p10le yuv444p10le gbrp10le gray gray10le
libx265 AVOptions:
  -crf               <float>      E..V..... set the x265 crf (from -1 to FLT_MAX) (default -1)
  -forced-idr        <boolean>    E..V..... if forcing keyframes, force them as IDR frames (default false)
  -preset            <string>     E..V..... set the x265 preset
  -tune              <string>     E..V..... set the x265 tune parameter
  -profile           <string>     E..V..... set the x265 profile
  -x265-params       <string>     E..V..... set the x265 configuration using a :-separated list of key=value parameters

I build x265 with bitdepth=10, but ffmpeg fails to do transcoding hevc 10bit into hevc 8bit. Its error message is shown as below:

x265 [error]: main profile not supported, internal bit depth 10.
[libx265 @ 0x4a4dac0] Invalid or incompatible profile set: main.
[libx265 @ 0x4a4dac0] Possible profiles: main main10 mainstillpicture msp main-intra main10-intra main444-8 main444-intra main444-stillpicture main422-10 main422-10-intra main444-10 main444-10-intra main12 main12-intra main422-12 main422-12-intra main444-12 main444-12-intra main444-16-intra main444-16-stillpicture
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

I read x265 source code, and find x265_param_apply_profile() will check profile and bitdepth:

    /* Check if profile bit-depth requirement is exceeded by internal bit depth */
    bool bInvalidDepth = false;
#if X265_DEPTH > 8
    if (!strcmp(profile, "main") || !strcmp(profile, "mainstillpicture") || !strcmp(profile, "msp") ||
        !strcmp(profile, "main444-8") || !strcmp(profile, "main-intra") ||
        !strcmp(profile, "main444-intra") || !strcmp(profile, "main444-stillpicture"))
        bInvalidDepth = true;
#if X265_DEPTH > 10
    if (!strcmp(profile, "main10") || !strcmp(profile, "main422-10") || !strcmp(profile, "main444-10") ||
        !strcmp(profile, "main10-intra") || !strcmp(profile, "main422-10-intra") || !strcmp(profile, "main444-10-intra"))
        bInvalidDepth = true;
#if X265_DEPTH > 12
    if (!strcmp(profile, "main12") || !strcmp(profile, "main422-12") || !strcmp(profile, "main444-12") ||
        !strcmp(profile, "main12-intra") || !strcmp(profile, "main422-12-intra") || !strcmp(profile, "main444-12-intra"))
        bInvalidDepth = true;

    if (bInvalidDepth)
        x265_log(param, X265_LOG_ERROR, "%s profile not supported, internal bit depth %d.\n", profile, X265_DEPTH);
        return -1;

I think x265 with bitdepth=10 can be used to encode yuv420.

is that right?




At 2019-05-09 18:57:15, "Dennis Mungai" <dmngaie at gmail.com> wrote:
>On Thu, 9 May 2019 at 13:04, qw <applemax82 at 163.com> wrote:
>> Hi,
>> If I build libx265 with bitdepth=10bit, and link it with ffmpeg, what's
>> command line to transcode video with libx265 8/10bit?
>Hmm, add either global option below:
>(a). -bits_per_raw_sample 10 and the encoder will pick both the profile and
>the appropriate pixel format for 10-bit encoding, or
>(b): -bits_per_raw_sample 8 and the encoder will pick both the profile and
>the appropriate pixel format for 8-bit encoding.
>Can you show us the output of ffmpeg -h encoder=libx265 ?
>According to https://ffmpeg.org/ffmpeg-codecs.html#libx265 you can also set
>profile restrictions via -profile:v , mapped in the encoder:
>ffmpeg-user mailing list
>ffmpeg-user at ffmpeg.org
>To unsubscribe, visit link above, or email
>ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".

More information about the ffmpeg-user mailing list