Opened 7 years ago

Closed 7 years ago

#6335 closed defect (duplicate)

ffmpeg silently ignores first 50 frames when decoding h264

Reported by: Alex Zhukov Owned by:
Priority: important Component: undetermined
Version: git-master Keywords: regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:

ffmpeg skips first 50 frames in my sample file silent_ignore_44vs94.mp4

expected number of frames 94
actual number of frames 44

it plays as expected (no frames ignored) in all players including vlc, mplayer, quicktime, firefox/safari browser builtin video player, but NOT chrome

Same behavior in ffmpeg 3.2.4, 3.3, and git master

How to reproduce:

% ffmpeg -report -i silent_ignore_44vs94.mp4 -f image2 -y image%04d.jpg
... decode ok ...
Input file #0 (silent_ignore_44vs94.mp4):
  Input stream #0:0 (video): 94 packets read (293495 bytes); 44 frames decoded; 
  Total: 94 packets (293495 bytes) demuxed
...

% ls *.jpg | wc -l
44

I am also attaching the report file and input file

Attachments (7)

silent_ignore_44vs94.mp4 (288.3 KB ) - added by Alex Zhukov 7 years ago.
input file
ffmpeg-20170419-160339.log (37.9 KB ) - added by Alex Zhukov 7 years ago.
report log
Screen_Shot_2017-04-19_at_4_06_49_PM.jpg (188.0 KB ) - added by Alex Zhukov 7 years ago.
quicktime player plays ok
vlc_ok.jpg (161.8 KB ) - added by Alex Zhukov 7 years ago.
vlc plays ok
firefox_ok.jpg (231.2 KB ) - added by Alex Zhukov 7 years ago.
firefox ok
safari_ok.jpg (163.0 KB ) - added by Alex Zhukov 7 years ago.
safari ok
telestream_first2mb_ticket6335.mp4 (2.0 MB ) - added by Alex Zhukov 7 years ago.
first 2mb of original telestream encoded file

Change History (16)

by Alex Zhukov, 7 years ago

Attachment: silent_ignore_44vs94.mp4 added

input file

by Alex Zhukov, 7 years ago

Attachment: ffmpeg-20170419-160339.log added

report log

by Alex Zhukov, 7 years ago

quicktime player plays ok

by Alex Zhukov, 7 years ago

Attachment: vlc_ok.jpg added

vlc plays ok

by Alex Zhukov, 7 years ago

Attachment: firefox_ok.jpg added

firefox ok

by Alex Zhukov, 7 years ago

Attachment: safari_ok.jpg added

safari ok

comment:1 by Carl Eugen Hoyos, 7 years ago

How was the input file created?

comment:2 by Alex Zhukov, 7 years ago

Original stream was encoded with Telestream encoder
Then extracted frames with ffmpeg segmenter

comment:3 by Carl Eugen Hoyos, 7 years ago

Please provide (the first few MBs of) the Telestream-encoded file.

by Alex Zhukov, 7 years ago

first 2mb of original telestream encoded file

in reply to:  3 comment:4 by Alex Zhukov, 7 years ago

Replying to cehoyos:

Please provide (the first few MBs of) the Telestream-encoded file.

attached telestream_first2mb_ticket6335.mp4

comment:5 by Carl Eugen Hoyos, 7 years ago

Am I correct that for the Telestream file, no frames are missing?

I don't know what you are trying to do but you cannot generally cut files with -vcodec copy and for the first file you uploaded, the reference decoder produces the same output as FFmpeg (meaning any software that outputs different frames has a bug).
Work-around is to use -flags2 +showall which makes decoding (possibly) non-compliant.

in reply to:  5 comment:6 by Alex Zhukov, 7 years ago

Replying to cehoyos:

Am I correct that for the Telestream file, no frames are missing?

I don't know what you are trying to do but you cannot generally cut files with -vcodec copy and for the first file you uploaded, the reference decoder produces the same output as FFmpeg (meaning any software that outputs different frames has a bug).
Work-around is to use -flags2 +showall which makes decoding (possibly) non-compliant.

So you are saying the fact that safari, firefox, vlc and quicktime play all frames of this file is a bug in all of them?

comment:7 by Alex Zhukov, 7 years ago

-flags2 +showall still decodes only 44 out of 94 frames

in reply to:  7 comment:8 by Alex Zhukov, 7 years ago

Replying to zhukov:

-flags2 +showall still decodes only 44 out of 94 frames

ffmpeg -flags2 +showall -i silent_ignore_44vs94.mp4 -y -f yuv4mpegpipe silent_ignore_44vs94.y4m decodes 94 frames
ffmpeg -i silent_ignore_44vs94.mp4 -flags2 +showall -y -f yuv4mpegpipe silent_ignore_44vs94.y4m decodes 44 frames

comment:9 by Carl Eugen Hoyos, 7 years ago

Keywords: regression added
Priority: normalimportant
Reproduced by developer: set
Resolution: duplicate
Status: newclosed

Replying to zhukov:

Replying to cehoyos:

Am I correct that for the Telestream file, no frames are missing?

I don't know what you are trying to do but you cannot generally cut files with -vcodec copy and for the first file you uploaded, the reference decoder produces the same output as FFmpeg (meaning any software that outputs different frames has a bug).
Work-around is to use -flags2 +showall which makes decoding (possibly) non-compliant.

So you are saying the fact that safari, firefox, vlc and quicktime play all frames of this file is a bug in all of them?

I am saying that the H.264 reference decoder does not show the first 50 frames for the sample you uploaded, just as FFmpeg does.

The issue that af1761f7 broke remuxing in certain cases is a duplicate of several other tickets, for example #6227 (and possibly #6275).

$ ffmpeg -i telestream_first2mb_ticket6335.mp4 -vcodec copy out.mp4
ffmpeg version N-85646-g550a9c5 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl
  libavutil      55. 61.100 / 55. 61.100
  libavcodec     57. 93.100 / 57. 93.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 87.100 /  6. 87.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'telestream_first2mb_ticket6335.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2016-01-11T11:30:54.000000Z
  Duration: 00:21:22.70, start: 0.000000, bitrate: 13 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 914 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : Telestream Inc. Dib Library - ReleaseEnterprise 2014.61.142792
      encoder         : AVC
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
    Metadata:
      handler_name    : Telestream Inc. Dib Library - ReleaseEnterprise 2014.61.142792
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'out.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    encoder         : Lavf57.72.101
    Stream #0:0(und): Video: h264 (Main) ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=2-31, 914 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (default)
    Metadata:
      handler_name    : Telestream Inc. Dib Library - ReleaseEnterprise 2014.61.142792
      encoder         : AVC
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : Telestream Inc. Dib Library - ReleaseEnterprise 2014.61.142792
      encoder         : Lavc57.93.100 aac
frame=  196 fps=0.0 q=-1.0 Lsize=    1137kB time=00:00:09.00 bitrate=1034.2kbits/s speed=29.6x
video:984kB audio:147kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.545792%
[aac @ 0x2c4a760] Qavg: 2458.570

Output file shows less frames than input with FFmpeg (and the reference decoder), not reproducible with -an and -acodec copy.

Note: See TracTickets for help on using tickets.