feizc / CogvideX-Interpolation

Keyframe Interpolation with CogvideoX
87 stars 2 forks source link

Cannot get export_to_video(video_save_path, fps=8) to work #3

Open SoftologyPro opened 1 month ago

SoftologyPro commented 1 month ago

First it complained about needing opencv-python, so I installed that. Then it complained it needs imageio-ffmpeg and imageio, so I instaled those.

Now it complians...

Traceback (most recent call last):
  File "D:\Tests\CogVideoX-Interpolation\CogvideX-Interpolation\inference.py", line 73, in <module>
    export_to_video(args2.video_save_path, fps=args2.fps)
  File "D:\Tests\CogVideoX-Interpolation\CogvideX-Interpolation\venv\lib\site-packages\diffusers\utils\export_utils.py", line 182, in export_to_video
    writer.append_data(frame)
  File "D:\Tests\CogVideoX-Interpolation\CogvideX-Interpolation\venv\lib\site-packages\imageio\core\format.py", line 575, in append_data
    raise ValueError("append_data requires ndarray as first arg")
ValueError: append_data requires ndarray as first arg

What packages do I need (other than in your requirement.txt) to get the movie saving working?

These are the additional packages I added trying to fix it.

pip install sentencepiece==0.2.0
pip install opencv-python==4.10.0.84
pip install imageio-ffmpeg==0.5.1
pip install imageio==2.36.0
SoftologyPro commented 1 month ago

If I remove opencv-python, imageio-ffmpeg and imageio, it gives this error

It is recommended to use `export_to_video` with `imageio` and `imageio-ffmpeg` as a backend.
These libraries are not present in your environment. Attempting to use legacy OpenCV backend to export video.
Support for the OpenCV backend will be deprecated in a future Diffusers version
Traceback (most recent call last):
  File "D:\Tests\CogVideoX-Interpolation\CogvideX-Interpolation\inference.py", line 73, in <module>
    export_to_video(args2.video_save_path, fps=args2.fps)
  File "D:\Tests\CogVideoX-Interpolation\CogvideX-Interpolation\venv\lib\site-packages\diffusers\utils\export_utils.py", line 154, in export_to_video
    return _legacy_export_to_video(video_frames, output_video_path, fps)
  File "D:\Tests\CogVideoX-Interpolation\CogvideX-Interpolation\venv\lib\site-packages\diffusers\utils\export_utils.py", line 121, in _legacy_export_to_video
    raise ImportError(BACKENDS_MAPPING["opencv"][1].format("export_to_video"))
ImportError:
export_to_video requires the OpenCV library but it was not found in your environment. You can install it with pip: `pip
install opencv-python`

These problems are all with the final export_to_video. It seems to run fine and generate the frames before that.

SoftologyPro commented 1 month ago

If I install just opencv-python I get this error

It is recommended to use `export_to_video` with `imageio` and `imageio-ffmpeg` as a backend.
These libraries are not present in your environment. Attempting to use legacy OpenCV backend to export video.
Support for the OpenCV backend will be deprecated in a future Diffusers version
Traceback (most recent call last):
  File "D:\Tests\CogVideoX-Interpolation\CogvideX-Interpolation\inference.py", line 73, in <module>
    export_to_video(args2.video_save_path, fps=args2.fps)
  File "D:\Tests\CogVideoX-Interpolation\CogvideX-Interpolation\venv\lib\site-packages\diffusers\utils\export_utils.py", line 154, in export_to_video
    return _legacy_export_to_video(video_frames, output_video_path, fps)
  File "D:\Tests\CogVideoX-Interpolation\CogvideX-Interpolation\venv\lib\site-packages\diffusers\utils\export_utils.py", line 132, in _legacy_export_to_video
    h, w, c = video_frames[0].shape
AttributeError: 'str' object has no attribute 'shape'