Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#2499 closed defect (duplicate)

gif -> mp4: wrong timestamps / duration

Reported by: sgehlich Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords: fps
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
When converting .GIFs with different frame durations, the mp4 muxer (same with mpeg2) generates a wrong video with wrong frame durations.

first frame is rendered with default duration
second frame is rendered with the duration the first frame should have
third frame is rendered with the duratino the second frame should have

How to reproduce:

% wget
% ffmpeg -i image.gif -pix_fmt yuv420p ghost.mp4

Attachments (1)

image.gif (480.1 KB) - added by cehoyos 4 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 4 years ago by cehoyos

  • Keywords fps added; gif mp4 muxer removed
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of ticket #1578 and the tickets related to the mov muxer that only supports constant frame rate and therefore defaults to "-r x", work-around is to use -vf fps

For future tickets: Please always post your command line together with the complete, uncut console output.

Changed 4 years ago by cehoyos

comment:2 Changed 4 years ago by sgehlich

Sorry, but -vf fps is not a valid workaround for this issue. The resulting video file does not even have a static frame rate, it's like I mentioned in my original post: The frame durations are right, but displaced.

Version 0, edited 4 years ago by sgehlich (next)

comment:3 Changed 4 years ago by cehoyos

But if you encode to mov, you have to choose a constant frame rate because the mov muxer only supports constant frame rate (if you do not select it yourself with -vf fps, ffmpeg will automatically choose a constant frame rate as if you selected "-r" leading to the bad timestamps that you observed).
Or in other words: The output file in your command line also has constant frame rate (but with incorrect / displaced frame duplication). You can immediately see that when looking at the console output.

comment:4 Changed 3 years ago by Cigaes

The point of -r leading to invalid rounding still stands, though.

Note: See TracTickets for help on using tickets.