Kosinkadink / ComfyUI-VideoHelperSuite

Nodes related to video workflows
GNU General Public License v3.0
414 stars 74 forks source link

h264 is not displayed in the format options of Video Combine. #188

Open modmodmodmod opened 3 months ago

modmodmodmod commented 3 months ago

Hi,

I would like to export an h264 video using Video Combine, but the format options are Only gif and webp are displayed.

Following error appears in the ComfyUI startup command.

[VideoHelperSuite] - WARNING - Failed to import imageio_ffmpeg [VideoHelperSuite] - ERROR - No valid ffmpeg found.

There is h264-mp4.json in the video_formats folder of ComfyUI-VideoHelperSuite.

Could you please tell me the cause of this error and how to deal with it?

Environment: Apple M1 MacOS 12.7.4 StabilityMatrix 2.9.2 ComfyUI latest version Python 3.12.2 pip 24.0 ffmpeg version: N-114476-gb89ee26539-tessus ffmpeg directory : /usr/local/bin/ffmpeg

2024-04-09 7 59 31
modmodmodmod commented 3 months ago

Thank you for response.

However, with limited programming knowledge, I'm can't understand the meaning of your post.

Could you please tell the meaning and usage of the two codes you provided?

modmodmodmod commented 3 months ago

Ah, I see, I understand what you mean. I'll rewrite the contents of two files. Thank you again!

AustinMroz commented 2 months ago

That's mostly there for organization of developement. There's no need for you to make manual changes to any files. Those changes will be pushed out as an update soonish once I resolve an unrelated issue, but they won't actually fix the issue you're having, just make it easier to see what the issue is.

You are not able to output with video formats (like h264) because ffmpeg could not be found. The current options to fix this are to:

Edit: That has now been merged. Providing ffmpeg is still required, but a third, potentially easier option now exists.

modmodmodmod commented 2 months ago

Thank you. It seems I misunderstood.

I installed imageio-ffmpeg via pip with the guide by GPT4. Then I installed ffmpeg and added it to the system path.

However, I still encounter following errors on the startup screen of ComfyUI, indicating that imageio_ffmpeg and ffmpeg cannot be loaded:

[VideoHelperSuite] - WARNING - Failed to import imageio_ffmpeg [VideoHelperSuite] - ERROR - No valid ffmpeg found.

The environment on my Mac has changed slightly during the process of installing imageio-ffmpeg and ffmpeg, so I'll provide the current information below:

Environment:

Apple M1 MacOS 12.7.4 StabilityMatrix 2.9.3 Latest version of ComfyUI Python 3.12.2

The versions of StabilityMatrix and ComfyUI have been updated.

Additionally, it seems the version has been updated when I downloaded ffmpeg and saved it directly under the Data folder of StabilityMatrix, and added its path manually to [.zshrc]. (It changed from N-114476-gb89ee26539-tessus to N-114775-g359b6a7f8a-tessus.)

I don't fully understand, but it seems there might be an issue with the configurations of pip, ffmpeg, and imageio-ffmpeg.

When I run [pip --version] in the terminal, it shows [zsh: command not found: pip].

Running [which pip] displays [pip not found].

Running [pip3 --version] shows [pip 24.0 from /opt/homebrew/lib/python3.12/site-packages/pip (python 3.12)].

[which pip3] shows [/opt/homebrew/bin/pip3].

Running [pip show imageio-ffmpeg] displays [zsh: command not found: pip].

[which ffmpeg] shows [/opt/homebrew/bin/ffmpeg].

Running [ffmpeg -version] shows the following:

ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
built with Apple clang version 14.0.0 (clang-1400.0.29.202)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.1.1_7 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
libavutil      58. 29.100 / 58. 29.100
libavcodec     60. 31.102 / 60. 31.102
libavformat    60. 16.100 / 60. 16.100
libavdevice    60.  3.100 / 60.  3.100
libavfilter     9. 12.100 /  9. 12.100
libswscale      7.  5.100 /  7.  5.100
libswresample   4. 12.100 /  4. 12.100
libpostproc    57.  3.100 / 57.  3.100

After these points, GPT4 starts circling back and forth, repeatedly suggesting reinstallations of Python, pip, and ffmpeg.

Also, there has been a half-day discussion regarding the setup of a [virtual environment], but I'm not sure if there has been any progress in the right direction. However, ComfyUI still fails to load imageio_ffmpeg and ffmpeg.

I apologize for bothering you with my lack of programming knowledge, but could you please offer me a bit more guidance?

AustinMroz commented 2 months ago

I'm glad to help I'm sorry to hear you're having continued difficulties with what should have, under ideal circumstances, happened fully automatically.

Just being able to run which ffmpeg should be enough to make things work. The same functionality is used in the code to try and find ffmpeg (shutil.which("ffmpeg")).

How do you normally launch ComfyUI? If you aren't launching ComfyUI through the terminal, it's possible that changes to the path in your .zshrc aren't being applied. Similarly, this is where the (infamous) virtual environments may come into play.

modmodmodmod commented 2 months ago

Thank you!

I launch ComfyUI from the StabilityMatrix launcher.

Therefore, I haven't installed standalone ComfyUI, and consequently, I'm not using the terminal either.

The related files for ComfyUI associated with StabilityMatrix are located at following path:

/Applications/Data/Packages/ComfyUI

The reason I use StabilityMatrix is because I can easily switch between ComfyUI and A1111, which I used before starting to use ComfyUI.

Also, since I don't use the terminal, I can use it easily even though I lack programming knowledge.

If necessary, I think I can also install standalone ComfyUI. However, in the tutorials I often watch on YouTube, they output h264 videos using Video Combine from ComfyUI on StabilityMatrix.

So, I think it's possible in the current environment as well.

How does that sound?

AustinMroz commented 2 months ago

It's absolutely doable (and if it wasn't, I'd consider it a bug I need to fix), but it confirms my hunches.
When you run StabilityMatrix, it's not using the changes to your .zshrc. I don't personally use mac, but it seems the correct way is to edit /etc/paths
StabilityMatrix uses a virtual environment so only python packages installed to it's virtual environment will be visible. From my quick testing, you should be able to open a terminal and run:

cd /Applications/Data/Packages/ComfyUI
venv/bin/pip install imageio-ffmpeg
modmodmodmod commented 2 months ago

Thank you for advice! I ran the following code in terminal.

cd /Applications/Data/Packages/ComfyUI venv/bin/pip install imageio-ffmpeg

Then the following output was displayed.

Requirement already satisfied: imageio-ffmpeg in ./venv/lib/python3.10/site-packages (0.4.9) Requirement already satisfied: setuptools in ./venv/lib/python3.10/site-packages (from imageio-ffmpeg) (69.1.1)

Then I restarted Mac and launched ComfyUI on StabilityMatrix, but unfortunately, the following error still appeared.

[VideoHelperSuite] - WARNING - Failed to import imageio_ffmpeg [VideoHelperSuite] - ERROR - No valid ffmpeg found.

The entire command line from the boot screen is as follows. Can you deduce anything from this?

ComfyUI startup time: 2024-04-10 15:00:59.636191 Platform: Darwin Python version: 3.10.11 (main, May 7 2023, 17:32:05) [Clang 16.0.3 ] Python executable: /Applications/Data/Packages/ComfyUI/venv/bin/python3 ** Log path: /Applications/Data/Packages/ComfyUI/comfyui.log

Prestartup times for custom nodes: 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/rgthree-comfy 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-Manager

Total VRAM 16384 MB, total RAM 16384 MB Forcing FP16. Set vram state to: SHARED Device: mps VAE dtype: torch.float32 Using pytorch cross attention Adding extra search path checkpoints /Applications/Data/Models/StableDiffusion Adding extra search path vae /Applications/Data/Models/VAE Adding extra search path loras /Applications/Data/Models/Lora Adding extra search path loras /Applications/Data/Models/LyCORIS Adding extra search path upscale_models /Applications/Data/Models/ESRGAN Adding extra search path upscale_models /Applications/Data/Models/RealESRGAN Adding extra search path upscale_models /Applications/Data/Models/SwinIR Adding extra search path embeddings /Applications/Data/Models/TextualInversion Adding extra search path hypernetworks /Applications/Data/Models/Hypernetwork Adding extra search path controlnet /Applications/Data/Models/ControlNet Adding extra search path controlnet /Applications/Data/Models/T2IAdapter Adding extra search path clip /Applications/Data/Models/CLIP Adding extra search path clip_vision /Applications/Data/Models/InvokeClipVision Adding extra search path diffusers /Applications/Data/Models/Diffusers Adding extra search path gligen /Applications/Data/Models/GLIGEN Adding extra search path vae_approx /Applications/Data/Models/ApproxVAE Adding extra search path ipadapter /Applications/Data/Models/IpAdapter Adding extra search path ipadapter /Applications/Data/Models/InvokeIpAdapters15 Adding extra search path ipadapter /Applications/Data/Models/InvokeIpAdaptersXl Adding extra search path prompt_expansion /Applications/Data/Models/PromptExpansion

Loading: ComfyUI-Manager (V2.10.2)

ComfyUI Revision: 2120 [4201181b] | Released on '2024-04-09'

(pysssss:WD14Tagger) [DEBUG] Available ORT providers: CoreMLExecutionProvider, AzureExecutionProvider, CPUExecutionProvider (pysssss:WD14Tagger) [DEBUG] Using ORT providers: CUDAExecutionProvider, CPUExecutionProvider WAS Node Suite: Importing styles from /Applications/Data/Packages/ComfyUI/styles.csv. WAS Node Suite: Styles import complete. [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json WAS Node Suite: OpenCV Python FFMPEG support is enabled WAS Node Suite: ffmpeg_bin_path is set to: /usr/local/bin/ffmpeg [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json WAS Node Suite: Finished. Loaded 211 nodes successfully.

"Success is not just about making money. It's about making a difference." - Unknown

[rgthree] Loaded 36 fantastic nodes. [rgthree] Will use rgthree's optimized recursive execution.

Loading: ComfyUI-Impact-Pack (V4.87)

Loading: ComfyUI-Impact-Pack (Subpack: V0.4)

[Impact Pack] Wildcards loading done. [comfyui_controlnet_aux] | INFO -> Using ckpts path: /Applications/Data/Packages/ComfyUI/custom_nodes/comfyui_controlnet_aux/ckpts [comfyui_controlnet_aux] | INFO -> Using symlinks: False [comfyui_controlnet_aux] | INFO -> Using ort providers: ['CUDAExecutionProvider', 'DirectMLExecutionProvider', 'OpenVINOExecutionProvider', 'ROCMExecutionProvider', 'CPUExecutionProvider', 'CoreMLExecutionProvider'] DWPose: Onnxruntime with acceleration providers detected FizzleDorf Custom Nodes: Loaded [VideoHelperSuite] - WARNING - Failed to import imageio_ffmpeg [VideoHelperSuite] - ERROR - No valid ffmpeg found.

Import times for custom nodes: 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/websocket_image_save.py 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/cg-use-everywhere 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-WD14-Tagger 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-Custom-Scripts 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/rgthree-comfy 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/comfyui_controlnet_aux 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/Derfuu_ComfyUI_ModdedNodes 0.1 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite 0.1 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-KJNodes 0.3 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-Manager 0.5 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-Impact-Pack 0.8 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI_FizzNodes 1.6 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/was-node-suite-comfyui

Starting server

To see the GUI go to: http://xxx.x.x.x:xxxx FETCH DATA from: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-Manager/extension-node-map.json

AustinMroz commented 2 months ago

That is quite unexpected, but perhaps gives insight on why the automatic installation failed. There may be some helpful error message if you run:

cd /Applications/Data/Packages/ComfyUI
venv/bin/python
import imageio_ffmpeg
imageio_ffmpeg.get_ffmpeg_exe()

In the interest of actually making things work though, the following should do the trick

cd /Applications/Data/Packages/ComfyUI
ln -s /opt/homebrew/bin/ffmpeg ffmpeg
modmodmodmod commented 2 months ago

Thank you for advice.

After executing [cd /Applications/Data/Packages/ComfyUI] followed by running [venv/bin/python], the following message appeared.

Python 3.10.11 (main, May 7 2023, 17:32:05) [Clang 16.0.3 ] on darwin Type "help", "copyright", "credits" or "license" for more information.

When executing [import imageio_ffmpeg], the prompt [>>>] appeared.

When executing [imageio_ffmpeg.get_ffmpeg_exe()], the output ['ffmpeg'] was displayed, followed by the prompt [>>>].

When executed [cd /Applications/Data/Packages/ComfyUI], the following message appeared.

Traceback (most recent call last): File "", line 1, in NameError: name 'cd' is not defined. Did you mean: 'id'?

After that, when I executed [ln -s /opt/homebrew/bin/ffmpeg ffmpeg], the following message appeared.

File "", line 1 ln -s /opt/homebrew/bin/ffmpeg ffmpeg ^^^^^^ SyntaxError: invalid syntax

After closing the terminal, I launched ComfyUI from StabilityMatrix, but I still encountered the following error:

[VideoHelperSuite] - WARNING - Failed to import imageio_ffmpeg [VideoHelperSuite] - ERROR - No valid ffmpeg found.

It seems I entered [cd /Applications/Data/Packages/ComfyUI] at the wrong timing.

So, after restarting the terminal, I executed the following code, and it displayed [ComfyUI].

cd /Applications/Data/Packages/ComfyUI ln -s /opt/homebrew/bin/ffmpeg ffmpeg

Entire command-line from the startup screen is as follows. Can you find anything from this result?

ComfyUI startup time: 2024-04-11 07:15:56.258483 Platform: Darwin Python version: 3.10.11 (main, May 7 2023, 17:32:05) [Clang 16.0.3 ] Python executable: /Applications/Data/Packages/ComfyUI/venv/bin/python3 ** Log path: /Applications/Data/Packages/ComfyUI/comfyui.log

Prestartup times for custom nodes: 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/rgthree-comfy 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-Manager

Total VRAM 16384 MB, total RAM 16384 MB Forcing FP16. Set vram state to: SHARED Device: mps VAE dtype: torch.float32 Using pytorch cross attention Adding extra search path checkpoints /Applications/Data/Models/StableDiffusion Adding extra search path vae /Applications/Data/Models/VAE Adding extra search path loras /Applications/Data/Models/Lora Adding extra search path loras /Applications/Data/Models/LyCORIS Adding extra search path upscale_models /Applications/Data/Models/ESRGAN Adding extra search path upscale_models /Applications/Data/Models/RealESRGAN Adding extra search path upscale_models /Applications/Data/Models/SwinIR Adding extra search path embeddings /Applications/Data/Models/TextualInversion Adding extra search path hypernetworks /Applications/Data/Models/Hypernetwork Adding extra search path controlnet /Applications/Data/Models/ControlNet Adding extra search path controlnet /Applications/Data/Models/T2IAdapter Adding extra search path clip /Applications/Data/Models/CLIP Adding extra search path clip_vision /Applications/Data/Models/InvokeClipVision Adding extra search path diffusers /Applications/Data/Models/Diffusers Adding extra search path gligen /Applications/Data/Models/GLIGEN Adding extra search path vae_approx /Applications/Data/Models/ApproxVAE Adding extra search path ipadapter /Applications/Data/Models/IpAdapter Adding extra search path ipadapter /Applications/Data/Models/InvokeIpAdapters15 Adding extra search path ipadapter /Applications/Data/Models/InvokeIpAdaptersXl Adding extra search path prompt_expansion /Applications/Data/Models/PromptExpansion

Loading: ComfyUI-Manager (V2.10.2)

ComfyUI Revision: 2120 [4201181b] | Released on '2024-04-09'

(pysssss:WD14Tagger) [DEBUG] Available ORT providers: CoreMLExecutionProvider, AzureExecutionProvider, CPUExecutionProvider (pysssss:WD14Tagger) [DEBUG] Using ORT providers: CUDAExecutionProvider, CPUExecutionProvider [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json WAS Node Suite: Importing styles from /Applications/Data/Packages/ComfyUI/styles.csv. WAS Node Suite: Styles import complete. [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json WAS Node Suite: OpenCV Python FFMPEG support is enabled WAS Node Suite: ffmpeg_bin_path is set to: /usr/local/bin/ffmpeg WAS Node Suite: Finished. Loaded 211 nodes successfully.

"You have within you right now, everything you need to deal with whatever the world can throw at you." - Brian Tracy

[rgthree] Loaded 36 extraordinary nodes. [rgthree] Will use rgthree's optimized recursive execution.

Loading: ComfyUI-Impact-Pack (V4.87)

Loading: ComfyUI-Impact-Pack (Subpack: V0.4)

[Impact Pack] Wildcards loading done. [comfyui_controlnet_aux] | INFO -> Using ckpts path: /Applications/Data/Packages/ComfyUI/custom_nodes/comfyui_controlnet_aux/ckpts [comfyui_controlnet_aux] | INFO -> Using symlinks: False [comfyui_controlnet_aux] | INFO -> Using ort providers: ['CUDAExecutionProvider', 'DirectMLExecutionProvider', 'OpenVINOExecutionProvider', 'ROCMExecutionProvider', 'CPUExecutionProvider', 'CoreMLExecutionProvider'] DWPose: Onnxruntime with acceleration providers detected FizzleDorf Custom Nodes: Loaded [VideoHelperSuite] - WARNING - Failed to import imageio_ffmpeg [VideoHelperSuite] - ERROR - No valid ffmpeg found.

Import times for custom nodes: 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/websocket_image_save.py 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/cg-use-everywhere 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-WD14-Tagger 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/Derfuu_ComfyUI_ModdedNodes 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-Custom-Scripts 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/rgthree-comfy 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/comfyui_controlnet_aux 0.0 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite 0.1 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-KJNodes 0.1 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-Manager 0.1 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI_FizzNodes 0.3 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-Impact-Pack 0.6 seconds: /Applications/Data/Packages/ComfyUI/custom_nodes/was-node-suite-comfyui

Starting server

To see the GUI go to: http://xxx.x.x.x:xxxx FETCH DATA from: /Applications/Data/Packages/ComfyUI/custom_nodes/ComfyUI-Manager/extension-node-map.json

modmodmodmod commented 2 months ago

Since then, there have been updates to ComfyUI almost every day. Finally, after today's update, suddenly the problem was resolved and h264 appeared as an option! And export was successful! ! !

arfans22 commented 1 month ago

hi I getting your problem on windows, everythings updated, but still getting this:

[VideoHelperSuite] - WARNING - Failed to import imageio_ffmpeg