Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pixiv animated pictures (Videos, Gif, etc) becomes Image File #2610

Closed
Kukuru97 opened this issue Feb 28, 2022 · 5 comments
Closed

Pixiv animated pictures (Videos, Gif, etc) becomes Image File #2610

Kukuru97 opened this issue Feb 28, 2022 · 5 comments
Assignees
Milestone

Comments

@Kukuru97
Copy link

2022-03-01.01-18-58.mp4

in browser Video/Gif works, but in Grabber Video/Gif becomes Image File (JPG/JPEG/PNG)

Grabber ver 7.7.1
Windows 10 21H2

@GlassedSilver
Copy link
Contributor

Pixiv animations (usually?) are so-called ugoira. [explanation]

tl;dr: custom format, it's not a video nor a gif. If Grabber were able to get proper support for this, especially if transferring from say Pixiv or official Danbooru to a personal Danbooru instance, that'd be super awesome!

For portability and simple uses a download of the Pixiv-provided converted version should/could be offered as well in my humble opinion. :)

@Bionus
Copy link
Owner

Bionus commented Mar 25, 2022

AFAIK ugoira already download properly as ZIP and show as MP4 in the preview for Danbooru.
Although for Pixiv it's a little bit more complicated since they don't provide the metadata in the details page.

@uvhat
Copy link

uvhat commented May 2, 2022

AFAIK ugoira already download properly as ZIP and show as MP4 in the preview for Danbooru. Although for Pixiv it's a little bit more complicated since they don't provide the metadata in the details page.

Here is pretty simple solution :

usual image url looks like:
https://i.pximg.net/img-original/img/2020/10/30/22/04/35/85334976_ugoira0.jpg

ugoira zip url:
https://i.pximg.net/img-zip-ugoira/img/2020/10/30/22/04/35/85334976_ugoira1920x1080.zip or 600x600 for preview

metadata for keyframes:
https://www.pixiv.net/ajax/illust/85334976/ugoira_meta?lang=en

So, here is very simple and dummy but working solution for downloading ugoira zip from pixiv:

in model.js add this lines after var img = parseImage(data, false); in the end of details: { block:

 if(/ugoira0/.test(img.file_url)){
    var zip_file_url = img.file_url;
    zip_file_url = zip_file_url.replace("img-original", "img-zip-ugoira");
    zip_file_url = zip_file_url.replace("ugoira0.jpg", "ugoira1920x1080.zip");
    zip_file_url = zip_file_url.replace("ugoira0.jpeg", "ugoira1920x1080.zip");
    zip_file_url = zip_file_url.replace("ugoira0.png", "ugoira1920x1080.zip");
    zip_file_url = zip_file_url.replace("ugoira0.webp", "ugoira1920x1080.zip");
    img.file_url = zip_file_url;                      
 }

zip is basic 0001 0002 0003 etc frames, so it is possible to convert to gif using full color methodics (slice to 16x16...32x32 64x64 blocks per one 256-color pallete and merge to one full/true color gif file) or mp4/webm using ffmpeg.

@GlassedSilver
Copy link
Contributor

GlassedSilver commented May 2, 2022

you could also inspect danbooru's code logic to see how danbooru handles it.

Keep in mind though for any conversions that they should be optional imho and that generation has to take into account that ugoira's have per-frame timing. gifs don't have that iirc, but proper video containers do support VFR of course.

@Bionus Bionus added this to the 7.8.2 milestone May 4, 2022
@Bionus Bionus self-assigned this May 4, 2022
@Bionus
Copy link
Owner

Bionus commented May 4, 2022

Thanks a lot for that @uvhat, I didn't know Pixiv provided already-made ZIP files.

I just updated the source code to download the ZIP properly and show the first frame as preview on Pixiv. The unfortunate part is that those ZIP don't contain the metadata so can't really be converted "as-is".

As for converting to video (via ffmpeg for example), that's another beast that I believe is kinda out of scope of this specific issue. I think I remember someone opening an issue for that already but I couldn't find it just now (edit: seems to be #2075).

@Bionus Bionus closed this as completed in 7e2f858 Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants