HelixNGC7293 / DeforumStableDiffusionLocal

Local version of Deforum Stable Diffusion, supports txt settings file input and animation features!
MIT License
713 stars 115 forks source link

FFMPEG error on animation mode #25

Open Baaleos opened 2 years ago

Baaleos commented 2 years ago

No errors while doing setup etc but on running the run.py script with default settings It generates all the frames - but then fails on using FFmpeg to assemble the video

Global seed set to 3521683333 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 17/17 [00:06<00:00, 2.63it/s] <PIL.Image.Image image mode=RGB size=512x512 at 0x7F49F11FD610> Rendering animation frame 27 of 30 creating in between frame 24 tween:0.33 creating in between frame 25 tween:0.67 creating in between frame 26 tween:1.00 beautiful desolate city fill with giant flowers, moody :: by James Jean, Jeff Koons, Dan McPharlin Daniel Merrian :: ornate, dynamic, particulate, rich colors, intricate, elegant, highly detailed, centered, artstation, smooth, sharp focus, octane render, 3d 3521683334 Global seed set to 3521683334 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 17/17 [00:06<00:00, 2.63it/s] <PIL.Image.Image image mode=RGB size=512x512 at 0x7F49F11FD4C0> ./output/out%05d.png -> ./output/out%05d.mp4 b"ffmpeg version 9c33b2f Copyright (c) 2000-2021 the FFmpeg developers\n built with gcc 9.3.0 (crosstool-NG 1.24.0.133_b0863d8_dirty)\n configuration: --prefix=/home/baaleos/miniconda3/envs/ldm --cc=/home/conda/feedstock_root/build_artifacts/ffmpeg_1627813612080/_build_env/bin/x86_64-conda-linux-gnu-cc --disable-doc --disable-openssl --enable-avresample --enable-gnutls --enable-gpl --enable-hardcoded-tables --enable-libfreetype --enable-libopenh264 --enable-libx264 --enable-pic --enable-pthreads --enable-shared --enable-static --enable-version3 --enable-zlib --enable-libmp3lame --pkg-config=/home/conda/feedstock_root/build_artifacts/ffmpeg_1627813612080/_build_env/bin/pkg-config\n libavutil 56. 51.100 / 56. 51.100\n libavcodec 58. 91.100 / 58. 91.100\n libavformat 58. 45.100 / 58. 45.100\n libavdevice 58. 10.100 / 58. 10.100\n libavfilter 7. 85.100 / 7. 85.100\n libavresample 4. 0. 0 / 4. 0. 0\n libswscale 5. 7.100 / 5. 7.100\n libswresample 3. 7.100 / 3. 7.100\n libpostproc 55. 7.100 / 55. 7.100\nHyper fast Audio and Video encoder\nusage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...\n\nUse -h to get full help or, even better, run 'man ffmpeg'\n" Traceback (most recent call last): File "run.py", line 1312, in main() File "run.py", line 1304, in main raise RuntimeError(stderr) RuntimeError: b"ffmpeg version 9c33b2f Copyright (c) 2000-2021 the FFmpeg developers\n built with gcc 9.3.0 (crosstool-NG 1.24.0.133_b0863d8_dirty)\n configuration: --prefix=/home/baaleos/miniconda3/envs/ldm --cc=/home/conda/feedstock_root/build_artifacts/ffmpeg_1627813612080/_build_env/bin/x86_64-conda-linux-gnu-cc --disable-doc --disable-openssl --enable-avresample --enable-gnutls --enable-gpl --enable-hardcoded-tables --enable-libfreetype --enable-libopenh264 --enable-libx264 --enable-pic --enable-pthreads --enable-shared --enable-static --enable-version3 --enable-zlib --enable-libmp3lame --pkg-config=/home/conda/feedstock_root/build_artifacts/ffmpeg_1627813612080/_build_env/bin/pkg-config\n libavutil 56. 51.100 / 56. 51.100\n libavcodec 58. 91.100 / 58. 91.100\n libavformat 58. 45.100 / 58. 45.100\n libavdevice 58. 10.100 / 58. 10.100\n libavfilter 7. 85.100 / 7. 85.100\n libavresample 4. 0. 0 / 4. 0. 0\n libswscale 5. 7.100 / 5. 7.100\n libswresample 3. 7.100 / 3. 7.100\n libpostproc 55. 7.100 / 55. 7.100\nHyper fast Audio and Video encoder\nusage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...\n\nUse -h to get full help or, even better, run 'man ffmpeg'\n"

centrdev commented 2 years ago

hey, i had a similar error and solved it thanks to this : https://github.com/HelixNGC7293/DeforumStableDiffusionLocal/issues/16

make sure you have it like this: "animation_mode":"Video Input" "seed_behavior":"fixed"

the seed behavior is not that important, but make sure you type "Video Input" and not "video_input" try that

BEpresent commented 2 years ago

I had the same error on my Linux based system. I was able to fix it by making a small change in the run.py file:

At the bottom it defines the command to create the video file with ffmpeg. I have added cmd = ' '.join(cmd) after it to turn the list into a string that can be processed afterwards.

cmd = ['ffmpeg',
    '-y',
    '-vcodec', 'png',
    '-r', str(fps),
    '-start_number', str(0),
    '-i', image_path,
    '-frames:v', max_frames,
    '-c:v', 'libx264',
    '-vf',
    f'fps={fps}',
    '-pix_fmt', 'yuv420p',
    '-crf', '17',
    '-preset', 'veryfast',
    mp4_path ]
# This is new:
cmd = ' '.join(cmd) 
Weifeng-Chen commented 1 year ago

I had the same error on my Linux based system. I was able to fix it by making a small change in the run.py file:

At the bottom it defines the command to create the video file with ffmpeg. I have added cmd = ' '.join(cmd) after it to turn the list into a string that can be processed afterwards.

cmd = ['ffmpeg',
    '-y',
    '-vcodec', 'png',
    '-r', str(fps),
    '-start_number', str(0),
    '-i', image_path,
    '-frames:v', max_frames,
    '-c:v', 'libx264',
    '-vf',
    f'fps={fps}',
    '-pix_fmt', 'yuv420p',
    '-crf', '17',
    '-preset', 'veryfast',
    mp4_path ]
# This is new:
cmd = ' '.join(cmd) 

thanks, this work for me.