Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Delay in last GIF frame is incorrect when using gifv #903

@okor

Description

@okor

Thumbor request URL

https://cdn0.vox-cdn.com/thumbor/BbnJ1AHcTSqqFdPKSVuyJgf_yr8=/0x0:2432x1556/1720x0/filters:focal(0x0:2432x1556):gifv():no_upscale()/cdn0.vox-cdn.com/uploads/chorus_asset/file/8251197/7GPW_LivingRoom.gif

Expected behaviour

The resulting GIFv video should be 4 seconds in duration.

Actual behaviour

The video is 2 seconds in duration.

Operating system

OSx & Ubuntu

Your thumbor.conf

...
OPTIMIZERS = [
    # 'thumbor.optimizers.jpegtran',
    'thumbor.optimizers.gifv',
]
...

Source of the bug

I did some debugging and have discovered that this issue is being caused by the scale filter used in the ffmpeg command. The scale filter we are using ensures that the video has an even number of pixels for both width and height - because odd pixel numbers in mp4 at least is not valid and ffmpeg will puke.

I have submitted a bug with ffmpeg https://trac.ffmpeg.org/ticket/6294#ticket

However, in the mean time (which could be an hour or years in ffmpeg world) we have some options on our end as well. Mainly, we could drop the scale filter from the command and instead enforce even number of pixels ourselves before we perform the transformation to mp4/webm format. I have confirmed that removing the filter option fixes this problem.

So, I'd like to get some opinions on what we should do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions