Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#6717 closed defect (fixed)

h264 - gray chroma - error while decoding - left block unavailable

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

Description

Hi all, well i found this problem from mpv, i can't reproduce a video, but when i test the file with ffmpeg don't works either.

This don't happen always, the version 3.2.6 is the last can reproduce and work with this video, but from 3.2.7 to 3.3.4 fails.

here a fragmente from:

ffmpeg -i in.mkv out.mkv

....
[h264 @ 0xa44ae0] Reference 6 >= 3
[h264 @ 0xa44ae0] error while decoding MB 39 2, bytestream 24332
[h264 @ 0xa44ae0] concealing 7930 DC, 7930 AC, 7930 MV errors in P frame
[h264 @ 0xa31460] top block unavailable for requested intra mode
[h264 @ 0xa31460] error while decoding MB 109 0, bytestream 20972
[h264 @ 0xa31460] concealing 8100 DC, 8100 AC, 8100 MV errors in P frame
[h264 @ 0x9dd5e0] Reference 4 >= 4
[h264 @ 0x9dd5e0] error while decoding MB 32 1, bytestream 22037
[h264 @ 0x9dd5e0] concealing 8057 DC, 8057 AC, 8057 MV errors in P frame
[h264 @ 0x9f26c0] gray chroma
[h264 @ 0x9f26c0] error while decoding MB 101 1, bytestream 24052
[h264 @ 0x9f26c0] concealing 7988 DC, 7988 AC, 7988 MV errors in P frame
[h264 @ 0x1c314c0] top block unavailable for requested intra mode
[h264 @ 0x1c314c0] error while decoding MB 106 0, bytestream 23977
[h264 @ 0x837e60] concealing 7769 DC, 7769 AC, 7769 MV errors in P frame
[h264 @ 0x1c314c0] concealing 8103 DC, 8103 AC, 8103 MV errors in P frame
[h264 @ 0xa56780] gray chroma
[h264 @ 0xa56780] error while decoding MB 84 0, bytestream 22106
[h264 @ 0xa56780] concealing 8125 DC, 8125 AC, 8125 MV errors in P frame
[h264 @ 0x1b488a0] concealing 7779 DC, 7779 AC, 7779 MV errors in P frame
[h264 @ 0xb65f60] gray chroma
[h264 @ 0xb65f60] error while decoding MB 17 2, bytestream 17086
[h264 @ 0xb65f60] concealing 7952 DC, 7952 AC, 7952 MV errors in P frame
frame= 47 fps= 45 q=0.0 size= 0kB time=00:00:01.63 bitrate= 0.0kbits/s[h264 @ 0xa44ae0] left block unavailable for requested intra mode
[h264 @ 0xa44ae0] error while decoding MB 0 2, bytestream 19416
[h264 @ 0xa44ae0] concealing 7969 DC, 7969 AC, 7969 MV errors in P frame
[h264 @ 0xa31460] gray chroma
[h264 @ 0xa31460] error while decoding MB 43 1, bytestream 19356
...

X10000000, and continue, and continue.

I found some things, first, i can reproduce this with ffmpeg-3.2.6 installed, all works, with upper version fails.

But, if i rencode the video with ffmpeg-3.2.6 the video start working with any version of ffmpeg.

I use Gentoo 64, and i try a lot of combinations of USEs but i get the same result.

Thx.

Attachments (3)

in.mkv (2.3 MB ) - added by latot 7 years ago.
test
sei.h264 (122 bytes ) - added by BugMaster 7 years ago.
fixed.mkv (2.0 MB ) - added by BugMaster 7 years ago.

Change History (21)

by latot, 7 years ago

Attachment: in.mkv added

test

comment:1 by BugMaster, 7 years ago

This file is out of spec 4:4:4 x264 encode with x264 SEI removed (may be due splitting of mkv). It can't be decoded without x264 SEI. To fix it you need to either restore x264 SEI (with core 150 or lower) or re-encode it with new x264 version (r2851 core 151 or higher) where out of spec behavior was fixed (or with old version but 8x8dct disabled).

comment:2 by latot, 7 years ago

D:

So the problem is in the file, and a mix with x264 if i understand right....

I upload only 5 segs of the file because is too big, but both have the same issue.

I don't have problem installing a lower core than 150 (i would like avoid rencoding), sadly i don't know how restore the SEI, can you help me please?, maybe with some doc, or place where i can found how do that? (i don't know how use ffmpeg for that)

Thx for your help.

Last edited 7 years ago by latot (previous) (diff)

by BugMaster, 7 years ago

Attachment: sei.h264 added

by BugMaster, 7 years ago

Attachment: fixed.mkv added

comment:3 by BugMaster, 7 years ago

I am dunno how to do this with ffmpeg itself but you can:
1) extract raw h264 video track from your mkv file
2) concat sei.h264 + video_track.h264 files to resulting fixed.h264
3) mux new fixed.mkv file which should decode correctly with all versions of ffmpeg

comment:4 by latot, 7 years ago

Hi, sorry my ignorant question, but how i get the sei.h264?

and for concat you mean 'cat sei.h264 video_track.h264 > newfile'?

Thx.

comment:5 by BugMaster, 7 years ago

I have attached sei.h264 above my previous comment. As for concat command, yes if you are at linux (on windows it can treate as text instead of binary and add not needed line breaks bytes). On windows it would be something like copy /B sei.h264 + video_track.h264 newfile.h264

comment:6 by latot, 7 years ago

Hi, just finishing this (then, or now, i'll try fix all the filies i have with this), this sei.h264 file works for all the files with this problem?, or there is some condition or something?

Thx.

comment:7 by BugMaster, 7 years ago

It should work for all the files with this problem where x264 detection (core 150) is needed.

comment:8 by latot, 7 years ago

Hi!

I use this to fix 24 files, and now all seems to work!, thx for your solution.

Note, this solution is better than seems, because i'm using x264 with core 152 and now all the videos can be reproduced.

Thx.

comment:9 by Carl Eugen Hoyos, 7 years ago

Can you explain how exactly you produced the broken files?

comment:10 by latot, 7 years ago

Sadly no, i not produce this file, the only thing i know about this video is with one versions works and in the next not...

The closer issue i found with this is
https://github.com/mpv-player/mpv/issues/4559

Where explain is possible a problem with a lower version of x264.

Thx.

in reply to:  9 ; comment:11 by Thirumalaisamy K, 6 years ago

Replying to cehoyos:

Can you explain how exactly you produced the broken files?

Just encode a video with ffmpeg that's build with old x264 versions.
As of now all latest ffmpeg builds (both stable & git) at https://evermeet.cx/ffmpeg/ has issues.

you can just reproduce a similar file with the following command

ffmpeg -i input.ext -c:v libx264 -profile high444 -pix_fmt yuv444p -an out.ext

in reply to:  11 comment:12 by Carl Eugen Hoyos, 6 years ago

Replying to KTSamy:

Replying to cehoyos:

Can you explain how exactly you produced the broken files?

Just encode a video with ffmpeg that's build with old x264 versions.
As of now all latest ffmpeg builds (both stable & git) at https://evermeet.cx/ffmpeg/ has issues.

you can just reproduce a similar file with the following command

ffmpeg -i input.ext -c:v libx264 -profile high444 -pix_fmt yuv444p -an out.ext

(This command line does not work.)
Did you test this yourself or are you speculating - the reason I ask is that so far, nobody could explain how to produce such a file: Don't you agree that it most likely isn't so easy?

comment:13 by Terran Vigil, 6 years ago

Also ran into this, simply by decoding any source to yuv444, encoding that with x264 as high444. Decode the resulting mp4 with ffmpeg and you'll see the same issue as noted in this ticket. It appears to be a regression that was introduced in:

840b41b2a643fc8f0617c0370125a19c02c6b586

comment:14 by Carl Eugen Hoyos, 6 years ago

Please explain how - exactly! - I can produce such a file.

in reply to:  14 comment:15 by Thirumalaisamy K, 6 years ago

Replying to cehoyos:

Please explain how - exactly! - I can produce such a file.

I don't have exact issues with ffmpeg. But, with ffplay.

The method I have mentioned can produce the file with a similar(?) issue. But, it will play with ffplay as usual if you start from the beginning. But if you pass seek parameter, you will see ffplay will won't play properly & can see the similar errors.

Just encode as I have mentioned & try the following

ffplay -ss 5 out.ext

Edit:

Just use ffmpeg streamcopy with seek on previously encoded file with 8x8dct enabled to get a file with this issue. You will get similar error when you play the file with ffplay (without seek now)

ffmpeg -ss 10 -i out.ext -c copy out2.ext

Note: Older ffplay versions (at least 3.2.4) are working fine. But, all 3.3 & 3.4 versions will have the issues in playing the videos that was encoded with 8x8dct enabled. Videos encoded with ffmpeg wich has newer x264 encoder will not produce such files as they force disables 8x8dct when you encode to a video with 4:4:4 Chroma subsampling.

Last edited 6 years ago by Thirumalaisamy K (previous) (diff)

in reply to:  14 comment:16 by Terran Vigil, 6 years ago

Replying to cehoyos:

Please explain how - exactly! - I can produce such a file.

See my comment above on how to reproduce as well as the commit that introduced the issue.

comment:17 by Carl Eugen Hoyos, 6 years ago

Component: undeterminedavcodec
Keywords: libx264 h264 added
Reproduced by developer: set
Resolution: fixed
Status: newclosed
Version: unspecifiedgit-master

comment:18 by Carl Eugen Hoyos, 6 years ago

Needs -x264_build 150

Note: See TracTickets for help on using tickets.