h264dec.exe can't decode h264 file
I have a h264 file encoded with x264. I am able to decode it to YUV with avconv under Ubuntu 14.04: avconv -i input.h264 -c:v rawvideo -pix_fmt yuv420p output.yuv or play with mplayer (mplayer input.h264). But I cannot decode it to YUV with h264dec.exe under Windows. h264dec is compiled from the current "master" with mingw32-make OS=mingw_nt -j4. Error log:
h264dec.exe input.h264 out.yuv > 1.log 2>&1 H264 source file name: input.h264.. Sequence output file name: out.yuv.. [OpenH264] this = 0x00662850, Error:invalid syntax cabac_init_idc 14 [OpenH264] this = 0x00662850, Warning:DecodeCurrentAccessUnit() failed (1027) in frame: 2 uiDId: 0 uiQId: 0 [OpenH264] this = 0x00662850, Warning:DecodeCurrentAccessUnit() failed (1050) in frame: 2 uiDId: 0 uiQId: 0 [OpenH264] this = 0x00662850, Warning:DecodeCurrentAccessUnit() failed (1050) in frame: 2 uiDId: 0 uiQId: 0 [OpenH264] this = 0x00662850, Warning:DecodeCurrentAccessUnit() failed (10012) in frame: 2 uiDId: 0 uiQId: 0 [OpenH264] this = 0x00662850, Warning:DecodeCurrentAccessUnit() failed (10012) in frame: 3 uiDId: 0 uiQId: 0 tons of the same errors [OpenH264] this = 0x00662850, Warning:DecodeCurrentAccessUnit() failed (1050) in frame: 5 uiDId: 0 uiQId: 0 [OpenH264] this = 0x00662850, Warning:DecodeCurrentAccessUnit() failed (10012) in frame: 6 uiDId: 0 uiQId: 0
iWidth: 1280 height: 1024 Frames: 2 decode time: 0.326690 sec FPS: 6.122012 fps
It looks like it cannot decode intermediate frames. It has decoded only two keyframes.
I failed to decode the file with C API too. DecodeFrameNoDelay() is able to decode the keyframe, but fails on an intermediate frame with the error 0x24. Log from the C application:
[OpenH264] this = 0x13F3E2E0, Info:CWelsDecoder::init_decoder(), openh264 codec version = 6b50384 [OpenH264] this = 0x13F3E2E0, Info:eVideoType: 1 [OpenH264] this = 0x13F3E2E0, Info:WelsRequestMem(): memory alloc size = 1280 * 1024, ref list size = 5 [OpenH264] this = 0x13F3E2E0, Info:SyncPictureResolutionExt(), overall memory usage: 19967592 bytes [OpenH264] this = 0x13F3E2E0, Info:DecodeFrameConstruction(): will output first frame of new sequence, 1280 x 1024, crop_left:0, crop_right:0, crop_top:0, crop_bottom:0, ignored error packet:0. [OpenH264] this = 0x13F3E2E0, Error:invalid syntax cabac_init_idc 10 [OpenH264] this = 0x13F3E2E0, Info:decode failed, failure type:4 [OpenH264] this = 0x13F3E2E0, Warning:DecodeCurrentAccessUnit() failed (1050) in frame: 1 uiDId: 0 uiQId: 0 [OpenH264] this = 0x13F3E2E0, Warning:DecodeCurrentAccessUnit() failed (10012) in frame: 1 uiDId: 0 uiQId: 0 [OpenH264] this = 0x13F3E2E0, Warning:DecodeCurrentAccessUnit() failed (10012) in frame: 1 uiDId: 0 uiQId: 0 [OpenH264] this = 0x13F3E2E0, Warning:DecodeCurrentAccessUnit() failed (10012) in frame: 1 uiDId: 0 uiQId: 0 [OpenH264] this = 0x13F3E2E0, Warning:DecodeCurrentAccessUnit() failed (10012) in frame: 1 uiDId: 0 uiQId: 0 [OpenH264] this = 0x13F3E2E0, Warning:DecodeCurrentAccessUnit() failed (10012) in frame: 1 uiDId: 0 uiQId: 0 [OpenH264] this = 0x13F3E2E0, Warning:DecodeCurrentAccessUnit() failed (1050) in frame: 1 uiDId: 0 uiQId: 0
FIle itself: http://rghost.ru/8Dm4mWTFZ (password: openh264)
I ffprobed your content and it seems the "Main" profile of H.264 has been used for the encoding process. OpenH264 supports the Baseline profile but not the Main one. I guess this could be the reason you can't decode your content properly. Try with a baseline profile version of your content
You are right, with "baseline" it works fine. Is there any chance to support "main" in the future?
There is some bug existing to support Main profile decoding, and we are checking it. Will inform here if with any progress.
Sorry for late reply. This problem is caused by the logic of RPLR where we think the standard draft has some logic conflict. To support the bitstream, we have fixed it according to standard and JM implementation. I think now you can decode it correctly.
fixed