hydrus icon indicating copy to clipboard operation
hydrus copied to clipboard

Support ugoira (pixiv)

Open thatfuckingbird opened this issue 5 years ago • 5 comments

With conversion to lossless webm, apng or other formats.

Can look at pixivutil or gallery-dl code for reference on how to do the conversion (both rely on ffmpeg IIRC).

thatfuckingbird avatar Jun 28 '20 16:06 thatfuckingbird

If needed, I can also provide a code example on how to do it with ffmpeg while respecting frame times (since I've done it before in my own application).

imtbl avatar Jun 28 '20 16:06 imtbl

GIF, WebP, APNG are all classics that it should have. In the near future maybe AVIF or JPEG-XL.

DonaldTsang avatar Jul 31 '20 17:07 DonaldTsang

This has been on the radar since (at least) 2016. See: https://www.tumblr.com/hydrus/154428484574/

I understand it's a niche format, but I now have thousands (and several GB) of .zip files that I've been sitting on for years because I haven't been able to properly put them through the F12 filter.

The last mention of this is four years ago, with the acknowledgment of it being something that needed to be done four years before that - so let me revive this issue as one that would greatly benefit my use-case.

- edit - This should have the media-viewer tag, or my comment should be broken out into a separate issue. I already have the .zip files from *booru crawls, but I have no way in-client way to manage these files. My (possibly flawed) assumption is that if the media-type was viewable, it could be seen in the save/delete-filter (and viewer, etc.) too.

- edit 2 - It seems ffmpeg is used by many to convert to a different format, but Pixiv has published how they use jQuery play directly from an uncompressed .zip file here: https://github.com/pixiv/zip_player

Regarding the downloading of ugoria, there is an easy pip3 and pipx installer: https://ugoira.readthedocs.io/ - This can also convert to .gif (undesireable), .webp (lossless), and .apng (lossless). https://ugoira.readthedocs.io/en/latest/usage.html#download-as-other-file-formats

For informational purposes: Danbooru, for example, uses a bookmarklet https://danbooru.donmai.us/static/bookmarklet for uploading this format. Per their documentation, Danbooru has natively supported the format since 2014 (according to their wiki entry for "ugoira_conversion").

bit-9 avatar Mar 16 '24 21:03 bit-9

If anyone is curious this is uigora gallery-dl postprocessor I use; it's two-pass vp9 for maximum quality (so it's triple slow) but it beats gifs, apngs and default vp8 by miles

...
			"ugoira": true,
			"postprocessors": [{
				"name": "ugoira",
				"extension": "webm",
				"ffmpeg-args": ["-hide_banner", "-loglevel", "error", "-stats", "-pix_fmt", "yuv420p", "-g", "9999", "-aq-mode", "0", "-auto-alt-ref", "1", "-lag-in-frames", "25", "-c:v", "libvpx-vp9", "-flags", "global_header", "-movflags", "faststart", "-deadline", "good", "-threads", "1", "-b:v", "10M", "-an", "-sn", "-map", "0:v:0", "-map_metadata", "-1", "-map_chapters", "-1", "-y"],
				"ffmpeg-twopass": true,
				"keep-files": false
			}]

I also have this one for "grainy jpg-ish" uigoras (result looks way nicer and it saves space): ["-hide_banner", "-loglevel", "error", "-stats", "-vf", "nlmeans=s=10.0:p=9", "-pix_fmt", "yuv420p", "-g", "9999", "-aq-mode", "0", "-auto-alt-ref", "1", "-lag-in-frames", "25", "-c:v", "libvpx-vp9", "-flags", "global_header", "-movflags", "faststart", "-deadline", "good", "-threads", "1", "-b:v", "10M", "-an", "-sn", "-map", "0:v:0", "-map_metadata", "-1", "-map_chapters", "-1", "-y"]

loseless preset: ["-hide_banner", "-loglevel", "error", "-stats", "-c:v", "libvpx-vp9", "-an", "-lossless", "1", "-pix_fmt", "yuv444p", "-y"]

and "good enough" vp8 preset for impatient ones: ["-hide_banner", "-loglevel", "error", "-stats", "-c:v", "libx264", "-vf", "crop=trunc(iw/2)*2:trunc(ih/2)*2", "-an", "-b:v", "10M", "-preset", "veryslow", "-pix_fmt", "yuv420p", "-y"]

CatPlanet avatar Mar 17 '24 11:03 CatPlanet

We have a plan for direct support of ugoira in hydrus. As of recently the client already detects ugoira zip files and shows a thumbnail. The next step will be getting the frametimes from the parser and storing them in the db so hydrus can show the animation natively.

floogulinc avatar Mar 17 '24 15:03 floogulinc