AlUlkesh / sd_save_intermediate_images

Save intermediate images during the sampling process
The Unlicense
110 stars 17 forks source link

New feature: Make a video file #11

Closed AlUlkesh closed 1 year ago

AlUlkesh commented 1 year ago

I have just implemented this feature. It uses ffmpy/ffmpeg. In theory that should work for everyone since those are a dependency of gradio. But if you have problems with this, please let me know. 13655-sample 13642-sample

image

AlUlkesh commented 1 year ago

https://github.com/AlUlkesh/sd_save_intermediate_images/commit/441ec8ae3b13a48130ac31823fd4666615a7c9d5

AlUlkesh commented 1 year ago

I added a Smoothing / Interpolate feature. It's a bit on the slow side and gifs get pretty big. But it looks cool...

https://user-images.githubusercontent.com/99896447/212520744-bc2cfddd-98e7-4104-8609-3392f2aba532.mp4

XeonG commented 1 year ago

Can you add some other options for the codec being used?

AlUlkesh commented 1 year ago

Are you thinking of anything in particular?

XeonG commented 1 year ago

It was mainly h264 which I think it does already.. but something is wrong with it in that instagram won't accept it as a video some other setting with the codec it is using.. I've done previous videos about same width/height/lenght/framerate etc and they've been fine... also converting some of them generated from your script with handbrake has worked.. so not sure specifically yet

AlUlkesh commented 1 year ago

You can try using ffmpeg's ffprobe on a file that works, and one that doesn't, maybe we can see what's different then.

XeonG commented 1 year ago

A file that had worked `ffprobe version N-109594-g6161eacc74-20230113 Copyright (c) 2007-2023 the FFmpeg developers built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1) configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20230113 libavutil 57. 43.100 / 57. 43.100 libavcodec 59. 56.100 / 59. 56.100 libavformat 59. 35.100 / 59. 35.100 libavdevice 59. 8.101 / 59. 8.101 libavfilter 8. 53.100 / 8. 53.100 libswscale 6. 8.112 / 6. 8.112 libswresample 4. 9.100 / 4. 9.100 libpostproc 56. 7.100 / 56. 7.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '01692-037-2-forest with city buildings like tokyo in the background high quality 3d sunset.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.76.100 Duration: 00:00:07.70, start: 0.000000, bitrate: 992 kb/s Stream #0:00x1: Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 768x768, 990 kb/s, 10 fps, 10 tbr, 10240 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0]

C:\Projects\Stable_Diffusion\stable-diffusion-webui\outputs\txt2img-images\intermediates\01692>`

AlUlkesh commented 1 year ago

I changed the mp4 parameters to the ones that work for you. Let me know if that does the trick.

I'll add a couple of more options later.

XeonG commented 1 year ago

Thanks I tested it on instagram it works nicely now