Comments (14)
@xgretsch Thank you for the bug report.
Vignesh, could you take a look at this? Thanks.
from libavif.
I can reproduce this issue. Let me take a look.
from libavif.
For some reason, ffmpeg is not preserving the frame rate when converting the GIF to Y4M. If you look at the ffmpeg output:
Input #0, gif, from 'bugreport.gif':
Stream #0:0: Video: gif, bgra, 400x400, 0.50 fps, 100 tbr, 100 tbn
Output #0, yuv4mpegpipe, to 'bugreport.y4m':
Stream #0:0: Video: wrapped_avframe, yuv420p(tv, progressive), 400x400, q=2-31, 200 kb/s, 100 fps, 100 tbn
If i force the frame rate of the y4m conversion with -r 1/2
, then the avif file's rate matches that of the GIF:
ffmpeg -i bugreport.gif -pix_fmt yuv420p -f yuv4mpegpipe -r 1/2 bugreport.y4m
I will take a look and see why ffmpeg is not respecting the GIF's frame rate. In the meantime this is the workaround.
from libavif.
Also, note that you can use ffmpeg to convert the GIF to AVIF directly while respecting the frame rate like so:
ffmpeg -i input.gif -fps_mode passthrough output.avif
from libavif.
I can confirm that your workaround does the job. Many thanks! I assume I should leave the issue open, even though this will fix it for my purposes - but feel free to say otherwise.
from libavif.
Yeah, please leave it open. I will close it once i confirm why ffmpeg does not do this automatically.
from libavif.
Just to keep me on my toes, I now have a different file on which the "passthrough" mode does not work, but for which my original script which went via a y4m intermediate is fine.
![bugreport2](https://github.com/AOMediaCodec/libavif/assets/898362/5f1d44d7-b74f-4978-a822-2829cd8f5bc4)
from libavif.
Here's the output, which seems to have been lost from the previous post:
# ffmpeg -i bugreport2.gif -fps_mode passthrough bugreport2.avif
ffmpeg version 6.1.1-3ubuntu5 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13 (Ubuntu 13.2.0-23ubuntu3)
configuration: --prefix=/usr --extra-version=3ubuntu5 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
libavutil 58. 29.100 / 58. 29.100
libavcodec 60. 31.102 / 60. 31.102
libavformat 60. 16.100 / 60. 16.100
libavdevice 60. 3.100 / 60. 3.100
libavfilter 9. 12.100 / 9. 12.100
libswscale 7. 5.100 / 7. 5.100
libswresample 4. 12.100 / 4. 12.100
libpostproc 57. 3.100 / 57. 3.100
Input #0, gif, from 'bugreport2.gif':
Metadata:
comment : GIF optimized with https://ezgif.com/optimize
Duration: 00:00:10.00, start: 0.000000, bitrate: 160 kb/s
Stream #0:0: Video: gif, bgra, 400x400, 0.50 fps, 0.50 tbr, 100 tbn
Stream mapping:
Stream #0:0 -> #0:0 (gif (native) -> av1 (libaom-av1))
Press [q] to stop, [?] for help
[libaom-av1 @ 0xaaaae58383d0] v3.8.2
[libaom-av1 @ 0xaaaae58383d0] Neither bitrate nor constrained quality specified, using default CRF of 32
[libaom-av1 @ 0xaaaae58383d0] aom_codec_enc_cfg
[libaom-av1 @ 0xaaaae58383d0] generic settings
g_usage: 0
g_threads: 10
g_profile: 1
g_w: 400
g_h: 400
g_bit_depth: 8
g_input_bit_depth: 8
g_timebase: {2/1}
g_error_resilient: 0
g_pass: 0
g_lag_in_frames: 35
[libaom-av1 @ 0xaaaae58383d0] rate control settings
rc_dropframe_thresh: 0
rc_end_usage: 3
rc_twopass_stats_in: (nil)(0)
rc_target_bitrate: 256
[libaom-av1 @ 0xaaaae58383d0] quantizer settings
rc_min_quantizer: 0
rc_max_quantizer: 63
[libaom-av1 @ 0xaaaae58383d0] bitrate tolerance
rc_undershoot_pct: 25
rc_overshoot_pct: 25
[libaom-av1 @ 0xaaaae58383d0] decoder buffer model
rc_buf_sz: 6000
rc_buf_initial_sz: 4000
rc_buf_optimal_sz: 5000
[libaom-av1 @ 0xaaaae58383d0] 2 pass rate control settings
rc_2pass_vbr_bias_pct: 50
rc_2pass_vbr_minsection_pct: 0
rc_2pass_vbr_maxsection_pct: 2000
[libaom-av1 @ 0xaaaae58383d0] keyframing settings
kf_mode: 1
kf_min_dist: 0
kf_max_dist: 9999
[libaom-av1 @ 0xaaaae58383d0] tile settings
tile_width_count: 0
tile_height_count: 0
[libaom-av1 @ 0xaaaae58383d0]
[libaom-av1 @ 0xaaaae58383d0] Failed to initialize encoder: Invalid parameter
[libaom-av1 @ 0xaaaae58383d0] Additional information: g_timebase.num out of range [1..cfg->g_timebase.den]
[vost#0:0/libaom-av1 @ 0xaaaae5838090] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
Error while filtering: Invalid argument
[out#0/avif @ 0xaaaae5832c00] Nothing was written into output file, because at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=N/A bitrate=N/A speed=N/A
Conversion failed!
#
from libavif.
Thanks for the detailed bug report. I was able to reproduce it. This was a bug in libaom and i have sent a patch to fix it here: https://aomedia-review.googlesource.com/c/aom/+/190883
libaom currently doesn't allow an fps of < 1 and this input file has an fps of 0.5. You would have to wait for the patch to land and then update libaom to tip of tree for this to work.
from libavif.
In the meantime, the workaround is to use a different AV1 encoder like rav1e with ffmpeg. This command works for me:
ffmpeg -i bugreport2.gif -fps_mode passthrough -c:v librav1e output.avif
This requires that your ffmpeg must be built with rav1e enabled as a codec.
However, this does come with quality implications. Files produced by rav1e may or may not be as good as libaom.
from libavif.
@xgretsch Thanks for the bug report. Vignesh's bug fix will be in the upcoming libaom v3.9.1 patch release. I will let you know when libaom v3.9.1 is available.
You are using libaom v3.8.2. Will you be able to upgrade to libaom v3.9.1 (when it is available)? Or do you need this bug fixed in a libaom v3.8.3 patch release?
from libavif.
Related Issues (20)
- Sample HDR AVIF decoded to JPG shows incorrect colors HOT 8
- How to build a dynamic library that statically links all dependencies? HOT 1
- Ignore and skip FullBoxes with an unrecognized version
- How to build the.A use of iOS platform? HOT 2
- Make libyuv package-friendly dependency HOT 2
- Roll YCgCo-R out HOT 1
- Add Homebrew install instructions and avifdec/avifenc examples to README HOT 6
- autoconf etc. HOT 1
- avifImageRGBToYUV should set color space to default values HOT 2
- Findrav1e.cmake ignores library dependencies listed in the generated pkgconfig file HOT 5
- [Function Request] avifenc supports svt and rav1e encoder options key-value HOT 2
- MSYS/MinGW32: Linking error, undefined references to Nt file functions HOT 2
- Noticeable color shift HOT 6
- Does CVE-2024-1580 affect libavif with dav1d decoder? HOT 1
- Static build issues on MSYS2 HOT 4
- sharpyuv conversion failed HOT 2
- libavif.a should not be a combined archive library HOT 6
- Not able to build static build on amazon linux 2023 HOT 9
- Avif-alpha is working as expected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libavif.