Opened 7 years ago

Closed 7 years ago

#6090 closed defect (fixed)

ffmpeg duplicates the first frame when decoding attached hevc-file.

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

Description

Summary of the bug:
ffmpeg duplicates the first frame when decoding attached hevc-file.
File was not encoded by ffmpeg. The original BQMall is 601 frames long. The hevc reference decoder produce the correct output.

How to reproduce:

$ ffmpeg -version
ffmpeg version N-83136-gbdbbb8f Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10)
configuration: --enable-gpl --enable-libx264
libavutil      55. 43.100 / 55. 43.100
libavcodec     57. 73.100 / 57. 73.100
libavformat    57. 62.100 / 57. 62.100
libavdevice    57.  2.100 / 57.  2.100
libavfilter     6. 69.100 /  6. 69.100
libswscale      4.  3.101 /  4.  3.101
libswresample   2.  4.100 /  2.  4.100
libpostproc    54.  2.100 / 54.  2.100

$ ffmpeg -i BQMall_832x480_60_QP29.hevc tmp.yuv

Using a python-tool I wrote to calculate the sha1sum of all frames in a ycbcr 420 file (https://github.com/figgis/yuv_checksum)

frame	sha1
=====	========================================
0000	baa271df1987798b0847e1d9eea20df78d301f8f
0001	baa271df1987798b0847e1d9eea20df78d301f8f
0002	6b8d13a219066989ee5e0209f2aed7ba1fc2e56f

Size of output

$ stat -c "%s" BQMall_832x480_60.yuv tmp.yuv 
360023040
360622080

In [2]: 360622080-360023040
Out[2]: 599040

In [3]: 832*480*3/2
Out[3]: 599040
# One frame too many

Attachments (1)

BQMall_832x480_60_QP46.hevc (315.1 KB ) - added by figgis 7 years ago.
QP29 was to large (3.5MB) Same behavior can bee seen in this file using QP46.

Download all attachments as: .zip

Change History (7)

by figgis, 7 years ago

Attachment: BQMall_832x480_60_QP46.hevc added

QP29 was to large (3.5MB) Same behavior can bee seen in this file using QP46.

in reply to:  description comment:1 by Carl Eugen Hoyos, 7 years ago

Component: undeterminedavcodec
Keywords: dts added; duplicate frame removed

Replying to figgis:

$ ffmpeg -i BQMall_832x480_60_QP29.hevc tmp.yuv

Please provide the command line and the complete, uncut console output for the file you attached to make this a valid ticket.

comment:2 by figgis, 7 years ago

$ ffmpeg -i BQMall_832x480_60_QP46.hevc tmp.yuv
ffmpeg version N-83136-gbdbbb8f Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --enable-gpl --enable-libx264
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 73.100 / 57. 73.100
  libavformat    57. 62.100 / 57. 62.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 69.100 /  6. 69.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, hevc, from 'BQMall_832x480_60_QP46.hevc':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: hevc (Main), yuv420p(tv), 832x480, 60 fps, 60 tbr, 1200k tbn, 60 tbc
Output #0, rawvideo, to 'tmp.yuv':
  Metadata:
    encoder         : Lavf57.62.100
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 832x480, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
    Metadata:
      encoder         : Lavc57.73.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame=  602 fps=0.0 q=-0.0 Lsize=  352170kB time=00:00:10.05 bitrate=287062.4kbits/s dup=1 drop=0 speed=34.9x    
video:352170kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%

comment:3 by figgis, 7 years ago

I increased the loglevel.

$ ffmpeg -loglevel 40 -y -i BQMall_832x480_60_QP46.hevc tmp.yuv
ffmpeg version N-83136-gbdbbb8f Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --enable-gpl --enable-libx264
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 73.100 / 57. 73.100
  libavformat    57. 62.100 / 57. 62.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 69.100 /  6. 69.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[hevc @ 0x2ce3380] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
Input #0, hevc, from 'BQMall_832x480_60_QP46.hevc':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: hevc (Main), 1 reference frame, yuv420p(tv), 832x480, 60 fps, 60 tbr, 1200k tbn, 60 tbc
[graph 0 input from stream 0:0 @ 0x2df3300] w:832 h:480 pixfmt:yuv420p tb:1/1200000 fr:60/1 sar:0/1 sws_param:flags=2
Output #0, rawvideo, to 'tmp.yuv':
  Metadata:
    encoder         : Lavf57.62.100
    Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 832x480, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
    Metadata:
      encoder         : Lavc57.73.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> rawvideo (native))
Press [q] to stop, [?] for help
*** 1 dup!
No more output streams to write to, finishing.
frame=  602 fps=0.0 q=-0.0 Lsize=  352170kB time=00:00:10.05 bitrate=287062.4kbits/s dup=1 drop=0 speed=32.4x    
video:352170kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Input file #0 (BQMall_832x480_60_QP46.hevc):
  Input stream #0:0 (video): 601 packets read (322614 bytes); 601 frames decoded; 
  Total: 601 packets (322614 bytes) demuxed
Output file #0 (tmp.yuv):
  Output stream #0:0 (video): 602 frames encoded; 602 packets muxed (360622080 bytes); 
  Total: 602 packets (360622080 bytes) muxed

This is interesting. ffmpeg reports a *** 1 dup! None of my other decoders or analysis tools does this.

comment:4 by Carl Eugen Hoyos, 7 years ago

Component: avcodecundetermined
Keywords: regression added
Priority: normalimportant
Reproduced by developer: set
Status: newopen

Regression since c5092025901b37aa5de4f290afb61fc5377eb79d, related to ticket #3052.

comment:5 by figgis, 7 years ago

using -vsync passthrough seems to solve the problem. Still curious about this behaviour though.

$ ffmpeg -loglevel 40 -y -vsync passthrough -i BQMall_832x480_60_QP46.hevc tmp.yuv
ffmpeg version N-83136-gbdbbb8f Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --enable-gpl --enable-libx264
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 73.100 / 57. 73.100
  libavformat    57. 62.100 / 57. 62.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 69.100 /  6. 69.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[hevc @ 0x25173e0] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
Input #0, hevc, from 'BQMall_832x480_60_QP46.hevc':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: hevc (Main), 1 reference frame, yuv420p(tv), 832x480, 60 fps, 60 tbr, 1200k tbn, 60 tbc
[graph 0 input from stream 0:0 @ 0x2627780] w:832 h:480 pixfmt:yuv420p tb:1/1200000 fr:60/1 sar:0/1 sws_param:flags=2
Output #0, rawvideo, to 'tmp.yuv':
  Metadata:
    encoder         : Lavf57.62.100
    Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 832x480, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
    Metadata:
      encoder         : Lavc57.73.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> rawvideo (native))
Press [q] to stop, [?] for help
No more output streams to write to, finishing.
frame=  601 fps=0.0 q=-0.0 Lsize=  351585kB time=00:00:10.03 bitrate=287061.6kbits/s speed=  34x    
video:351585kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Input file #0 (BQMall_832x480_60_QP46.hevc):
  Input stream #0:0 (video): 601 packets read (322614 bytes); 601 frames decoded; 
  Total: 601 packets (322614 bytes) demuxed
Output file #0 (tmp.yuv):
  Output stream #0:0 (video): 601 frames encoded; 601 packets muxed (360023040 bytes); 
  Total: 601 packets (360023040 bytes) muxed

comment:6 by Michael Niedermayer, 7 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.