Opened 5 years ago

Closed 5 years ago

#961 closed defect (fixed)

Decoding H.264 to YUV drops one frame

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

Description

For the attached samples encoded with x264, FFmpeg drops one frame when decoding them to YUV420.

I used the reference decoder (JM 17.2) to verify that the bitstream indeed did contain one more frame than FFmpeg decoded.

./ldecod.dbg.exe -i output3.h264
Setting Default Parameters...
Parsing Configfile decoder.cfg
...............



Input H.264 bitstream : /tmp/output3.h264
Output decoded YUV : test_dec.yuv
Input reference file : test_rec.yuv


POC must = frame# or field# for SNRs to be correct


Frame POC Pic# QP SnrY SnrU SnrV Y:U:V Time(ms)


Input reference file : test_rec.yuv does not exist

SNR values are not available

(fn=0 T: poc=0 B: poc=0 F: poc=0 G: poc=0) ref (3) view_id (0)
00000(IDR) 0 0 28 4:2:0 86
(fn=0 T: poc=0 B: poc=0 F: poc=0 G: poc=0) ref (3) view_id (0)
(fn=1 T: poc=4 B: poc=4 F: poc=4 G: poc=4) ref (3) view_id (0)
00002( P ) 4 1 28 4:2:0 13
(fn=0 T: poc=0 B: poc=0 F: poc=0 G: poc=0) ref (3) view_id (0)
(fn=1 T: poc=4 B: poc=4 F: poc=4 G: poc=4) ref (3) view_id (0)
(fn=2 T: poc=2 B: poc=2 F: poc=2 G: poc=2)
00001( b ) 2 2 28 4:2:0 10


SNR Y(dB) : 0.00
SNR U(dB) : 0.00
SNR V(dB) : 0.00
Total decoding time : 0.111 sec (27.027 fps)[3 frm/111 ms]


Exit JM 17 (FRExt) decoder, ver 17.2
Output status file : log.dec

pissaris@takis-Latitude-E6520:/usr/local/src/jm-17.2/bin$ ffmpeg -y -i /tmp/output3.h264 test.yuv
ffmpeg version N-37401-g151ecc2 Copyright (c) 2000-2012 the FFmpeg developers

built on Jan 31 2012 15:39:01 with clang 3.0 (tags/RELEASE_30/final)
configuration: --cc=/opt/clang/bin/clang
libavutil 51. 36.100 / 51. 36.100
libavcodec 54. 0.102 / 54. 0.102
libavformat 54. 0.100 / 54. 0.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 60.100 / 2. 60.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100

[h264 @ 0x29c83a0] decoding for stream 0 failed
[h264 @ 0x29c83a0] Estimating duration from bitrate, this may be inaccurate
Input #0, h264, from '/tmp/output3.h264':

Duration: N/A, bitrate: N/A

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

[buffer @ 0x29d08e0] w:352 h:288 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:
Output #0, rawvideo, to 'test.yuv':

Metadata:

encoder : Lavf54.0.100
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 352x288, q=2-31, 200 kb/s, 90k tbn, 25 tbc

Stream mapping:

Stream #0:0 -> #0:0 (h264 -> rawvideo)

Press [q] to stop, ? for help
frame= 2 fps= 0 q=0.0 Lsize= 297kB time=00:00:00.08 bitrate=30412.8kbits/s dup=0 drop=1
video:297kB audio:0kB global headers:0kB muxing overhead 0.000000%

Attachments (2)

output3.h264 (16.7 KB) - added by takis 5 years ago.
H.264 bitstream containing 3 frames
output4.h264 (18.7 KB) - added by takis 5 years ago.
H.264 bitstream containing 4 frames

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by takis

H.264 bitstream containing 3 frames

Changed 5 years ago by takis

H.264 bitstream containing 4 frames

comment:1 Changed 5 years ago by takis

The output4.h264 file contains 4 frames, and similarly FFmpeg decodes only three of them.

comment:2 Changed 5 years ago by takis

Oh and the same happens with GCC, so it is not clang related.

./ffmpeg -y -i /tmp/output3.h264 test.yuv
ffmpeg version N-37401-g151ecc2 Copyright (c) 2000-2012 the FFmpeg developers

built on Jan 31 2012 15:51:38 with gcc 4.6.1
configuration: --enable-avfilter --enable-frei0r --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-nonfree --enable-pic --enable-pthreads --disable-shared --enable-static --enable-version3 --enable-x11grab --disable-optimizations
libavutil 51. 36.100 / 51. 36.100
libavcodec 54. 0.102 / 54. 0.102
libavformat 54. 0.100 / 54. 0.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 60.100 / 2. 60.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100
libpostproc 52. 0.100 / 52. 0.100

[h264 @ 0x2de83a0] decoding for stream 0 failed
[h264 @ 0x2de83a0] Estimating duration from bitrate, this may be inaccurate
Input #0, h264, from '/tmp/output3.h264':

Duration: N/A, bitrate: N/A

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

[buffer @ 0x2df08e0] w:352 h:288 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:
Output #0, rawvideo, to 'test.yuv':

Metadata:

encoder : Lavf54.0.100
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 352x288, q=2-31, 200 kb/s, 90k tbn, 25 tbc

Stream mapping:

Stream #0:0 -> #0:0 (h264 -> rawvideo)

Press [q] to stop, ? for help
frame= 2 fps= 0 q=0.0 Lsize= 297kB time=00:00:00.08 bitrate=30412.8kbits/s dup=0 drop=1
video:297kB audio:0kB global headers:0kB muxing overhead 0.000000%

comment:3 Changed 5 years ago by cehoyos

  • Keywords h264 added
  • Status changed from new to open

Did you test -vsync 0?
It should allow you to see all encoded frames.

comment:4 Changed 5 years ago by takis

It does work with vsync 0, but I do not understand why it should drop frames by default. I'd say it should be assumed that there is no difference in framerate between input and output as none was mentioned on the commandline and the outputformat does not force a specific framerate.

comment:5 Changed 5 years ago by takis

But thanks for mentioning a workaround! :)

comment:6 Changed 5 years ago by michael

  • Resolution set to fixed
  • Status changed from open to closed

It seems this problem has been fixed (possibly by reimars vsync / encoder pts related changes, possibly by something else ...)
as i do get 3 and 4 frames

if iam wrong, please reopen

Note: See TracTickets for help on using tickets.