[FFmpeg-trac] #8555(undetermined:new): Animated GIF to Video with filters drops the last frame duration
FFmpeg
trac at avcodec.org
Fri Mar 6 22:07:11 EET 2020
#8555: Animated GIF to Video with filters drops the last frame duration
-------------------------------------+-------------------------------------
Reporter: kamermans | Type: defect
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: animated- | Blocked By:
gif gif mp4 |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
http://assets.eleven45.net/testing/ffmpeg-bug/5-sec-last-frame.gif
Summary of the bug:
When converting an animated GIF to video (I'm using h264 yuv420p) with a
filter, the duration of the last frame is lost.
How to reproduce:
Consider this animated GIF: http://assets.eleven45.net/testing/ffmpeg-
bug/5-sec-last-frame.gif (also attached)
It has 6 frames. The first 5 are 0.2s and the last one is 5s.
Without filters, the output video has the expected duration (5x0.2s + 5s =
6s):
{{{
$ ffmpeg -f gif -i 5-sec-last-frame.gif -pix_fmt yuv420p -c:v libx264
-report out-without-filter.mp4
$ ffprobe out-without-filter.mp4 2>&1 | grep Duration
Duration: 00:00:06.00, start: 0.000000, bitrate: 26 kb/s
}}}
With filters, the output video has the wrong duration (1.2s):
{{{
$ ffmpeg -f gif -i 5-sec-last-frame.gif -pix_fmt yuv420p -c:v libx264 -vf
scale=300:300 -report out-with-filter.mp4
$ ffprobe out-with-filter.mp4
Duration: 00:00:01.20, start: 0.000000, bitrate: 87 kb/s
}}}
The last frame should have a duration of 5s, but it's getting a duration
of 0.2s from somewhere.
This is a problem because I am looping these videos as a replacement for
animated GIFs.
I have reproduced this bug on many versions of ffmpeg, but all the
information in this issue was from the latest snapshot/dev version, as
seen in the output.
Input image debug info:
{{{
$ ffmpeg -v 9 -loglevel 99 -i 5-sec-last-frame.gif
ffmpeg version N-96852-g3e9793c Copyright (c) 2000-2020 the FFmpeg
developers
built with gcc 6.4.0 (Alpine 6.4.0)
configuration: --disable-debug --disable-doc --disable-ffplay --enable-
shared --enable-avresample --enable-libopencore-amrnb --enable-
libopencore-amrwb --enable-gpl --enable-libass --enable-fontconfig
--enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-
libopenjpeg --enable-libopus --enable-libtheora --enable-libvorbis
--enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265
--enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl
--enable-libfdk_aac --enable-libkvazaar --enable-libaom --extra-
libs=-lpthread --enable-postproc --enable-small --enable-version3
--enable-libbluray --extra-cflags=-I/opt/ffmpeg/include --extra-
ldflags=-L/opt/ffmpeg/lib --extra-libs=-ldl --prefix=/opt/ffmpeg
libavutil 56. 42.100 / 56. 42.100
libavcodec 58. 73.102 / 58. 73.102
libavformat 58. 39.101 / 58. 39.101
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 77.100 / 7. 77.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with
argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument '99'.
Reading option '-i' ... matched as input url with argument '5-sec-last-
frame.gif'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url 5-sec-last-frame.gif.
Successfully parsed a group of options.
Opening an input file: 5-sec-last-frame.gif.
[NULL @ 0x56392854b5c0] Opening '5-sec-last-frame.gif' for reading
[file @ 0x56392854be00] Setting default whitelist 'file,crypto,data'
Probing gif score:100 size:2048
Probing mp3 score:1 size:2048
Probing gif_pipe score:99 size:2048
[gif @ 0x56392854b5c0] Format gif probed with size=2048 and score=100
[gif @ 0x56392854b5c0] Before avformat_find_stream_info() pos: 0 bytes
read:8910 seeks:0 nb_streams:1
[gif @ 0x56392854b5c0] rfps: 4.583333 0.013889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 4.666667 0.008889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 4.750000 0.005000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 4.833333 0.002222
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 4.916667 0.000556
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 5.000000 0.000000
[gif @ 0x56392854b5c0] rfps: 5.083333 0.000556
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 5.166667 0.002222
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 5.250000 0.005000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 5.333333 0.008889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 5.416667 0.013889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 9.583333 0.013889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 9.666667 0.008889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 9.750000 0.005000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 9.833333 0.002222
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 9.916667 0.000556
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 10.000000 0.000000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 10.083333 0.000556
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 10.166667 0.002222
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 10.250000 0.005000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 10.333333 0.008889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 10.416667 0.013889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 10.500000 0.020000
[gif @ 0x56392854b5c0] rfps: 14.583333 0.013889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 14.666667 0.008889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 14.750000 0.005000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 14.833333 0.002222
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 14.916667 0.000556
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 15.000000 0.000000
[gif @ 0x56392854b5c0] rfps: 15.083333 0.000556
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 15.166667 0.002222
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 15.250000 0.005000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 15.333333 0.008889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 15.416667 0.013889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 19.583333 0.013889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 19.666667 0.008889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 19.750000 0.005000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 19.833333 0.002222
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 19.916667 0.000556
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 20.000000 0.000000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 20.083333 0.000556
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 20.166667 0.002222
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 20.250000 0.005000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 20.333333 0.008889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 20.416667 0.013889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 20.500000 0.020000
[gif @ 0x56392854b5c0] rfps: 24.583333 0.013889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 24.666667 0.008889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 24.750000 0.005000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 24.833333 0.002222
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 24.916667 0.000556
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 25.000000 0.000000
[gif @ 0x56392854b5c0] rfps: 25.083333 0.000556
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 25.166667 0.002222
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 25.250000 0.005000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 25.333333 0.008889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 25.416667 0.013889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 25.500000 0.020000
[gif @ 0x56392854b5c0] rfps: 29.583333 0.013889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 29.666667 0.008889
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 29.750000 0.005000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 29.833333 0.002222
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 29.916667 0.000556
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 30.000000 0.000000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 35.000000 0.000000
[gif @ 0x56392854b5c0] rfps: 40.000000 0.000000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 45.000000 0.000000
[gif @ 0x56392854b5c0] rfps: 50.000000 0.000000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 55.000000 0.000000
[gif @ 0x56392854b5c0] rfps: 60.000000 0.000000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 80.000000 0.000000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 120.000000 0.000000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 240.000000 0.000000
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 29.970030 0.000072
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 59.940060 0.000287
Last message repeated 1 times
[gif @ 0x56392854b5c0] rfps: 14.985015 0.000018
Last message repeated 1 times
[gif @ 0x56392854b5c0] stream 0: start_time: 0.000 duration: 6.000
[gif @ 0x56392854b5c0] format: start_time: 0.000 duration: 6.000 (estimate
from stream) bitrate=11 kb/s
[gif @ 0x56392854b5c0] After avformat_find_stream_info() pos: 8910 bytes
read:8910 seeks:0 frames:6
Input #0, gif, from '5-sec-last-frame.gif':
Duration: 00:00:06.00, start: 0.000000, bitrate: 11 kb/s
Stream #0:0, 6, 1/100: Video: gif, 1 reference frame, bgra, 300x300,
0/1, 0.71 fps, 5 tbr, 100 tbn, 100 tbc
Successfully opened the file.
At least one output file must be specified
[AVIOContext @ 0x5639285540c0] Statistics: 8910 bytes read, 0 seeks
}}}
I created the input file as a clean test image using Photoshop 2020, which
is attached.
I've also attached the full report from both scenarios (with and without
filters) and a diff.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/8555>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list