Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#3817 closed defect (invalid)

h.264: decoding gives duplicated frame

Reported by: MkMs Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: h264
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Using the quantization to get a video version of lower quality (video format is mp4, used h.264 - ).
Bug: Changing frame count - Original video has x frames, the lower quality video has x+1 frames
First and second frame are identical.

How to reproduce:

ffmpeg.exe -i baumgartner.mp4 -c:v libx264 -q:v 32 -pix_fmt yuv420p baumgartner_qp32.mp4

extract png frames out of qp_video to check frame count:
ffmpeg.exe -i baumgartner.mp4 -f image2 -pix_fmt yuv420p baumgartner_%%04d.png
ffmpeg.exe -i baumgartner_qp32.mp4 -f image2 -pix_fmt yuv420p baumgartner_%%04d.png

ffmpeg version N-65107-ga507623 Copyright (c) 2000-2014 the FFmpeg developers built on Jul 29 2014 22:06:30 with gcc 4.8.3 (GCC)

Attachments (5)

baumgartner.mp4 (648.8 KB) - added by MkMs 5 years ago.
original video
baumgartner_qp32.mp4 (761.6 KB) - added by MkMs 5 years ago.
-q 32 version
ffmpeg-20140731-105226.log (20.3 KB) - added by MkMs 5 years ago.
get lower quality video
ffmpeg-20140731-110030.log (12.8 KB) - added by MkMs 5 years ago.
extract frames from original video (83 frames)
ffmpeg-20140731-110210.log (13.4 KB) - added by MkMs 5 years ago.
extract frames from -q 32 video (84 frames)

Download all attachments as: .zip

Change History (15)

comment:1 Changed 5 years ago by cehoyos

  • Component changed from ffmpeg to undetermined
  • Keywords h264 added; h.264 removed

To make this a valid ticket, please provide the command line that does not produce the expected output together with the complete, uncut console output and please provide your input sample.

Note that FFmpeg believes that your input video is vbr, but the FFmpeg mov muxer can only create cbr videos, you may need to specify -vsync 0 to create the same number of input and output frames.

Changed 5 years ago by MkMs

original video

Changed 5 years ago by MkMs

-q 32 version

Changed 5 years ago by MkMs

get lower quality video

Changed 5 years ago by MkMs

extract frames from original video (83 frames)

Changed 5 years ago by MkMs

extract frames from -q 32 video (84 frames)

comment:2 Changed 5 years ago by MkMs

Okay, I hope i got you right, i added missing log-files and video files. Also i tried the -vsync function with the same result.

Thx!

comment:3 Changed 5 years ago by cehoyos

Could you explain what you are trying to do?
For example, this command line makes no sense because png does not support yuv420p:

$ ffmpeg -i baumgartner.mp4 -f image2 -pix_fmt yuv420p baumgartner_%%04d.png

Your original video contains 83 frames and I was unable to force FFmpeg to extract more.

comment:4 Changed 5 years ago by MkMs

First log (ffmpeg-20140731-105226.log​):
Using the quantization to get a video version of lower quality (with artefacts)

Second and third log ( ffmpeg-20140731-110030.log & ffmpeg-20140731-110030.log):
Show/ Check only the absolute number of frames - unnecessary for programming, only to show the possible bug. Even without

-pix_fmt yuv420p

I get one more frame (84 frames than in original "baumgartner.mp4")

You are using libx264?

ffmpeg.exe -i baumgartner.mp4 -c:v libx264 -vsync 0 -q:v 32 -pix_fmt yuv420p baumgartner_qp32.mp4
Last edited 5 years ago by MkMs (previous) (diff)

comment:5 Changed 5 years ago by cehoyos

What is the "possible bug" you want to report?
If you want to know how many frames baumgartner_qp32.mp4 contains, either look at the first log file (it tells you that 83 frames were encoded) or run the second command with -vsync 0.

comment:6 Changed 5 years ago by MkMs

It is true that the log file tell me there are 83 frames, but if i transform the video to png frames i get one more.
If it isn´t a bug, it would be nice to know why. And if you check the first two frames of the lower quality mp4 video, you will see that both are equal.

Maybe you can explain me the reason.

comment:7 Changed 5 years ago by cehoyos

As said, use -vsync 0 in your second command if you don't want FFmpeg to duplicate (or drop) a frame.

comment:8 Changed 5 years ago by MkMs

okay it was my mistake, the use of -vsync make the difference.
Thx!

comment:9 Changed 5 years ago by MkMs

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

comment:10 Changed 5 years ago by cehoyos

  • Resolution changed from fixed to invalid
Note: See TracTickets for help on using tickets.