Opened 9 years ago

Closed 9 years ago

#5439 closed defect (needs_more_info)

Decoding issue

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

Description

Summary of the bug:

I have some troubles while decoding h264 streams. It seems to be a regression in ffmpeg. When I decode a stream with the 2.7.1 version, I decode all the frames in my stream. But when I try with the same command line on the latest version (3.0), I have one skipped frame. I notice that the skipped frame was after a I frame due to a cut detection.

Here's the command line on both versions :

ffmpeg -v verbose -i encoded.264 -vsync 0 decoded.yuv

Here's the output on the 2.7.1 version :

ffmpeg -v verbose -i test.264 -vsync 0 test_dec_oldffmpeg.yuv
ffmpeg version 2.7.1 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (Debian 4.7.2-5)
  configuration: --prefix=./build --bindir=./bin
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
[h264 @ 0x2300ba0] Increasing reorder buffer to 3
[h264 @ 0x2300180] max_analyze_duration 5000000 reached at 5000000 microseconds
Input #0, h264, from 'test.264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), 4 reference frames, yuv420p(tv, bt709), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1200k tbn, 50 tbc
[graph 0 input from stream 0:0 @ 0x2300ae0] w:1920 h:1080 pixfmt:yuv420p tb:1/1200000 fr:50/2 sar:1/1 sws_param:flags=2
Output #0, rawvideo, to 'test_dec_oldffmpeg.yuv':
  Metadata:
    encoder         : Lavf56.36.100
    Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.41.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[rawvideo @ 0x23016e0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 240 >= 240
No more output streams to write to, finishing.
frame=  243 fps= 51 q=0.0 Lsize=  738112kB time=00:00:09.72 bitrate=622080.0kbits/s    
video:738112kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Input file #0 (test.264):
  Input stream #0:0 (video): 486 packets read (4952189 bytes); 243 frames decoded; 
  Total: 486 packets (4952189 bytes) demuxed
Output file #0 (test_dec_oldffmpeg.yuv):
  Output stream #0:0 (video): 243 frames encoded; 243 packets muxed (755827200 bytes); 
  Total: 243 packets (755827200 bytes) muxed

Here's the output on the 3.0 version :

ffmpeg -v verbose -i test.264 -vsync 0 test_dec_newwffmpeg.yuv
ffmpeg version N-78758-g5156578 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --
enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-lib
x265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-d
ecklink --enable-zlib
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 27.100 / 57. 27.100
  libavformat    57. 26.100 / 57. 26.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 37.100 /  6. 37.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[h264 @ 0000000000854860] Increasing reorder buffer to 1
[h264 @ 0000000000854860] Increasing reorder buffer to 2
[h264 @ 0000000000842660] max_analyze_duration 5000000 reached at 5000000 micros
econds st:0
Input #0, h264, from 'test.264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), 4 reference frames, yuv420p(tv, bt709), 192
0x1080 (1920x1088) [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1200k tbn, 50 tbc
[graph 0 input from stream 0:0 @ 0000000000848140] w:1920 h:1080 pixfmt:yuv420p
tb:1/1200000 fr:50/2 sar:1/1 sws_param:flags=2
Output #0, rawvideo, to 'test_dec_newwffmpeg.yuv':
  Metadata:
    encoder         : Lavf57.26.100
    Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p
, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.27.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame=   60 fps=0.0 q=-0.0 size=  182250kB time=00:00:02.44 bitrate=611882.0kbit
[h264 @ 0000000002e50540] Increasing reorder buffer to 3
frame=  125 fps=124 q=-0.0 size=  379688kB time=00:00:05.12 bitrate=607500.0kbit
frame=  190 fps=126 q=-0.0 size=  577125kB time=00:00:07.72 bitrate=612410.4kbit
frame=  232 fps=115 q=-0.0 size=  704700kB time=00:00:09.40 bitrate=614138.6kbit
[rawvideo @ 0000000002fcf020] Application provided invalid, non monotonically in
creasing dts to muxer in stream 0: 241 >= 241
No more output streams to write to, finishing.
frame=  242 fps=116 q=-0.0 Lsize=  735075kB time=00:00:09.76 bitrate=616981.0kbi
ts/s speed=4.68x
video:735075kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxin
g overhead: 0.000000%
Input file #0 (test.264):
  Input stream #0:0 (video): 486 packets read (4952189 bytes); 242 frames decode
d;
  Total: 486 packets (4952189 bytes) demuxed
Output file #0 (test_dec_newwffmpeg.yuv):
  Output stream #0:0 (video): 242 frames encoded; 242 packets muxed (752716800 b
ytes);
  Total: 242 packets (752716800 bytes) muxed

Change History (7)

comment:1 by Carl Eugen Hoyos, 9 years ago

Keywords: h264 regression added
Priority: normalimportant

Did you upload test.264?

comment:2 by Eddy, 9 years ago

Hi ceheyos,

No I didn't, I don't have the right on the sequences. I tried on other sequences but without any success.

It seems like it doesn't come from the encoder but from the sequence.

Precision about the stream:

  • 1080i 50Hz
  • YUV420p - 8bits
  • Encoder : h264
  • Field encoding
  • GOP 24x8
  • Two scene cut

comment:3 by Carl Eugen Hoyos, 9 years ago

Please test (and provide console output for) current FFmpeg git head and find out which change broke the decoding with FFmpeg.

comment:4 by Eddy, 9 years ago

Here's the console output for the current FFmpeg git head :

ffmpeg -v verbose -i test.264 -vsync 0 test.yuv
ffmpeg version 3.0.git Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: 
  libavutil      55. 22.100 / 55. 22.100
  libavcodec     57. 34.100 / 57. 34.100
  libavformat    57. 34.100 / 57. 34.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 42.100 /  6. 42.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
[h264 @ 0x28819a0] Increasing reorder buffer to 1
[h264 @ 0x28819a0] Increasing reorder buffer to 2
[h264 @ 0x28803a0] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
Input #0, h264, from '/media/sf_share/test.264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), 1 reference frame, yuv420p(tv, bt709), 1920x1080 (0x0) [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1200k tbn
[graph 0 input from stream 0:0 @ 0x299eb20] w:1920 h:1080 pixfmt:yuv420p tb:1/1200000 fr:50/2 sar:1/1 sws_param:flags=2
[rawvideo @ 0x2882060] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, rawvideo, to '../test.yuv':
  Metadata:
    encoder         : Lavf57.34.100
    Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 1920x1080 (0x0) [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc57.34.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame=   49 fps=0.0 q=-0.0 size=  148838kB time=00:00:02.00 bitrate=609638.4kbit[h264 @ 0x29d67a0] Increasing reorder buffer to 3
frame=   82 fps= 81 q=-0.0 size=  249075kB time=00:00:03.40 bitrate=600124.2kbitframe=  119 fps= 79 q=-0.0 size=  361462kB time=00:00:04.88 bitrate=606783.0kbitframe=  154 fps= 76 q=-0.0 size=  467775kB time=00:00:06.28 bitrate=610193.1kbitframe=  191 fps= 76 q=-0.0 size=  580162kB time=00:00:07.76 bitrate=612460.2kbitframe=  220 fps= 68 q=-0.0 size=  668250kB time=00:00:08.92 bitrate=613711.2kbit[rawvideo @ 0x2882060] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 241 >= 241
No more output streams to write to, finishing.
frame=  242 fps= 68 q=-0.0 Lsize=  735075kB time=00:00:09.76 bitrate=616981.0kbits/s speed=2.76x    
video:735075kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Input file #0 (/media/sf_share/test.264):
  Input stream #0:0 (video): 486 packets read (4952189 bytes); 242 frames decoded; 
  Total: 486 packets (4952189 bytes) demuxed
Output file #0 (../test.yuv):
  Output stream #0:0 (video): 242 frames encoded; 242 packets muxed (752716800 bytes); 
  Total: 242 packets (752716800 bytes) muxed

in reply to:  4 comment:5 by Carl Eugen Hoyos, 9 years ago

Replying to Eddy:

[h264 @ 0x28819a0] Increasing reorder buffer to 1

Please test -strict 1.

Note that this will not be fixed unless you can name the encoder that produces such streams.

comment:6 by Eddy, 9 years ago

It works ! Thanks very much.

But I don't understand, does it mean that the problem comes from to encoder ?

And I don't understand the possible values with the "strict" parameter.

I've done some tries based on the documentation:

  • strict 1 : decodes all frames
  • strict 2 : decodes all frames
  • strict 3 : decodes all frames
  • strict very : produces an error on Ffmpeg
  • strict strict : decodes all frames
  • strict normal : does not decode all frames
  • strict unofficial: does not decode all frames
  • strict experimental : does not decode all frames

On the documentation, it's written that the value has to be an integer but I don't see the values corresponding to the key described.

Where can I find these, is the only way in the source code ?

in reply to:  6 comment:7 by Carl Eugen Hoyos, 9 years ago

Component: undeterminedavcodec
Resolution: needs_more_info
Status: newclosed

Replying to Eddy:

But I don't understand, does it mean that the problem comes from to encoder ?

No, it means we will only fix the issue if a real-world encoder produces such streams. It is easy to create such samples, see ticket #5138
Feel free to upload your sample and reopen this ticket.

And I don't understand the possible values with the "strict" parameter.

I opened ticket #5443, thank you for the report!

Note: See TracTickets for help on using tickets.