Basic Inference
This guide demonstrates how to perform basic inference with the Synthetic Video Detector NIM over gRPC.
Prerequisites
-
Ensure that the Synthetic Video Detector NIM container is running. For container launch instructions, refer to Getting Started.
-
Verify that the service is accessible by performing 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 Synthetic Video Detector Python client code by cloning the Clients repository (NVIDIA-Maxine/nim-clients):
-
Install the required dependencies:
Compile the Protos (Optional)
If you want to use the client code provided in the Clients repository (NVIDIA-Maxine/nim-clients), you can skip this step.
The proto files are available in the synthetic-video-detector/protos folder. The v2 API used by this NIM is defined under protos/proto/nvidia/ai4m/; the earlier v1 API is kept alongside it under protos/proto/nvidia/maxine/. 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 is an example of how to compile the protos for Python on Linux and Windows. The compile script builds both API generations in a single pass.
The grpcio version needed for compilation can be referred from requirements.txt
To compile protos on Linux:
To compile protos on Windows:
The generated Python stubs are written to synthetic-video-detector/interfaces, mirroring the proto packages. The v2 stubs are imported as follows:
Input and Output
The Synthetic Video Detector NIM takes a single input video and returns an overall synthetic probability, with optional per-frame results for analysis. Audio tracks, if present, are ignored.
The following table lists the container and video codec combinations supported by this NIM. The runtime demuxes the container, and NVDEC decodes the video on supported GPUs.
Container support is provided by the runtime demuxer. Hardware decoding support for a codec, profile, pixel format, chroma subsampling, bit depth, and resolution depends on the exact GPU. For per-GPU capabilities, refer to the NVIDIA Video Encode and Decode GPU Support Matrix.
The maximum input resolution also depends on the codec and exact GPU. For the per-architecture minimum and maximum resolutions, refer to the NVDEC Video Decoder API Programming Guide. The performance measurements cover inputs up to 4K; refer to Performance Results.
The reference evaluation uses H.264/AVC-encoded videos. Detection accuracy can vary with codec, video quality, compression, re-encoding, and source model. Refer to Reference Accuracy.
Inference Workflows
The NIM automatically selects the inference workflow based on the input; you do not set it explicitly.
- Streaming inference is used only for streamable (fast-start) H.264 MP4 input, that is, files whose
moovatom is placed before the media data (for example, encoded withffmpeg -movflags +faststart). In this mode, decoding and inference overlap with the byte upload for lower latency. - Transactional inference is used for all other inputs, including non-fast-start MP4 files, H.265, AV1, VP8, and VP9 streams, and Matroska/WebM containers. The input is fully received before decoding begins.
- Pre-signed URL (S3) ingest always uses the transactional workflow. For details, refer to Pre-signed URL Ingest.
The following table summarizes the two workflows:
Streaming mode applies only to fast-start H.264 MP4 input. To convert a regular MP4 to fast-start (which moves the moov atom to the front of the file), use FFmpeg:
Then pass the streamable file with --video-input. When the input is not fast-start H.264 MP4, the NIM automatically falls back to the transactional workflow.
Running Inference
To run the Synthetic Video Detector NIM, run the Synthetic Video Detector sample client without any additional flags:
Go to the v2 scripts directory:
Send a gRPC request:
The first inference is not indicative of the model’s actual performance because it includes the time taken by the inference server to load the models in addition to the time required to process the inference request.
Pre-signed URL (S3) Ingest
Instead of streaming the video bytes, you can point the NIM at a video that already lives in object storage (for example, an AWS S3 bucket) by sending a single pre-signed HTTPS URL. The NIM validates the URL, downloads the object itself, and runs the same detection pipeline. For a description of the ingest pipeline, the security model, and the tuning environment variables, refer to Pre-signed URL Ingest.
The same synthetic-video-detector.py client handles this mode: pass --presigned-url instead of --video-input (the two are mutually exclusive). The client then sends a single PresignedUrl request rather than streaming bytes:
To skip server-side checksum verification for a basic verification test against a generic URL, disable verification instead of supplying a checksum:
Use --presigned-url-provider s3 only for AWS S3 pre-signed URLs; it enables server-side AWS SigV4 URL-shape validation. For other HTTPS object stores, add the hostname to NV_AI4M_PRESIGNED_ALLOWED_HOSTS and omit --presigned-url-provider s3.
With checksum verification enabled (the default), you must pass --presigned-checksum together with --presigned-checksum-type, or the server rejects the request. Use --presigned-no-verify-checksum to opt out. Supported checksum algorithms are md5, sha256, and sha512.
To view details of command-line arguments, run the following command:
You get a response similar to the following. All parameters are optional.
Python Notebook
For an interactive experience and to explore all feature parameters, we provide a comprehensive Python notebook that demonstrates the Synthetic Video Detector service capabilities.
The Python notebook is located at notebook/v2/synthetic_video_detector_notebook.ipynb in the synthetic-video-detector client folder.