Basic Inference
-
Perform a health check on the gRPC endpoint.
-
Install
grpcurlfrom github.com/fullstorydev/grpcurl/releases.Example commands to run on Ubuntu:
-
Download the health checking proto:
-
Run the health check:
If the service is ready, you get a response similar to the following:
For using grpcurl with an SSL-enabled server, avoid using the
--plaintextargument, and use--cacertwith a CA certificate,--keywith a private key, or--certwith a certificate file. For more details, refer togrpcurl --help. -
-
Download the LipSync client code by cloning the gRPC client repository (NVIDIA-Maxine/nim-clients):
-
Install the required dependencies.
The client requires Python 3.12 or later. For download and installation instructions, see Download Python.
For the Python client:
The following packages are required:
grpcio==1.67.1grpcio-tools==1.67.1tqdm==4.67.1
Compile the Protos (Optional)
If you want to use the client code provided in the NIM clients GitHub repository (NVIDIA-Maxine/nim-clients), you can skip this step.
The proto files are available in the lipsync/protos/proto folder, organized into the following packages:
nvidia/ai4m/lipsync/v1/lipsync.proto: Main LipSync service definition.nvidia/ai4m/audio/v1/audio.proto: Audio codec definitions.nvidia/ai4m/video/v1/video.proto: Video encoding definitions.nvidia/ai4m/common/v1/common.proto: Common types (BoundingBox).
You can compile them to generate client interfaces in your preferred programming language. For more details, refer to Supported languages in the gRPC documentation.
The following example shows how to compile the protos for Python on Linux and Windows.
Python
The grpcio version needed for compilation can be referred from requirements.txt
To compile protos on Linux, run the following commands:
To compile protos on Windows, run the following commands:
Running Inference via Python Script
You can use the sample client script in the LipSync GitHub repo to send a gRPC request to the hosted NIM server:
-
Go to the Python scripts directory.
-
Run the command to send a gRPC request. (All command-line parameters are optional.)
-
The LipSync NIM is optimized for streaming. When it detects a streamable video, it automatically enables streaming mode for lower latency and better resource efficiency. We recommend using streamable videos as input. For more information, see Streaming Mode.
-
To run with SSL enabled, add the SSL arguments.
The first inference is not indicative of the model’s actual performance because it includes the time taken by the Triton Inference Server to load the models for the first time. The subsequent inference requests reflect the actual processing performance.
For Blackwell GPUs, the initial inference might time out because of the time needed to load the models. If timeout occurs, send another request; subsequent inferences reflect the actual processing performance.
To view details of command-line arguments, run the following command:
You get a response similar to the following:
To get more information about how to run the client with these parameters, refer to the NIM clients GitHub repository: NVIDIA-Maxine/nim-clients.
For more information about configuring advanced parameters such as bitrate, IDR interval, video and audio extension options, speaker data, background audio, and head movement speed, see Advanced Usage.
For command-line arguments that aren’t specified, the script uses the following default values.
Default Command-Line Arguments
Example Commands
-
Basic inference with default arguments:
-
Run inference with custom input files:
-
Run inference with advanced configuration:
Supported Formats
The supported formats for input audio are WAV and MP3. The supported format for input video is MP4 with H.264 video encoding. Videos must use Constant Frame Rate (CFR); Variable Frame Rate (VFR) is not supported.
Input Modes
The LipSync NIM provides two modes for processing input files: streaming and transactional.
Streaming Mode
Streaming mode is the recommended way to use LipSync NIM. It allows inference to begin without receiving the whole video from the client. It processes video frames incrementally, and inference begins as soon as the first frame of information is available. The output frames are streamed back to the client immediately after inference.
The NIM automatically detects streamable videos and enables streaming mode. This mode delivers the lowest latency and best resource efficiency, and it scales well to large files.
Use streaming mode for these use cases:
- Best overall performance—the NIM is optimized for this path.
- Streamable video inputs.
- Applications that benefit from receiving output as it is generated, without waiting for the entire file to be uploaded.
- Large video files that benefit from incremental processing and reduced disk I/O.
Streaming mode works with streamable videos where metadata is positioned at the beginning of the file. The NIM automatically detects streamable videos and enables streaming mode. Videos that are not streamable can be easily converted to a streamable format.
To make any video streamable, use FFmpeg with the following command:
You can then specify the streamable video as input to the NIM by using the --video-input parameter.
Transactional Mode
In transactional mode, the NIM must receive the entire video and audio files before processing can begin. The NIM falls back to this mode when the input video is not streamable.
Transactional mode is suitable for the following use cases:
- Videos that are not optimized for streaming (such as non-streamable MP4 files where metadata is located at the end of the file, requiring the entire file to be downloaded before playback can begin).
- Processing of small video and audio files where streaming overhead is unnecessary.
- Applications that can wait for complete processing before receiving output.
To run LipSync in transactional mode, provide a non-streamable video as input:
For best performance, convert your videos to a streamable format so that the NIM can use streaming mode. See the FFmpeg command earlier on this page.