mastodon / mastodon

Your self-hosted, globally interconnected microblogging community
https://joinmastodon.org
GNU Affero General Public License v3.0
47.13k stars 6.98k forks source link

two frame gif animations do not loop properly #18044

Closed eslerm closed 1 year ago

eslerm commented 2 years ago

Steps to reproduce the problem

  1. Create/find looping animated gif with two frames and an equal delay on each frame
  2. Upload to Mastodon
  3. Check converted mp4 file

Expected behavior

The delay on each frame is equal.

Actual behavior

The first frame correctly delays. The second frame only displays for a split second.

Specifications

v3.5.1 (mastodon.social)

Here is an example gif which does not work: http://polyducks.co.uk/what-is-textmode/anatomy.gif

With gimp I can duplicate all frames (4 total) and then Mastodon is able to convert the new gif to mp4 with proper delays.

qazmlp commented 1 year ago

This also happens with other GIFs, for example where the last frame has a longer delay to pause between loops.

I assume this happens because the video format uses timecodes rather than frame durations, so an additional time code (or frame?) has to be inserted at the end to cap off the video.

Here's a side-by-side comparison: https://tiggi.es/@Qazm/109943381587454989 The first file was uploaded as WebM (including a duplicate after the pause frame) while the one on the right was a looping GIF with long final frame.

(v4.1.0)

c960657 commented 1 year ago

FWIW this bug is fixed in the next version of ffmpeg (current version is 6.0).

https://trac.ffmpeg.org/ticket/6294

eslerm commented 1 year ago

Thank you @c960657

Closing since servers which want this resolved can use a version of ffmpeg patched with http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=ff72256235aeaa2a4e197b54f69bad36d61a57d0