Opened 8 years ago

Closed 8 years ago

Last modified 8 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 8 years ago.
original video
baumgartner_qp32.mp4 (761.6 KB ) - added by MkMs 8 years ago.
-q 32 version
ffmpeg-20140731-105226.log (20.3 KB ) - added by MkMs 8 years ago.
get lower quality video
ffmpeg-20140731-110030.log (12.8 KB ) - added by MkMs 8 years ago.
extract frames from original video (83 frames)
ffmpeg-20140731-110210.log (13.4 KB ) - added by MkMs 8 years ago.
extract frames from -q 32 video (84 frames)

Download all attachments as: .zip

Change History (15)

comment:1 by Carl Eugen Hoyos, 8 years ago

Component: ffmpegundetermined
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.

by MkMs, 8 years ago

Attachment: baumgartner.mp4 added

original video

by MkMs, 8 years ago

Attachment: baumgartner_qp32.mp4 added

-q 32 version

by MkMs, 8 years ago

Attachment: ffmpeg-20140731-105226.log added

get lower quality video

by MkMs, 8 years ago

Attachment: ffmpeg-20140731-110030.log added

extract frames from original video (83 frames)

by MkMs, 8 years ago

Attachment: ffmpeg-20140731-110210.log added

extract frames from -q 32 video (84 frames)

comment:2 by MkMs, 8 years ago

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 by Carl Eugen Hoyos, 8 years ago

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 by MkMs, 8 years ago

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 8 years ago by MkMs (previous) (diff)

comment:5 by Carl Eugen Hoyos, 8 years ago

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 by MkMs, 8 years ago

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 by Carl Eugen Hoyos, 8 years ago

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

comment:8 by MkMs, 8 years ago

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

comment:9 by MkMs, 8 years ago

Resolution: fixed
Status: newclosed

comment:10 by Carl Eugen Hoyos, 8 years ago

Resolution: fixedinvalid
Note: See TracTickets for help on using tickets.