Iniquitatis / sd-webui-temporal

A "loopback on steroids" type of extension for Stable Diffusion Web UI.
GNU General Public License v3.0
27 stars 0 forks source link

No files to concat #2

Closed lavalava45 closed 10 months ago

lavalava45 commented 10 months ago

Hi - I keep getting these error messages after all frames were generated.

[concat @ 000001d911e00300] No files to concat [in#0 @ 000001d911dc5c40] Error opening input: Invalid data found when processing input Error opening input file untitled-final.lst. Error opening input files: Invalid data found when processing input

Iniquitatis commented 10 months ago

Couldn't reproduce, unfortunately.

  1. Which OS are you on?
  2. What's the version of your Web UI?
    • It's shown at the very bottom of the Web UI page.
  3. Where the output directory of your Web UI is located?
    • You can replace the user name in the path (if it has one) by something else, I just need to understand whether it's located in some protected directory or not.
  4. What's the version of your FFmpeg installation?
    • Open a terminal/command prompt/console and type ffmpeg -version.
  5. Does the manual video rendering work when pressing the Render draft/final button?
    • Try to start the generation with Frame count of 3 and press one of those buttons when it's finished.
lavalava45 commented 10 months ago

Thank you for the quick response!

  1. Windows 11
  2. It's Automatic1111 latest version (constantly update it with git pull at start from the main branch)
  3. d:/stable-diffusion-webui/outputs/temporal
  4. ffmpeg version N-112467-g5ddab49d48-20231017 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 13.2.0 (crosstool-NG 1.25.0.232_c175b21)
  5. Nope, manual video rendering shows "error". And the error message in log is a bit longer

[concat @ 000001cfc5230700] No files to concat [in#0 @ 000001cfc5230580] Error opening input: Invalid data found when processing input Error opening input file untitled-draft.lst. Error opening input files: Invalid data found when processing input Traceback (most recent call last): File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1434, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1335, in postprocess_data prediction_value = block.postprocess(prediction_value) File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\components\video.py", line 281, in postprocess processed_files = (self._format_video(y), None) File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\components\video.py", line 355, in _format_video video = self.make_temp_copy_if_needed(video) File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\components\base.py", line 226, in make_temp_copy_if_needed temp_dir = self.hash_file(file_path) File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\components\base.py", line 190, in hash_file with open(file_path, "rb") as f: FileNotFoundError: [Errno 2] No such file or directory: 'outputs/temporal/untitled-draft.mp4' ** Error running process: D:\stable-diffusion-webui\extensions\sd-dynamic-prompts\scripts\dynamic_prompting.py Traceback (most recent call last): File "D:\stable-diffusion-webui\modules\scripts.py", line 718, in process script.process(p, script_args) File "D:\stable-diffusion-webui\extensions\sd-dynamic-prompts\sd_dynamic_prompts\dynamic_prompting.py", line 481, in process all_prompts, all_negative_prompts = generate_prompts( File "D:\stable-diffusion-webui\extensions\sd-dynamic-prompts\sd_dynamic_prompts\helpers.py", line 93, in generate_prompts all_prompts = prompt_generator.generate(prompt, num_prompts, seeds=seeds) or [""] File "D:\stable-diffusion-webui\venv\lib\site-packages\dynamicprompts\generators\randomprompt.py", line 71, in generate prompts.append(str(next(iter(gen)))) StopIteration

I see it mentions an installed "dynamic prompt" script in the log, I will try to run it with that script disabled.

lavalava45 commented 10 months ago

Nope - it does not help. Now it's (I will copy all the message with shown FFMPEG parameters )

Model loaded in 17.1s (load weights from disk: 0.9s, create model: 1.1s, apply weights to model: 13.0s, load VAE: 0.7s, load textual inversion embeddings: 0.3s, calculate empty prompt: 0.8s). 100%|██████████████████████████████████████████████████████████████████████████████████| 16/16 [00:04<00:00, 3.58it/s] 100%|██████████████████████████████████████████████████████████████████████████████████| 16/16 [00:03<00:00, 4.14it/s] 100%|██████████████████████████████████████████████████████████████████████████████████| 16/16 [00:03<00:00, 4.11it/s] ffmpeg version N-112467-g5ddab49d48-20231017 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 13.2.0 (crosstool-NG 1.25.0.232_c175b21) 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-libharfbuzz --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 --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 --enable-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=20231017 libavutil 58. 27.100 / 58. 27.100 libavcodec 60. 30.102 / 60. 30.102 libavformat 60. 15.100 / 60. 15.100 libavdevice 60. 2.101 / 60. 2.101 libavfilter 9. 11.100 / 9. 11.100 libswscale 7. 4.100 / 7. 4.100 libswresample 4. 11.100 / 4. 11.100 libpostproc 57. 2.100 / 57. 2.100 [concat @ 000001b86d321000] No files to concat [in#0 @ 000001b86d2e7500] Error opening input: Invalid data found when processing input Error opening input file untitled-draft.lst. Error opening input files: Invalid data found when processing input Traceback (most recent call last): File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1434, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1335, in postprocess_data prediction_value = block.postprocess(prediction_value) File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\components\video.py", line 281, in postprocess processed_files = (self._format_video(y), None) File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\components\video.py", line 355, in _format_video video = self.make_temp_copy_if_needed(video) File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\components\base.py", line 226, in make_temp_copy_if_needed temp_dir = self.hash_file(file_path) File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\components\base.py", line 190, in hash_file with open(file_path, "rb") as f: FileNotFoundError: [Errno 2] No such file or directory: 'outputs/temporal/untitled-draft.mp4'

Iniquitatis commented 10 months ago

Could you please open the outputs/temporal/untitled directory and check whether there are any rendered images or not?

lavalava45 commented 10 months ago

Yes, they are there. In the test with 3 frame generation, I have exactly 3 images in this folder. This subfolder is named "2023-12-27" and there is also another subfolder named "session" that contains the session JSON file, starting image, file version.txt, and another subfolder named "buffer" with 2 more files - data.json and 2788123674448.npz

Iniquitatis commented 10 months ago

Honestly, I'm at a loss now: Regardless of how I'm trying to break the video rendering, it doesn't, even if I corrupt the images manually. FFmpeg doesn't seem to detect the images at all in your case. I believe we'll have to investigate this in a different way, if that's okay with you:

  1. Just to be sure:
    1. General/Output/Output directory: outputs/temporal.
    2. General/Output/Project subdirectory: untitled.
    3. General/Output/Frame count: 3.
    4. General/Project/Load parameters: off.
    5. General/Project/Continue from last frame: off.
    6. Hit Generate.
    7. The D:\stable-diffusion-webui\outputs\temporal\untitled should contain a directory named session and three images named 00001.png, 00002.png, and 00003.png.
  2. Go to the D:\stable-diffusion-webui\outputs\temporal directory.
  3. Create a text file named render.bat.
  4. Open it in the Notepad and paste the following content:
    
    @echo off

echo file 'untitled/00001.png' >> frames.txt echo duration 1 >> frames.txt echo file 'untitled/00002.png' >> frames.txt echo duration 1 >> frames.txt echo file 'untitled/00003.png' >> frames.txt echo duration 1 >> frames.txt

ffmpeg -y -r 10 -f concat -i frames.txt -framerate 10 -c:v libx264 -crf 14 -preset veryfast -tune film -pix_fmt yuv420p "untitled-final.mp4"

del frames.txt

pause


5. Save the file and launch it.
lavalava45 commented 10 months ago

The script creates a subfolder named 2023-12-27 (the current date) under the 'untitled' folder, so the path you mentioned in the batch file (untitled/00001.png) doesn't exist. Could this be the reason for the error?

Therefore, I manually changed the path for these 3 frames in your batch file to 00001.png, etc., placed that file into the 2023-12-27 folder, and ran it. This worked without any problems and created an untitled-final.mp4 file with all these 3 frames concatenated.

PS. If this is a real command for FFMPEG from your script, I have a few suggestions

  1. I think these two parameters, -framerate and -r, duplicate each other's function?
  2. Maybe use of GPU acceleration (h264_nvenc codec) will add some speed?
Iniquitatis commented 10 months ago

The script creates a subfolder named 2023-12-27 (the current date) under the 'untitled' folder, so the path you mentioned in the batch file (untitled/00001.png) doesn't exist. Could this be the reason for the error?

Indeed, that's the reason, and the extension shouldn't behave like that. ~Does your Web UI installation have any custom paths configured (Settings/Paths for saving/...), or maybe Settings/Saving images/grids/Images filename pattern contains slashes? A config (D:\stable-diffusion-webui\config.json) would be appreciated for reproducibility.~

I think these two parameters, -framerate and -r, duplicate each other's function?

That's what I thought at first, too. Though, one of those determines the frame rate for each separate frame among the concatenated ones, while another determines the actual video frame rate. To make matters even more confusing, there's also the fps filter, and so on.

Maybe use of GPU acceleration (h264_nvenc codec) will add some speed?

Codecs and additional formats are a bigger project for the future versions. I've intentionally left out the GPU acceleration for now, as video rendering can be started while the frames are still generating, therefore making a busy GPU even busier, putting it at a risk of getting an OOM. Also, I'm not sure about all the configurations, but my i7-2600K from 2011 renders several thousand frames quite quickly. Nonetheless, yes, that's still something to consider.

And thanks for the suggestions!

Iniquitatis commented 10 months ago

Alright, I've finally been able to reproduce the issue, and I couldn't because I had the Settings/Saving images/Saving to a directory/Save images to a subdirectory setting turned off for a long time now. The fix will be uploaded relatively soon.

(By the way, this isn't an issue if the Archive mode setting is enabled in the extension, as it uses a custom image saving code.)

Iniquitatis commented 10 months ago

Done. Please confirm if it works for you as intended.

lavalava45 commented 10 months ago

Thank you very much! It is fixed now. And work without problems.

Iniquitatis commented 10 months ago

Thanks a lot for the cooperation!