Kosinkadink / ComfyUI-VideoHelperSuite

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

Audio output from Load Video nodes does not handle no-audio case when applied as input to Video Combine #153

Closed Kosinkadink closed 5 months ago

Kosinkadink commented 5 months ago

Examples: if a gif is loaded in Load Video, and the audio output is inputted into Video Combine, an error will be thrown when it attempts to do the ffmpeg call (also, the actual error message parsing should be changed to str(e) instead of res.stderr, as stderr is something that only exists on the result of the subprocess call, not all exceptions. image

I also had a report that the same audio issue appears to happen if a video file (.mp4) has no audio and is then passed to Video Combine. Perhaps the something is up with the lazy_eval setup? Or something in the Video Combine node to handle such cases without throwing an exception.

Steps to reproduce: 1) Load a .gif with Load Video nodes 2) Connect the loaded images + audio to a Video Combine node, and make it a format that accepts audio (like .mp4) 3) An error will now be thrown, and due to not using str(e), it will throw an error about the nested NoneType error

I personally was not able to recreate the issue with using an .mp4 as source for the audio like another user has, but getting robust enough fix to avoid that happening would be good.

AustinMroz commented 5 months ago

Thanks. I'll roll out a fix for this along with Gifski support later this evening

AustinMroz commented 5 months ago

It was a misleading combination of a couple different minor errors

I've applied a fix that adds error catching to the subprocess call in get_audio and causes Video Combine to skip the audio pass when a connected audio input does not resolve to an actual audio stream. Now, when a gif (or other file without audio) is used for Load Video and has audio wired to a Video Combine, an error is printed to the console indicating that the audio extraction failed (and why), but the workflow still completes as if the audio were not wired.