Can the now popular VP9 video hardware decoder be tricked into decoding an "image"?
All this "Webp bad!" talk recently has me curious about something. Since the slop image codec is based on the VP8 video codec, wouldn't it then be possible to also punk out another format like this using VP9? Webp 2 seems to point to this but apparently it's an abandoned project.
https://chromium.googlesource.com/codecs/libwebp2/
Anyway how could this work? I doubt it's as simple as
ffmpeg in.png c:v libvpx-vp9 out.webm
>>105989788 (OP)>I doubt it's as simple aswell? have you fucking tried?
>>105989798Yes and my CPU gets raped to smithereens so obviously there's a lot missing into this hack. I want the VP9 hardware decoder to do the decoding not the CPU. Obviously the thing is expecting video not a fucking image so something must be done to trick it...
I'm gonna try this, convert the image into a webp file and then use that as the input...
FUCK. Didn't work.
Failed to initialize encoder: ABI version mismatch
[vost#0:0/libvpx-vp9 @ 0x7d8a897780] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
An image that looks like a regular VP9 video that's decoded by hardware decoders instead of the CPU. Maybe there's some kind of minimum duration expected by the hardware decoder????
>>105989788 (OP)Av1 and AVIF killed this
>>105990258Yes but this shit hole of a website doesn't support anything good so we have to hack it like sharty did.
>>105989788 (OP)You mean like this? This is all old stuff.
>>105990327This doesn't play at all. We have to bullshit the VP9 hardware decoder into thinking it's decoding actual legitimate video somehow.
You know you can create video files that are 1-frame in length and endlessly loop. Right?
>>105990363Yes but they rape the CPU so it's not bullshitting the hardware VP9 decoder "enough".
My best guess so far is the input image MUST be a lossy .webp file because this is in fact a hacked VP8 video stream. BUTT it's not being hardware decoded...
Here's a quality 100 Webp of
>>105989824https://files.catbox.moe/wvhrx3.webp
Now it just needs to somehow become a "valid" VP9 video stream for the hardware decoder somehow.
BUTT HOW DOE...
>>105990354That's cus your hw decoder sucks and lacks support for 12-bit. Anyway, your research is useless as all of this has been superseded by avif as already mentioned.
>>105990474Nope, this is still not it. CPU goes into overrdrive. A 2 minute duration SHOULD be bullshitting the hardware decoder but yet it's still not enough...
Maybe the hardware decoder just doesn't like iterating through a single video frame over and over again. I looked up online and I found this, maybe this is the key?
https://ottverse.com/how-to-loop-videos-using-ffmpeg-step-by-step-tutorial/
I think I got it, setting the stream loop to 1 and framerate to 1 at the beginning seems to bullshit the hardware decoder enough.
ffmpeg -framerate 1 -stream_loop 1 -i in.webp -c:v libvpx-vp9 -y out.webm
4chan only allows 2048x2048 video res max which is a huge shame since VP9 hardware decoders support 4096x2048, right?
So again this only seems to work if you open your image in something like GIMP and save it to a 100 quality .webp file first FYI.
in
md5: 8e6c226720a78ba1405042ca4cb13db3
🔍
Here's a 2048 x 2048 crop of this nasa image:
https://upload.wikimedia.org/wikipedia/commons/9/91/Bruce_McCandless_II_during_EVA_in_1984.jpg
Saved as a 100 quality Webp file:
https://files.catbox.moe/d70lo0.webp
When I calculate the SSIM compared to the massively bloated JPG of 3.6 MB I get 0.98 SSIM. A high quality score is 0.99 SSIm or greater so default VP9 settings aren't the best, tuning that will be next.
ffmpeg.exe -i out.webm -i in.jpg -lavfi ssim=stats_file=ssim_logfile.txt -f null -
Getting a quality setting to stick seems to be very tricky but I think I managed to force it to stay consistent for images. With a q? min/max + crf value of 5, it produces 0.99 SSIM against the quality 100 .webp input file. VP9 webm file size is roughly 30% smaller than the webp so that aligns with compression efficiency gains expectations as well.
Anyway here's the new webp to vp9 webm conversion params that also focus on the best quality possible and not just the default "good" quality.
ffmpeg -framerate 1 -stream_loop 1 -i in.webp -c:v libvpx-vp9 -quality best -crf 5 -qmin 5 -qmax 5 -y out.webm
in
md5: 1aea41352b010b4aae2b460fd4dcaca7
🔍
One more image before I go find something to eat but yeah pretty cool that if your autism so desired it, it is possible to get highly compressed images on 4chan that are also VP9 hardware decoded through this somewhat convoluted process.
https://files.catbox.moe/03940h.webp
It's interesting to note that converting an image into a "video" doesn't affect black and white images. Only color images are actually affected.
So why doesn't using a normal image format like PNG work? I tried to make one and it won't even play on my phone.
in
md5: 4f3879cec07b9debab8fbb9ad15b411f
🔍
I wonder if transparency works, VP9 supports yuva420p (but not yuva444p sadly).
test2 with -auto-alt-ref 0
test3 with the old vp8 encoder + -auto-alt-ref 0
>alpha mode 1 missing from 4chan webm after upload
Hmm so it seems 4chan strips the transparency metadata from webms you upload here. That fucking blows, this bullshit thread could have been exponentially more useful otherwise. On a related note it seems that ffmpeg supports webp natively now so all of this can be done through 1 line, like this:
for %f in (*.png) do ffmpeg -i "%f" -quality 100 "%~nf.webp" & ffmpeg -framerate 1 -stream_loop 1 -i "%~nf.webp" -c:v libvpx-vp9 -quality best -crf 10 -qmin 10 -qmax 10 "%~nf.webm"
I'm not sure what resolution would be ideal but I'll try to stick with 720p since that seems like the minimum resolution VP9 was intended for and fits nicely on a 1080p display. Also crf 5 seems kinda overkill imho, I don't notice a huge improvement over crf 10 so I'll be using the latter.
Man, this isn't going to be anywhere near as fun because webp transparency is disabled.
>>105990327This would cut down on the phoneposters shitting up our boards with twitter screenshots. I wouldn't mind desu.
OP how many stimulants have you consumed today?
>>105997167Tell that to the dev team that won't allow for better image formats. This is a solution to that problem.
>>105998064I still don't get why they decided to remove it. Does Jay™ really have that much say in the tech stuff?
>>105999339People were hiding pizza in the metadata. 4chinz started scrubbing it all over 3 years ago. Go back.