[FFmpeg-devel] [patch] remove spurious "missing picture in access unit" at end of h.264 decode

Michael Niedermayer michaelni
Tue Oct 6 12:38:04 CEST 2009


On Wed, Jul 29, 2009 at 05:45:49PM -0700, Phil Rutschman wrote:
> When decoding an H.264 stream I observe the following:
> 
> $ ~/src/ffmpeg-latest-quicktest/ffmpeg -i black.h264 -vcodec copy -f rawvideo -y /dev/null
> FFmpeg version git-9d70cd0, Copyright (c) 2000-2009 Fabrice Bellard, et al.
>   configuration:
>   libavutil     50. 3. 0 / 50. 3. 0
>   libavcodec    52.32. 0 / 52.32. 0
>   libavformat   52.36. 0 / 52.36. 0
>   libavdevice   52. 2. 0 / 52. 2. 0
>   libswscale     0. 7. 1 /  0. 7. 1
>   built on Jul 29 2009 17:20:31, gcc: 4.3.2
> [h264 @ 0x2753690]missing picture in access unit
> 
> Seems stream 0 codec frame rate differs from container frame rate: 47.95 (48000/1001) -> 23.98 (48000/2002)
> Input #0, h264, from 'black.h264':
>   Duration: N/A, bitrate: N/A
>     Stream #0.0: Video: h264, yuv420p, 128x128 [PAR 1:1 DAR 1:1], 23.98 tbr, 1200k tbn, 47.95 tbc
> Output #0, rawvideo, to '/dev/null':
>     Stream #0.0: Video: 0x0000, yuv420p, 128x128 [PAR 1:1 DAR 1:1], q=2-31, 90k tbn, 23.98 tbc
> Stream mapping:
>   Stream #0.0 -> #0.0
> Press [q] to stop encoding
> [NULL @ 0x2753690]missing picture in access unit
> frame=    1 fps=  0 q=-1.0 Lsize=       0kB time=0.04 bitrate=   0.2kbits/s
> video:1kB audio:0kB global headers:0kB muxing overhead -99.822380%
> 
> 
> The "missing picture in access unit" message is at the end of parse_nal_units in libavcodec/h264_parser.c (line 232 as I write this). Although I induce this in my example using a 1-frame file, I have observed this happen with most if not all h.264 streams I've tested. The cause is that h264_parse calls parse_nal_units even when the result of ff_combine_frame indicates there is no data left.
> 
> The attached patch prints this message only if parse_nal_units is called with a buf_size other than 0. This preserves the warning when it's an indication of a problem with the screen but eliminates it from the common case.

Content-Description: missing-picture-in-access-unit.patch
>  h264_parser.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> a286023a0f40453fc0f440bdcfeb27dba9601f3b  missing-picture-in-access-unit.patch
> diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
> index dabd475..4089d53 100644
> --- a/libavcodec/h264_parser.c
> +++ b/libavcodec/h264_parser.c
> @@ -229,7 +229,8 @@ static inline int parse_nal_units(AVCodecParserContext *s,
>          buf += consumed;
>      }
>      /* didn't find a picture! */
> -    av_log(h->s.avctx, AV_LOG_ERROR, "missing picture in access unit\n");
> +    if(buf_size)
> +        av_log(h->s.avctx, AV_LOG_ERROR, "missing picture in access unit\n");
>      return -1;
>  }

i would naively expect that its better to not call parse_nal_units() at all
if there are no nal units, that is buf_size==0, does that work too?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091006/b58e57da/attachment.pgp>



More information about the ffmpeg-devel mailing list