#6302 closed defect (duplicate)
gif frame delay dropped from last frame when output to webm
Reported by: | Jason Ormand | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
When converting a gif to a webm video the delay is not honored on the last frame. For example, using a gif with two frames - each with a 2 second delay the output webm video should be 4 seconds in length but the output is 2 seconds long and only those the second frame for an instant.
Inversely, if no filters and mp4 is used, the output is perfect.
Input: https://cdn0.vox-cdn.com/uploads/chorus_asset/file/8251197/7GPW_LivingRoom.gif
Output: <attatched>
How to reproduce:
ffmpeg -i livingroom.gif livingroom.webm
Log:
$ ffmpeg -v 9 -loglevel 99 -report -i livingroom.gif livingroom.webm ffmpeg started on 2017-04-10 at 10:14:17 Report written to "ffmpeg-20170410-101417.log" ffmpeg version N-85306-ge7ec8c1 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 8.0.0 (clang-800.0.42.1) configuration: --enable-gpl --enable-libx264 --enable-libfdk-aac --enable-libvpx --enable-libmp3lame --enable-nonfree libavutil 55. 60.100 / 55. 60.100 libavcodec 57. 92.100 / 57. 92.100 libavformat 57. 72.100 / 57. 72.100 libavdevice 57. 7.100 / 57. 7.100 libavfilter 6. 84.100 / 6. 84.100 libswscale 4. 7.100 / 4. 7.100 libswresample 2. 8.100 / 2. 8.100 libpostproc 54. 6.100 / 54. 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 '-report' ... matched as option 'report' (generate a report) with argument '1'. Reading option '-i' ... matched as input url with argument 'livingroom.gif'. Reading option 'livingroom.webm' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option v (set logging level) with argument 9. Applying option report (generate a report) with argument 1. Successfully parsed a group of options. Parsing a group of options: input url livingroom.gif. Successfully parsed a group of options. Opening an input file: livingroom.gif. [file @ 0x7fb8e3c16d80] Setting default whitelist 'file,crypto' Probing gif score:100 size:2048 Probing mp3 score:1 size:2048 [gif @ 0x7fb8e4014200] Format gif probed with size=2048 and score=100 [gif @ 0x7fb8e4014200] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1 [gif @ 0x7fb8e4014200] stream 0: start_time: -92233720368547760.000 duration: -92233720368547760.000 [gif @ 0x7fb8e4014200] format: start_time: -9223372036854.775 duration: -9223372036854.775 bitrate=0 kb/s [gif @ 0x7fb8e4014200] After avformat_find_stream_info() pos: 3318802 bytes read:6652701 seeks:2 frames:2 Input #0, gif, from 'livingroom.gif': Duration: N/A, bitrate: N/A Stream #0:0, 2, 1/100: Video: gif, 1 reference frame, bgra, 2432x1556, 0/1, 100 tbr, 100 tbn, 100 tbc Successfully opened the file. Parsing a group of options: output url livingroom.webm. Successfully parsed a group of options. Opening an output file: livingroom.webm. [file @ 0x7fb8e3c190c0] Setting default whitelist 'file,crypto' Successfully opened the file. Stream mapping: Stream #0:0 -> #0:0 (gif (native) -> vp9 (libvpx-vp9)) Press [q] to stop, [?] for help cur_dts is invalid (this is harmless if it occurs once at the start per stream) [gif @ 0x7fb8e4025800] code=21 '!' Last message repeated 1 times [gif @ 0x7fb8e4025800] code=2c ',' detected 8 logical cores [graph 0 input from stream 0:0 @ 0x7fb8e3e00300] Setting 'video_size' to value '2432x1556' [graph 0 input from stream 0:0 @ 0x7fb8e3e00300] Setting 'pix_fmt' to value '30' [graph 0 input from stream 0:0 @ 0x7fb8e3e00300] Setting 'time_base' to value '1/100' [graph 0 input from stream 0:0 @ 0x7fb8e3e00300] Setting 'pixel_aspect' to value '0/1' [graph 0 input from stream 0:0 @ 0x7fb8e3e00300] Setting 'sws_param' to value 'flags=2' [graph 0 input from stream 0:0 @ 0x7fb8e3e00300] Setting 'frame_rate' to value '100/1' [graph 0 input from stream 0:0 @ 0x7fb8e3e00300] w:2432 h:1556 pixfmt:bgra tb:1/100 fr:100/1 sar:0/1 sws_param:flags=2 [format @ 0x7fb8e3e009c0] compat: called with args=[yuv420p|yuva420p|yuv422p|yuv440p|yuv444p|gbrp] [format @ 0x7fb8e3e009c0] Setting 'pix_fmts' to value 'yuv420p|yuva420p|yuv422p|yuv440p|yuv444p|gbrp' [auto_scaler_0 @ 0x7fb8e3e00e80] Setting 'flags' to value 'bicubic' [auto_scaler_0 @ 0x7fb8e3e00e80] w:iw h:ih flags:'bicubic' interl:0 [format @ 0x7fb8e3e009c0] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format' [AVFilterGraph @ 0x7fb8e3d00040] query_formats: 4 queried, 2 merged, 1 already done, 0 delayed [auto_scaler_0 @ 0x7fb8e3e00e80] picking yuva420p out of 6 ref:bgra alpha:1 [auto_scaler_0 @ 0x7fb8e3e00e80] w:2432 h:1556 fmt:bgra sar:0/1 -> w:2432 h:1556 fmt:yuva420p sar:0/1 flags:0x4 [libvpx-vp9 @ 0x7fb8e4028000] v1.6.1 [libvpx-vp9 @ 0x7fb8e4028000] --prefix=/usr/local/Cellar/libvpx/1.6.1 --disable-dependency-tracking --enable-pic --disable-unit-tests --disable-examples [libvpx-vp9 @ 0x7fb8e4028000] vpx_codec_enc_cfg [libvpx-vp9 @ 0x7fb8e4028000] generic settings g_usage: 0 g_threads: 8 g_profile: 0 g_w: 320 g_h: 240 g_bit_depth: 8 g_input_bit_depth: 8 g_timebase: {1/30} g_error_resilient: 0 g_pass: 0 g_lag_in_frames: 25 [libvpx-vp9 @ 0x7fb8e4028000] rate control settings rc_dropframe_thresh: 0 rc_resize_allowed: 0 rc_resize_up_thresh: 60 rc_resize_down_thresh: 30 rc_end_usage: 0 rc_twopass_stats_in: 0x0(0) rc_target_bitrate: 256 [libvpx-vp9 @ 0x7fb8e4028000] quantizer settings rc_min_quantizer: 0 rc_max_quantizer: 63 [libvpx-vp9 @ 0x7fb8e4028000] bitrate tolerance rc_undershoot_pct: 25 rc_overshoot_pct: 25 [libvpx-vp9 @ 0x7fb8e4028000] decoder buffer model rc_buf_sz: 6000 rc_buf_initial_sz: 4000 rc_buf_optimal_sz: 5000 [libvpx-vp9 @ 0x7fb8e4028000] 2 pass rate control settings rc_2pass_vbr_bias_pct: 50 rc_2pass_vbr_minsection_pct: 0 rc_2pass_vbr_maxsection_pct: 2000 [libvpx-vp9 @ 0x7fb8e4028000] keyframing settings kf_mode: 1 kf_min_dist: 0 kf_max_dist: 128 [libvpx-vp9 @ 0x7fb8e4028000] [libvpx-vp9 @ 0x7fb8e4028000] vpx_codec_enc_cfg [libvpx-vp9 @ 0x7fb8e4028000] generic settings g_usage: 0 g_threads: 0 g_profile: 0 g_w: 2432 g_h: 1556 g_bit_depth: 8 g_input_bit_depth: 8 g_timebase: {1/100} g_error_resilient: 0 g_pass: 0 g_lag_in_frames: 25 [libvpx-vp9 @ 0x7fb8e4028000] rate control settings rc_dropframe_thresh: 0 rc_resize_allowed: 0 rc_resize_up_thresh: 60 rc_resize_down_thresh: 30 rc_end_usage: 0 rc_twopass_stats_in: 0x0(0) rc_target_bitrate: 200 [libvpx-vp9 @ 0x7fb8e4028000] quantizer settings rc_min_quantizer: 0 rc_max_quantizer: 63 [libvpx-vp9 @ 0x7fb8e4028000] bitrate tolerance rc_undershoot_pct: 25 rc_overshoot_pct: 25 [libvpx-vp9 @ 0x7fb8e4028000] decoder buffer model rc_buf_sz: 6000 rc_buf_initial_sz: 4000 rc_buf_optimal_sz: 5000 [libvpx-vp9 @ 0x7fb8e4028000] 2 pass rate control settings rc_2pass_vbr_bias_pct: 50 rc_2pass_vbr_minsection_pct: 0 rc_2pass_vbr_maxsection_pct: 2000 [libvpx-vp9 @ 0x7fb8e4028000] keyframing settings kf_mode: 1 kf_min_dist: 0 kf_max_dist: 128 [libvpx-vp9 @ 0x7fb8e4028000] [libvpx-vp9 @ 0x7fb8e4028000] vpx_codec_control [libvpx-vp9 @ 0x7fb8e4028000] VP8E_SET_CPUUSED: 1 [libvpx-vp9 @ 0x7fb8e4028000] VP8E_SET_ARNR_MAXFRAMES: 0 [libvpx-vp9 @ 0x7fb8e4028000] VP8E_SET_ARNR_STRENGTH: 3 [libvpx-vp9 @ 0x7fb8e4028000] VP8E_SET_ARNR_TYPE: 3 [libvpx-vp9 @ 0x7fb8e4028000] VP8E_SET_STATIC_THRESHOLD: 0 [libvpx-vp9 @ 0x7fb8e4028000] VP9E_SET_COLOR_SPACE: 0 [libvpx-vp9 @ 0x7fb8e4028000] VP9E_SET_COLOR_RANGE: 0 [libvpx-vp9 @ 0x7fb8e4028000] VP9E_SET_TARGET_LEVEL: 255 [libvpx-vp9 @ 0x7fb8e4028000] Using deadline: 1000000 Output #0, webm, to 'livingroom.webm': Metadata: encoder : Lavf57.72.100 Stream #0:0, 0, 1/1000: Video: vp9 (libvpx-vp9), 1 reference frame, yuva420p, 2432x1556, 0/1, q=-1--1, 200 kb/s, 100 fps, 1k tbn, 100 tbc Metadata: encoder : Lavc57.92.100 libvpx-vp9 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Clipping frame in rate conversion by 0.000008 cur_dts is invalid (this is harmless if it occurs once at the start per stream) [gif @ 0x7fb8e4025800] code=21 '!' [gif @ 0x7fb8e4025800] code=2c ',' cur_dts is invalid (this is harmless if it occurs once at the start per stream) Last message repeated 1 times No more output streams to write to, finishing. Automatically inserted bitstream filter 'vp9_superframe'; args='' [webm @ 0x7fb8e4026800] get_metadata_duration returned: 0 [webm @ 0x7fb8e4026800] Writing block at offset 3, size 6415, pts 0, dts 0, duration 10, keyframe 1 [webm @ 0x7fb8e4026800] Writing block at offset 6846, size 4532, pts 2000, dts 2000, duration 10, keyframe 0 [webm @ 0x7fb8e4026800] end duration = 2010 frame= 2 fps=1.2 q=0.0 Lsize= 12kB time=00:00:02.00 bitrate= 47.8kbits/s speed=1.18x video:11kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.290216% Input file #0 (livingroom.gif): Input stream #0:0 (video): 2 packets read (3318801 bytes); 2 frames decoded; Total: 2 packets (3318801 bytes) demuxed Output file #0 (livingroom.webm): Output stream #0:0 (video): 2 frames encoded; 2 packets muxed (10947 bytes); Total: 2 packets (10947 bytes) muxed 2 frames successfully decoded, 0 decoding errors [AVIOContext @ 0x7fb8e3c18f40] Statistics: 17 seeks, 14 writeouts [AVIOContext @ 0x7fb8e3c16c60] Statistics: 6652701 bytes read, 2 seeks
Change History (3)
comment:1 by , 8 years ago
Component: | ffmpeg → undetermined |
---|---|
Keywords: | gif webm removed |
Priority: | important → normal |
Resolution: | → duplicate |
Status: | new → closed |
follow-up: 3 comment:2 by , 8 years ago
Component: | undetermined → ffmpeg |
---|---|
Priority: | normal → important |
Thank you for responding : )
I did find some other similar bug reports which mentioned -vsync cfr
as a potential work around (for googlers: ffmpeg -i input.gif -r 15 -vsync cfr ouput.webm
is what I used). But that only works if you know what your frame rate should be which we will not. We also don't want to make the video any larger in file size than it needs to be so the video should use the lowest frame rate it can for the content ... but if the gif is 60fps then that's what ffmpeg should do. It also takes between 5-24x time to process vs without a fixed frame rate ... as long as 48seconds for a 2 frame source gif. In our case that won't work as we are using ffmpeg behind a web request.
comment:3 by , 8 years ago
Component: | ffmpeg → undetermined |
---|---|
Priority: | important → normal |
Replying to okor:
But that only works if you know what your frame rate should be which we will not.
That sounds unlikely (the command line you posted makes no sense to me) but please post all usage questions on the user mailing list.
This is a duplicate of several similar tickets, try constant frame rate.
For future tickets: Please remember not to attach output files, they nearly always create confusion. Instead attach input files.