Opened 10 years ago

Closed 10 years ago

Last modified 2 months ago

#685 closed defect (fixed)

H264 decoder error

Reported by: Anatoly Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: h264
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no


There is a stream obtained from IP Camera which cannot be correctly decoded by ffmpeg but successfully decoded by Elecard StreamEye and IPP.
FFmpeg report:
./ffprobe ~/projects/decodeh264/frame.264
ffprobe version N-34962-gfd1cea6, Copyright (c) 2007-2011 the FFmpeg developers

built on Nov 25 2011 13:28:59 with gcc 4.4.5
configuration: --disable-optimizations
libavutil 51. 26. 0 / 51. 26. 0
libavcodec 53. 35. 0 / 53. 35. 0
libavformat 53. 20. 0 / 53. 20. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 48. 1 / 2. 48. 1
libswscale 2. 1. 0 / 2. 1. 0

[h264 @ 0x27a7c40] negative number of zero coeffs at 0 0
[h264 @ 0x27a7c40] error while decoding MB 0 0
[h264 @ 0x27a7c40] concealing 396 DC, 396 AC, 396 MV errors
[h264 @ 0x27a1880] Estimating duration from bitrate, this may be inaccurate
Input #0, h264, from '/home/alien/projects/decodeh264/frame.264':

Duration: N/A, bitrate: N/A

Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 352x288, 25 tbr, 1200k tbn, 50 tbc

Attachments (2)

frame.264 (22.0 KB ) - added by Anatoly 10 years ago.
movie.264 (805.6 KB ) - added by Anatoly 10 years ago.

Download all attachments as: .zip

Change History (11)

by Anatoly, 10 years ago

Attachment: frame.264 added

by Anatoly, 10 years ago

Attachment: movie.264 added

comment:1 by Anatoly, 10 years ago

I've made some investigations and found that the problem may be in flag dct8x8_allowed. Thus the following patch makes file "frame.264" decodable.

diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index b0dc999..ff39d3f 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -799,10 +799,12 @@ decode_intra_mb:
             int i;
             int di = 1;
+            /*
             if(dct8x8_allowed && get_bits1(&s->gb)){
                 mb_type |= MB_TYPE_8x8DCT;
                 di = 4;
+            */
 //                fill_intra4x4_pred_table(h);
             for(i=0; i<16; i+=di){

This is an ugly fix but it may shows the way to resolve this issue.

comment:2 by Carl Eugen Hoyos, 10 years ago

Keywords: h264 added
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

Given that the reference decoder also fails ("ERROR: failed to find Total Zeros !cdc"), I would assume the sample is broken...

comment:3 by Carl Eugen Hoyos, 10 years ago

Component: undeterminedavcodec

in reply to:  3 comment:4 by Anatoly, 10 years ago

I also tried reference decoder and it fails. But Elecard StreamEye successfully decode this stream. Why?

comment:5 by Anatoly, 10 years ago

I think I found the solution. It looks like flag "transform_8x8_mode_flag" is wrongly set to 1. After inverting this flag to 0 both streams become decodeable. And it also looks like StreamEye support old version of AVC standart that doesn't provide "transform_8x8_mode_flag".

Thus, I think this ticket may be closed.

comment:6 by Carl Eugen Hoyos, 10 years ago

Resolution: fixed
Status: openclosed

Fixed by you.

comment:7 by Balling, 2 months ago

I will just point out that "fix" in 85c92789b60416bb89f7938fa236c558603559f6 does not work on android (due to different byte endianess?)

comment:8 by Elon Musk, 2 months ago

Please ban yourself from this site.

Your inputs have no value at all.

in reply to:  8 comment:9 by Balling, 2 months ago

Replying to richardpl:

Please ban yourself from this site.

Your inputs have no value at all.

Test for yourself using mpv for android. And stop attacking me.

Note: See TracTickets for help on using tickets.