This ports the video format code written for the upstream changes to the ffmpeg implementation. It improves the quality of webm outputs and adds support for additional codecs (h264, h265, av1) It also improves the logging by passing errors and more selectively blocking the logging of encoders. While h265 has been included, most browsers will be unable to display the resulting video.
34 lines
838 B
Python
34 lines
838 B
Python
import os
|
|
import hashlib
|
|
|
|
import folder_paths
|
|
|
|
|
|
folder_paths.folder_names_and_paths["AnimateDiff"] = (
|
|
[
|
|
os.path.join(folder_paths.models_dir, "AnimateDiff"),
|
|
os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "models"),
|
|
],
|
|
folder_paths.supported_pt_extensions,
|
|
)
|
|
folder_paths.folder_names_and_paths["video_formats"] = (
|
|
[
|
|
os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "video_formats"),
|
|
],
|
|
[".json"]
|
|
)
|
|
|
|
|
|
def get_available_models():
|
|
return folder_paths.get_filename_list("AnimateDiff")
|
|
|
|
|
|
def get_model_path(model_name):
|
|
return folder_paths.get_full_path("AnimateDiff", model_name)
|
|
|
|
|
|
def get_model_hash(file_path):
|
|
with open(file_path, "rb") as f:
|
|
bytes = f.read() # read entire file as bytes
|
|
return hashlib.sha256(bytes).hexdigest()
|