Hacking WebM to act like WebP

Script from last thread:
for %%f IN (*.png, *jpg) do (
ffmpeg -loop 1 -i "%%f" -filter:v hqdn3d=8.0:8.0:10.0:10.0 -c:v libvpx -qmin 16 -qmax 16 -quality best -t 2 -r 1 "%%~nf.webm"
)

>*NEW* processes both PNG and JPG with a single script
>*NEW* post processing added to increase compression

Attached: 1521830159820.webm (760x400, 22K)

Other urls found in this thread:

ffmpeg.org/ffmpeg-filters.html#hqdn3d-1
caniuse.com/#feat=webp
wiki.termux.com/wiki/Shells
my.mixtape.moe/lnxgpl.webp
my.mixtape.moe/qstlpm.webp
rbt.asia/g/thread/54928193
twitter.com/SFWRedditVideos

Here's the original image.

Attached: 1521830159820.png (760x400, 381K)

Attached: i4eKfmZ.webm (1024x887, 77K)

Original for this one.

Attached: i4eKfmZ.png (1024x887, 391K)

I still can see things thinging in your webm.

How noticeable? smoothing filter should have helped with that.

Attached: 1465101708732.webm (800x800, 25K)

Oh fuck, you can tell this one has that. It's like it's alive and beating...

Attached: 1465101708732.jpg (800x800, 319K)

Modified -t and -r parameters to 1. Artifacting seems to be gone but cpu usage is spiking...

Attached: 1465101708732.webm (800x800, 23K)

wow! this reminds me of those "Compress this image for me" threads. those were fun. thanks for putting in the work user!

Only added the smoothing filter to the script from a thread a while back. There's just this 1 weird problem I can't seem to solve: when setting webm duration and frame rate to 1, the cpu usage goes up but the "pulsing" artifact is gone. Any help on this would be greatly appreciated.

>tfw the transcode makes JPGs look better

Attached: Sister-Maria.webm (1440x810, 58K)

wtf

Attached: Sister-Maria.jpg (1440x810, 149K)

probably the deblocking filter?

What does "hqdn3d=8.0:8.0:10.0:10.0" do?

Denoiser filter, though I have no idea what the numbers mean senpai.

ffmpeg.org/ffmpeg-filters.html#hqdn3d-1

Attached: 6c72fa4761.webm (530x325, 15K)

Attached: 6c72fa4761.jpg (530x325, 27K)

cool

What's the use?

Better image compression and the ability to post process them despite 4chans refusal to adopt webp. Even before the denoiser VP8's deblocking feature already smooths out images by default.

Since vp9 optimized for 4k+ videos, it should compress high res images better too. Unfortunately anhiro will never support it.

lost a lot of detail in the leaves outside and the wall below the window

looks like blurry shit in comparison to

Is there a better denoiser than I know yify uses that or something similar BEFORE encoding their shitty releases to 400MB.

Would adding sharpening filter help?

Im a retard, whats the point of this?

We pretend Jow Forums adopted webp which is about 50% more efficient than JPG and lossless PNG now.

Don't mean to be a brainlet, but bash is telling me
└╼ for %%f IN (*.png, *jpg) do (
bash: syntax error near unexpected token `IN'

This should probably be limited to images that fit inside a 480p-720p frame, anything big like feels out of place.

It's for windows m8, you're gonna have to freetard yourself out of this one on your own.

Is this disabling the chroma subsampling as well?
It's quite darn useful with jpeg.

Attached: subnosub.png (188x116, 15K)

VP8 does 420 blaze it faggot afaik

edge and firefox have finally announced they're going to support webp

caniuse.com/#feat=webp

lol, now when safari adopts it macfaggots will call it "revolutionary".

Ah, I could probably do something with find then

Didn't even have to do that
mkdir out
for f in *.{png,jpg}; do ffmpeg -loop 1 -i "$f" -filter:v hqdn3d=8.0:8.0:10.0:10.0 -c:v libvpx -qmin 16 -qmax 16 -quality best -t 2 -r 1 "out/${f%.*}.webm"; done

I wish I was as smart as you user. Life as a dipshit is so hard, you wouldn't believe.

Attached: 1478201807359.jpg (775x837, 69K)

what exactly is going on in this thread

People transcoding images to webms with a blur filter

That's nice and all, but should only really be used when you're dealing with pictures that you couldn't post otherwise. Most images on here already look like shit. Encoding them lossy again and on top of that with a denoise filter shouldn't be the to-go solution.
Plus you can't do lossless compression like with WebP, since VP8 doesn't support it.

Also pictures like this can be effectively optimized without introducing additional losses.

You need to use two passes. libvpx's single pass bitrate control is basically broken.

NLMeans is a great denoiser, although you have to be careful not to smoothen the picture too much. It was designed for old VHS footage.

Attached: 1516330863554.png (1024x887, 180K)

Holy shit. OP not bad

To bad I can't post images with 4k resolution

Attached: Screenshot_20181110_194211.png (1247x742, 183K)

Is this a joke? The garbage you've posted is blurry is shit. It's just crap.
The point of webp is that it can conserve detail and compress better. What you've shown compressed files, but loses a fuckton of detail.

notice how the webm have a smaller file size than the original image?

and lower quality

Attached: 1541822519906.jpg (760x400, 20K)

Attached: youre a fag.webm (760x400, 58K)

Attached: youre a fag.webm (800x800, 68K)

Attached: Sister-Maria.webm (1440x810, 136K)

The problem with this is that you can't zoom easily.

OP is fucking retarded with his shitty ass blur filter.

ffmpeg -t 1 -loop 1 -r 1 -i %1 -c:v libvpx -quality best -qmin 1 -qmax 5 -an -sn -y -f webm "%~n1.webm"

Save that as a .bat and drag and drop your image on it.
You do lose quality and your image will get a bit blurry, but I think it's an acceptabl-ish amount. It's certainly not as retarded as OP's webms.
It works best for real life photos. Line art and plain color images do not get compressed well at all.

Attached: 1478201807359.webm (775x837, 55K)

Play with the qmin and qmax values for better quality and worse compression.
Ultimately, saving images as webm is retarded.

Attached: 1521830159820.webm (760x400, 50K)

how do i use the script? do is ,/ script.sh file nameE?

high cpu, that's why OP uses -t 2 -r 1

Save it as a .BAT in a text editor, put it in the directory of images, and double click it. This assumes you have ffmpeg installed.

>hqdn3d=8.0:8.0:10.0:10.0
Those are pretty high values (especially for the spacial denoising). No wonder the pictures look washed out. Wouldn't even recommend those settings for grainy Blurays.
Also not sure how much of an effect the temporal denoising even has in this situation. I'm no expert, but doesn't it compare consecutive frames and average the movement? Does that even matter when every frame is the same?

The scripts you quoted are batch scripts for Windows.
OP's version gets executed by double clicking it. It'll loop through all JPGs and PNGs in the same directory.
The one from the other user gets executed by dragging and dropping a file onto it.
For Linux use this one . Put it in a shell script and either run bash script.sh or make it executable and run it via ./script.sh . This one will also loop through all JPGs and PNGs in the same directory.

Attached: output.webm (637x480, 36K)

High cpu

higher cpu

temporal denoiser is supposed to help reduce the "pulsing" of the image since 2 frames are generated with -t 2 -r 2 to reduce cpu usage

>high cpu
Does not matter. They're fucking reaction images. As I said, converting images to webm is stupid.

The pulsing would be unlikely to occur if you would you constant quality. For example let's compare
ffmpeg -loop 1 -i in.jpg -t 2 -r 1 -c:v libvpx -crf 16 -b:v 0 out.webm
(that's how you use constant quality with libvpx)
vs.
ffmpeg -loop 1 -i in.jpg -t 2 -r 1 -c:v libvpx -qmin 16 -qmax 16 out.webm
vs.
ffmpeg -loop 1 -i in.jpg -t 2 -r 1 -c:v libvpx -qmin 16 -qmax 16 -vf hqdn3d=8:8:10:10 out.webm

After each webm was made I extracted the 2 frames via
ffmpeg -i out.webm -vf fps=1 "%02d.png"
and compared them via ImageMagick
compare -compose src 01.png 02.png diff.png
Red marks areas where 02.png differs from 01.png.

First the result of using constant quality.

Attached: diff_constant_quality.png (1920x1200, 633)

Now OP's approach but without denoising.

Attached: diff_whatever_OP_is_doing.png (1920x1200, 21K)

And now OP's original approach.

Attached: diff_whatever_OP_is_doing_but_with_denoising.png (1920x1200, 25K)

Also for anyone who wants to test it as well, here's the source picture.
Originally it was a JPG, but in order to prevent further generational loss I'll post it as PNG.

Attached: in.png (1920x1200, 1.32M)

>hqdn3d=8.0:8.0:10.0:10.0
enjoy your oil painting

The two pictures have different colors of the skin. The WebP is more reddish.

Same here.

How the fuck do you run bash scripts on termux without root?

Attached: Screenshot_2018-11-10-08-16-54(1).jpg (720x269, 63K)

sh webm_c.hs
or
chmod +x webm_c.hs && ./webm_c.hs

And since I was testing it here some additional infos.
>constrained quality delivers the same results as constant quality with a high enough bitrate specified (in this case 10M)
>constrained quality with 2 passes differs even less
>constant quality with 2 passes is still better than OP's approach but much worse than when using a single pass

bless you user, though now pic related happens with

mkdir out
for f in *.{png,jpg}; do ffmpeg -loop 1 -i "$f" -filter:v hqdn3d=8.0:8.0:10.0:10.0 -c:v libvpx -qmin 16 -qmax 16 -quality best -t 2 -r 1 "out/${f%.*}.webm"; done

:(

Attached: Screenshot_2018-11-10-08-25-49(1).jpg (720x114, 30K)

2nd is better

Attached: Screenshot 2018-11-10 at 15.26.50.png (834x849, 441K)

What shells are available on your system? The brace expansion isn't defined by POSIX, so your system's shell might not support it.

bash is default

wiki.termux.com/wiki/Shells

Then the only other explanation is that the script doesn't find any JPGs or PNGs in the directory (even though suggests otherwise).

I'm so fucking dumb user, all I had to do was run it with bash. Thank you for putting up with me.

Attached: Michael-Scott-Sad-Face-Funny-Picture.webm (982x1024, 27K)

Alternatively put this shebang right at the start of your script
#!/bin/bash

No dice but just glad bash werks™. This is fun, now Jow Forums will be twice as insufferable.

Attached: just.webm (955x610, 48K)

that's not much savings
here's a comparison with just having jpegoptim target the same filesize

Attached: test.jpg (1440x810, 138K)

And the colors are different, for some reason.

>People pretending to have a feature that will never be implemented because hiro and the mods don't give a single fuck about this dead grave of a site except for the traffic and adbux it brings them.
I don't know whether I should feel sad or amazed at the delusion of some people here.

Attached: 1489432763581.gif (470x353, 999K)

You just reintroduced the jpg artifacts lmao.

Hey, guys, I did it! Check out that file size.

ffmpeg -t 2 -loop 1 -r 1 -i %1 -c:v libvpx -quality best -qmin 63 -crf 63 -qmax 63 -an -y -f webm "%~n1.webm"

Attached: Sister-Maria.webm (1440x810, 12K)

For the file size that's fucking crazy. Can you go any lower?

I tried setting the quality to realtime instead of best, but it gives me 16 KB for some reason.

12,174 bytes
This one is 11,398 bytes

Attached: Sister-Maria.webm (1440x810, 11K)

By the way, the command is the same except for the -t, which is 1 in this case.

Why not BOTH?

Attached: 1489432763581.webm (470x353, 114K)

The colors are all wrong though. Real WebP with roughly the same file size (12,248 bytes compared to the WebM's 12,174 bytes) also looks shit, but at least it got the colours right.
my.mixtape.moe/lnxgpl.webp
>Can you go any lower?
This is the lowest I managed to go with cwebp. 11,868 bytes.
my.mixtape.moe/qstlpm.webp

I don't think anybody here except that retarded OP is arguing that webm is better than webp. I'm pretty sure we're all fucking around with ffmpeg.

There are people out there that think WebP is just VP8 in picture form. Better fight that misconception from the start.
Plus it gives me an excuse to fuck around with cwebp. I normally don't use WebP so it's interesting to see what it can and can't do and how all the settings work.

Hey Jow Forumsoys I just thought of something massively retarded. How practical would it be to cram like 20-40 mango pages in a webm video under 3MB?

Attached: 1511396778699.jpg (900x900, 160K)

You can certainly try.
WebM is a lossy format, though, and if you want to read lossy-compressed to shit manga anywhere, you might as well use any of those hundreds of shitty manga sharing sites.

Like this? You have to play around a bit with the quality parameters, but otherwise totally doable.
Although does have a point.

Attached: test.webm (969x1400, 2.57M)

holy shit

Attached: 1533629109420.jpg (302x371, 72K)

That is a function of Unix not termux. The file itself wasn't given execute privileges. Hence the suggestion to chmod +x. Go look up octal privileges online. Eli computer guy on YouTube has a no bullshit guide that gets to the point without millennial Bing bing wahoo noise, just a whiteboard and explanations.

>youtube video to explain why you need admin pass to run terminal commands
>year of linux desktop soon
lol

Cool. I remember these threads.
rbt.asia/g/thread/54928193

Wish I had more time to play with this stuff today.

Attached: input-00.jpg (736x1018, 92K)

I was really bad at this...

Attached: output-04.webm (736x1018, 55K)

There has to be a sweet spot with PP, highly compressed VP8 images look like oil paintings. Hoe the FUCK does yify do this shit...

Attached: Y50P0vt.webm (439x371, 203K)

gif to webm bash script for anyone interested:

mkdir out
for f in *.gif ; do ffmpeg -i "$f" -filter:v hqdn3d=8.0:8.0:10.0:10.0 -c:v libvpx -b:v 0 -qmin 20 -qmax -crf 30 50 -quality best "out/${f%.*}.webm"; done

Attached: voMzrZYUq9_gW7cx9mAsFpMIuabTcEyaUNJUneXYk.webm (320x320, 34K)

>-filter:v hqdn3d=8.0:8.0:10.0:10.0
Fucking stop. Kill yourself already. ow do you not see that your blurred garbage looks like shit?

people who do this should be jailed

Change the parameters then you dick, I'm just going for small file sizes.

Attached: Screenshot_2018-11-10-12-35-36(1).webm (720x114, 4K)

Why does compression turn me on so much?
Learning how jpg works was one of the best days of my life

Because deep down we're all minimalists.

>tfw the original gif is over 4MB and looks slightly better than this webm

Attached: HardAbandonedChinesecrocodilelizard-size_restricted.webm (435x250, 217K)