--bframes 0 doesn't work with 2-pass encoding

Issue #77 resolved
Former user created an issue

Version info: x265 [info]: HEVC encoder version 1.3+130-cfe197e3044d x265 [info]: build info [Linux][GCC 4.8.1][64 bit] 8bpp x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2

Step to reproduce:

ffmpeg -i source -f rawvideo -pix_fmt yuv420p - |./x265 --input-res 3840x2160 --fps 23.976 --no-open-gop -p slow --cutree -b 0 --bitrate 700 --no-scenecut --psnr --threads 16 -o /dev/null --pass 1 -
ffmpeg  -i source -f rawvideo -pix_fmt yuv420p - |./x265 --input-res 3840x2160 --fps 23.976 --no-open-gop -p slow --bframes 0 --vbv-bufsize 8000 --vbv-maxrate 20000 --bitrate 12000 --psnr --threads 16 --pass 2 -o ouput.265 - 

Expected result: Success encoding without B frames (forced P\I frames) as described at http://x265.readthedocs.org/en/default/cli.html#cmdoption--bframes

Actual results: Error mesage during second pass: x265 [error]: different bframes setting than first pass (0 vs 0)

It seems like the macro in ratecontrol.cpp

#define CMP_OPT_FIRST_PASS(opt, param_val)\
{\
    bErr = 0;\
    p = strstr(opts, opt "=");\
    char* q = strstr(opts, "no-"opt);\
    if (p && sscanf(p, opt "=%d" , &i) && param_val != i)\
        bErr = 1;\
    else if (!param_val && !q)\
        bErr = 1;\
    else if (param_val && (q || !strstr(opts, opt)))\
        bErr = 1;\
    if (bErr)\
    {\
        x265_log(m_param, X265_LOG_ERROR, "different " opt " setting than first pass (%d vs %d)\n", param_val, i);\
        return false;\
    }\
}

returns an error at

   else if (!param_val && !q)\
        bErr = 1;\

because of "bframes" is equal 0 and "q" is equal to null pointer after

 char* q = strstr(opts, "no-"opt);\ . 

because there is no "no-bframes" options in usage.

Comments (3)

  1. Log in to comment