rav1e
rav1e copied to clipboard
blocks placed at incorrect position or time
Describe the bug
When I am encoding https://www.breunig.xyz/share/2024-04-02/raw9.yuv (150 MB), at around the 12 second mark rav1e produces distorted blocks like so:
When watching the encoded video, it seems as if the video jumps backwards/forwards by a couple of frames, creating a jarring motion. Put differently, this doesn't appear to be just low bitrate "needs more jpeg" effect. I have uploaded a broken example encode here:
https://www.breunig.xyz/share/2024-04-02/70.ivf
From my testing, it appears that rav1e runs into rate control issues at the affected frames. Changing parameters slightly makes the "jarring motion bug" go away, but the "extremely low bitrate" issue stays. For example, if I set --skip 200
the motion looks fine, but it retains the short section of more-than-expected jpeg artifacts:
https://www.breunig.xyz/share/2024-04-02/72.ivf
FWIW, this is not the only video I have observed the issue with, but I haven't done the work to trim down the reproducer there. However, the general video content is the same: coming from a dark area that is relatively static (i.e. the elevator moving up) to a bright area (i.e. outside) with lots of motion ("zoom-in" as I go forward + left/right pans due to making turns).
- I can reproduce the issue on rav1e 0.6.6 (the version shipped on Ubuntu), 0.7.1 shipped in Debian testing and the most recent master commit as of writing.
- This happens on different resolutions, too, i.e. I can generally reproduce this using 1920x1080 or 1280x720
I haven't tested all combinations, but see below for the ones I have with a reasonably short input video.
To Reproduce
testing with Debian shipped rav1e:
rav1e 0.7.1 (UNKNOWN) (release)
unknown rustc version unknown target
Compiled CPU Features: fxsr,sse,sse2
Runtime Assembly Support: Enabled
Runtime Assembly Level: AVX2
Threading: Enabled
Unstable Features: Disabled
Compiler Flags: -Cdebuginfo=2--cap-lintswarn-Clinker=x86_64-linux-gnu-gcc-Clink-arg=-Wl,-z,relro--remap-path-prefix/build/reproducible-path/rust-rav1e-0.7.1=/usr/share/cargo/registry/rav1e-0.7.1--remap-path-prefix/build/reproducible-path/rust-rav1e-0.7.1/debian/cargo_registry=/usr/share/cargo/registry
reproducible? (yes = very obvious, kinda = less so, no = looks normal apart from rate control issue)
↓ command used
↓
YES rav1e raw9.yuv --speed 9 --bitrate 1000 -o 46.ivf
YES rav1e raw9.yuv --speed 10 --bitrate 500 -o 48.ivf
YES rav1e raw9.yuv --speed 9 --bitrate 500 -o 47.ivf
YES rav1e raw9.yuv --speed 8 --bitrate 500 -o 49.ivf
YES rav1e raw9.yuv --speed 7 --bitrate 500 -o 50.ivf
YES rav1e raw9.yuv --speed 6 --bitrate 500 -o 51.ivf
YES rav1e raw9.yuv --speed 5 --bitrate 500 -o 52.ivf
YES rav1e raw9.yuv --speed 4 --bitrate 500 -o 53.ivf
YES rav1e raw9.yuv --speed 3 --bitrate 500 -o 54.ivf
YES rav1e raw9.yuv --speed 2 --bitrate 500 -o 55.ivf
YES rav1e raw9.yuv --speed 1 --bitrate 500 -o 56.ivf
YES RAV1E_CPU_TARGET=rust rav1e raw9.yuv --speed 10 --bitrate 500 -o 57.ivf
YES RAV1E_CPU_TARGET=sse2 rav1e raw9.yuv --speed 10 --bitrate 500 -o 58.ivf
YES RAV1E_CPU_TARGET=ssse3 rav1e raw9.yuv --speed 10 --bitrate 500 -o 59.ivf
YES RAV1E_CPU_TARGET=SSE4_1 rav1e raw9.yuv --speed 10 --bitrate 500 -o 60.ivf
YES RAV1E_CPU_TARGET=AVX2 rav1e raw9.yuv --speed 10 --bitrate 500 -o 61.ivf
YES rav1e raw9.yuv --speed 10 --bitrate 500 -o 64.ivf --skip 50
KINDA rav1e raw9.yuv --speed 10 --bitrate 500 -o 62.ivf --skip 100
NO rav1e raw9.yuv --speed 10 --bitrate 500 -o 63.ivf --skip 200
NO rav1e raw9.yuv --speed 10 --bitrate 250 -o 65.ivf --skip 200
NO rav1e raw9.yuv --speed 10 --bitrate 250 -o 66.ivf --skip 150
NO rav1e raw9.yuv --speed 10 --bitrate 100 -o 67.ivf --skip 150
YES rav1e raw9.yuv --speed 10 --bitrate 100 -o 68.ivf --skip 100
testing with rav1e compiled from source using
RUSTFLAGS="-C target-cpu=native" cargo build --release
at commit f3dd0499f2e6c246d531ab1aab46c1e0bb30b4da:
rav1e 0.7.0 (p20240319) (release)
rustc 1.70.0 x86_64-unknown-linux-gnu
Compiled CPU Features: adx,aes,avx,avx2,bmi1,bmi2,cmpxchg16b,f16c,fma,fxsr,lzcnt,movbe,pclmulqdq,popcnt,rdrand,rdseed,sse,sse2,sse3,sse4.1,sse4.2,ssse3,xsave,xsavec,xsaveopt,xsaves
Runtime Assembly Support: Enabled
Runtime Assembly Level: AVX2
Threading: Enabled
Unstable Features: Disabled
Compiler Flags: -C target-cpu=native
YES ./target/release/rav1e raw9.yuv --speed 10 --bitrate 500 -o 69.ivf
YES ./target/release/rav1e raw9.yuv --speed 10 --bitrate 500 -o 70.ivf --skip 50
KINDA ./target/release/rav1e raw9.yuv --speed 10 --bitrate 500 -o 71.ivf --skip 100
NO ./target/release/rav1e raw9.yuv --speed 10 --bitrate 500 -o 72.ivf --skip 200
Expected behavior
- not have "jarring motion bug" (important)
- maybe not have "extremely low bitrate section" (in my "production" setup I actually don't notice the "low bitrate" effect, but I am also not using 500 or 1000 kbps there. So it seems like a related issue or maybe a trigger, but I believe it's distinct from the jarring motion bug)
Required Information For the custom built version:
$ cargo --version
cargo 1.69.1
$ rustc --version
rustc 1.70.0
$ nasm --version # if on x86_64
NASM version 2.16.01
Operating system (for the detailed tests shown above):
$ uname -a
Linux 6.6.15-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.6.15-2 (2024-02-04) x86_64 GNU/Linux