Nodes Browser
ComfyDeploy: How LNL Frame Selector works in ComfyUI?
What is LNL Frame Selector?
Frame Selector & Sequence Selection Node for ComfyUI.
How to install it in ComfyDeploy?
Head over to the machine page
- Click on the "Create a new machine" button
- Select the
Edit
build steps - Add a new step -> Custom Node
- Search for
LNL Frame Selector
and select it - Close the build step dialig and then click on the "Save" button to rebuild the machine
Frame Selector & Sequence Selection Node for ComfyUI
The Late Night Labs (LNL) Frame Selector node for ComfyUI is aimed at enhancing video interaction within the ComfyUI framework. It enables users to upload, playback, and perform basic In/Out on video files directly within the ComfyUI environment.
Features
- Video Upload and Playback: Users can upload video files and utilize standard playback controls including Play, Pause, Scrub, and Rewind.
- Editing Tools: The node offers simple editing capabilities such as setting In/Out points for selecting specific video sections, frame selection for detailed editing, and outputting frames with handles for further processing. Audio can be included.
Structure
The project is structured into two main components: the web directory, containing front-end JavaScript and CSS files, and the modules directory, containing back-end Python scripts.
Web Directory
- eventHandlers.js: Manages event handling for video playback and editing features.
- nodes.js: Defines the Load Video Node structure and integration within ComfyUI.
- utils.js: Contains utility functions for video processing and manipulation.
- widgets.js: Implements UI components for video editing.
- styles.js: Handles dynamic styling of the video node elements.
- css/lnlNodes.css: Provides styling for the Load Video Node components.
- images/: Contains icons used for playback and editing controls.
Modules Directory
- server.py: Back-end server implementation for handling video upload and processing.
- utils.py: Back-end utility functions supporting video editing features.
- nodes.py: Defines the server-side representation of the Load Video Node.
Installation
- Ensure you have ComfyUI and its dependencies installed.
- Clone this repo into custom_nodes:
$ cd ComfyUI/custom_nodes
$ git clone https://github.com/latenightlabs/ComfyUI-LNL.git
Install dependencies if not downloaded from the Comfy Manager:
$ cd ComfyUI-LNL
$ pip install -r requirements.txt
Troubleshooting
Make sure you that you have ffmpeg defined in your path.
To use the Load Video Node:
<img width="330" alt="image" src="https://github.com/latenightlabs/ComfyUI-LNL/assets/157748925/0b1be661-44b5-441b-aba4-17a479ddd96c">Inputs
- Choose Video to Upload: Select a video file for processing (in this case, 'input/logo.mp4').
Outputs
Options include:
- Current image: Current frame being viewed.
- Image Batch (in/out): Select a range of frames to process based on in and out points.
- Frame count (rel): Display the count of frames relative to in and out points.
- Frame count (abs): Absolute count of frames in the uploaded video.
- Current frame (rel): The current frame number relative to in and out points.
- Current frame (abs): The absolute frame number within the entire video.
- Framerate: FPS in the uploaded video.
- Audio: Pass audio track if desired.
Playback Controls
<img width="330" alt="image" src="https://github.com/latenightlabs/ComfyUI-LNL/assets/157748925/42f2987e-b4a5-433b-a2d1-0fd33eed03ed">Timeline Scrubber
- Shows the current frame number out of the total number of frames (in this instance, frame 66 of 149).
- In Point is green
- Out Point is red Note: In and Out point is set with the playback controls or in the input fields.
Media Controls left to right:
- Takes the user to the very first frame of the video.
- Set 'in_point'.
- Takes the user to the 'in_point', which is the frame set as the starting point for a selected range.
- Steps backward by one frame, moving the current frame to the previous frame in the video.
- Plays the video from the current frame forward.
- Not visible while Play button is displayed: Pause the playback at the current frame.
- Steps forward by one frame at a time.
- Takes the user to the 'out_point', the frame set as the ending point for a selected range.
- Sets the 'out_point'.
- Jumps to the very last frame of the video.
Numeric Input Fields and Controls:
- current_frame: Displays the current frame number and allows you to jump to a specific frame.
- in_point and out_point: Fields for setting the start and end points for a range of frames for focused editing of a frame range.
- select_every_nth_frame: Specify a pattern for selecting frames (e.g., every 2nd frame, every 3rd frame, etc.).
Credits
This project uses parts of code and some ideas from the following repositories: ComfyUI-Custom-Scripts ComfyUI-VideoHelperSuite Make sure to check them out, they both offer awesome tool suites!
We also use icons for player controls supplied by Icons8.
Enhanced Groups with Versioning Support for ComfyUI
This project aims to provide the users with a possibilty to create custom components (specific group versions) which can be reused throughout different projects, or used in different places within the same project. Users can also take advantage of using different versions of the same group/component in the same workflow. Going forward, we're going to be referencing these versioned groups as components.
Adding a ComfyUI group or a Component
By right-clicking on an empty canvas, you're presented with a context menu where the Add Group
option is presented. By default, ComfyUI creates an empty group called Group
when you tap that option. Due to installing this library, you'll be taken to another submenu offering options of Empty group
(the default empty group ComfyUI creates) and a Versioned group
. Selecting the Versioned group
option, you'll see all of the components listed (the latest version of each component). If you've just installed this library, you won't see any components because we haven't created any yet.
Creating a component
Let's create an empty ComfyUI group by right-clicking an empty canvas, selecting Add Group
-> Empty group
. You can name the group anything you like e.g. Test group
. Bear in mind that the group name isn't tied to the component name, meaning each component version can have a different group name.
Add a Load image
node (use the default example.png
image pre-installed with ComfyUI), and connect it to a Preview image
node. Make sure both are inside our group. Right-click inside our group, and select Edit Group
-> Versions
-> Save
.
Once selected, you'll be asked to enter a component name. Let's call it First component
and hit OK
.
This will create a component out of this group, and you'll see additional info in the group header appear, such as the component name and component version.
Loading a component
Now, once our component is created, let's clear the workflow by selecting Clear
from the ComfyUI menu. Right-click on an empty canvas again, and from Add Group
-> Versioned group
select our component.
This will add our previously saved component to the workflow. You can do it a couple of times more, e.g. twice, to add the component on different parts of the canvas.
Saving a new version of the component
Let's select one of our component's and shuffle the nodes around a bit, maybe even change the group size and name. We'll do it on the left topmost one for our example.
Now, once the changes have been made, right-click on the group, and select Edit Group
-> Versions
-> Save as new version
. This will create a new version of our component, version 2. The changes will also be reflected in the group's header.
Do note that, should you wish to add another component to the workflow, you'll be offered to add the component's last version (as initially mentioned). That would now be the version 2.
Loading a specific component version
By now, we've already seen how to add the latest component version to our workflow. But if we want to load a specific version, we must right-click on the group and select Edit Group
-> Versions
-> Load version
and select a specific version. To make navigating different versions easier, each version is labeled with its last change date and time.
In our example, let's load v2 in our top-right component. We'll end up with two v2 First component
components and one v1 First component
component.
Undoing changes to a specific component version
Provided we've made some changes to one of our components but haven't saved them (can be the latest or one of the previous versions) and we want to undo them, we can select Edit Group
-> Versions
-> Refresh
. In our example, we chose to modify the bottom-right component's node locations and the group title. Selecting Refresh
will reset the changes, or rather reload the v1 of the component.
Refreshing a component due to a change in a different place
If we've changed a component in a different part of a workflow (or even in a different workflow altogether), and wish to update a component with that same version, we can select the Refresh
option from the example above as well.
Contributing
Contributions to the Load Video Node project are welcome. Please
License
This project is licensed under the GNU General Public License.