Microservice offers the following GPU-accelerated AI-based video effects:
In a typical Video Effects Microservice deployment, a service provider configures and launches the Video Effects Microservice on a GPU-based server. A client application (remote or local) connects to the microservice, negotiates the desired video effects and connection parameters via gRPC, and starts streaming video to the microservice (via RTP/UDP, gRPC/TCP or another protocol) and receives the processed video back.
The Video Effects Microservice includes Docker containers which can be used to demonstrate the typical deployment scenario described above. Specifically, this quick start guide provides step-by-step instructions for the following:
Ensure the following prerequisites are available on your system for running the container:
docker login nvcr.io
This will prompt for username
and password
. Use $oauthtoken
for username
and your NGC_API_KEY
for password
The file config.sh
contains the parameters used for configuring various aspects of the Video Effects Microservice.
Before launching the microservice, ensure that these parameters are set properly. An example file config.sh
is included in the package.
Below lightstep related params are needed to supply if enable_traces=true
and use_ostream_exporter=false
(Optional) lightstep_token_filepath: Lightstep backend needs token for access. This parameter provides a local file path for token.
(Optional) lightstep_cert_filepath: To access lightstep grpc endpoint, it needs SSL certificate. Use this parameter to provide file path.
(Optional) lightstep_endpoint: URL to access lightstep backend.
(Optional) Logging: service prints logs to stdout or stderr. "docker logs " can be used to check service logs.
(Optional) GST_DEBUG can be used to control gStreamer logs. service uses gStreamer pipeline for audio processing. For more info, Please refer gStreamer - Printing Debug Information. optional. default:0.
(Optional) GLOG_logtostderr can be used to enable glogs. Please find more details related to glogs here. optional. default:0.
(Optional) GLOG_v controls the log verbose level. High level means more detailed logs. optional. default:0.
Set appropriate permissions:
chmod -R 775 video_effects_v1.2.0
Pull the Video Effects Microservice docker image:
bash ./video_effects_init.sh
Start the Video Effects service
bash ./video_effects_start.sh
How to use custom pipline tuning configs:
quality_tuning_configs/
$ bash ./video_effects_stop.sh
$ bash ./video_effects_start.sh
The service is now launched in background mode, follow next steps to launch client docker.
Command line client is a containerized executable that enables validating various features offered by Video Effects Microservice. This client is provided in the docker in binary form (executable). The client application, once configured, connects to the microservice, negotiates a session, streams video to and receives processed video from the microservice.
These example config files are provided in this package:
config_grpc.json
: uses gRPC streamingconfig_srtp_udp.json
: uses secured RTP UDP streamingconfig_rtp_udp.json
: uses RTP UDP streaming, contains recommended settings for RTP UDPconfig_grpc_lookaway.json
: uses gRPC streaming, contains recommended settings for Gaze redirectionconfig_rtp_udp_lookaway.json
: uses RTP UDP streaming, contains recommended settings for RTP UDP & Gaze redirectionconfig_rtp_udp_composite.json
: uses RTP UDP streaming, contains recommended settings for RTP UDP & Background Replacement effectA detailed config file description is provided in section Config file options.
For the protobuf definition, please refer to protos/video_effects/<api-version>/video_effects.proto
.
To test the microservice using this pre-built client,
bash ./video_effects_client_start.sh
/host
./opt/nvidia/maxine-microservices/bin/video_effects_client
.
Invoke the application as follows (If distributed span tracing is required, please add --enable_traces
at the end): GLOG_v=4 video_effects_client --grpc_uri=127.0.0.1:50061 \
--video_config=/host/configs/config_grpc.json \
--video_input=/host/sample_inputs/Video.mp4 \
--video_output=/host/outputs/video_effects_out.mkv
Upon launching the client, The client invokes gRPC bi-directional endpoint of microservice deployed at the URI specified by grpc_uri
argument and establishes a gRPC channel.
How to use custom config file
configs
folder in the current directory on host./host/configs
inside the docker.--video_config
.How to access output file:
outputs/
and on client docker: /host/outputs/
are synced--video_output
in client launch command allows us to control location of output file--video_ouput
as shown in sample client launch command to generate and access output on host machine at: outputs/
How to use custom inputs:
sample_inputs/
and the directory in client docker: /host/sample_inputs/
are syncedsample_inputs/
.--video_input
client launch command to use custom inputs.--background_input
for background replacement use caseSetting custom Bitrate settings on input and output:
--input_video_bitrate
: The bitrate of driving video data sent to MS, Defaults: GRPC=24Mbps, UDP=1Mbps, See Recommended values for bitrate--output_transcode_bitrate
: The bitrate to transcode the output with, Defaults: GRPC=24Mbps, UDP=1Mbps, See Recommended values for bitrateThe explanation of options in config file is as follows:
{
"video_enhancement_config": {
"enable_background_effect": false, # toggle background effect
"background_effect_config": {
"background_effect": "BACKGROUND_EFFECT_BLUR", # background replacement vs blur, "BACKGROUND_EFFECT_BLUR" & "BACKGROUND_EFFECT_COMPOSITE" supported
"background_blur_config": {
"mode": "VIDEO_EFFECT_MODE_QUALITY", # quality vs perf, value "VIDEO_EFFECT_MODE_PERF" recommended for live streaming
"blur_strength": 1.0 # blur strength in background blur effect.
}
},
"enable_gaze_redirection": true, # toggle gaze redirect feature
"gaze_redirection_config": {
"eye_size_sensitivity": "EYE_SIZE_SENSITIVITY_3", # keep default, recommended value
"temporal_optimize": true, # keep default, recommended true
"enable_gaze_look_away": false, # is set to true, enables occasional lookaways in output, to avoid continous stare
"gaze_look_away_config": {
"max_look_away_offset": { # controls look away angle, see 'protos/video_effects/v1/video_effects.proto' for more details
"value": 5,
"unit": "UNIT_DEGREE_ANGLE"
},
"min_look_away_interval": { # controls frequency of lookaways, see 'protos/video_effects/v1/video_effects.proto' for more details
"value": 100,
"unit": "UNIT_FRAME"
},
"look_away_interval_range": { # controls frequency of lookaways, see 'protos/video_effects/v1/video_effects.proto' for more details
"value": 250,
"unit": "UNIT_FRAME"
}
}
}
},
"endpoint_config": {
"input_media_config": {
"video_input_config": {
"stream_config": {
"stream_type": "GRPC" # input stream type, use "UDP" for RTP/UDP
},
"payloader_config": {
"type": "PAYLOADER_RTP" # other values: "PAYLOADER_UNSPECIFIED"
},
"encoding": "H264" # input encoding
}
},
"output_media_config": {
"video_output_config": {
"stream_config": {
"stream_type": "GRPC" # output stream type, use "UDP" for RTP/UDP
},
"payloader_config": {
"type": "PAYLOADER_RTP" # other values: "PAYLOADER_UNSPECIFIED"
},
"encoding": "H264" # output encoding
}
}
},
"quality_profile": "VIDEO_EFFECT_QUALITY_PROFILE_HIGH_QUALITY", # used to tune service componets to deliever expected experience. refer to "video_effects/protos/video_effects/<api-version>/video_effects.proto" for more details
}
bash ./video_effects_stop.sh
config.sh
respectivelyprotos/video_effects/<api-version>/video_effects.proto
.The microservice prints logs to stdout or stderr.
To access service logs, run the docker logs
command:
docker logs -f [container-name]
Please refer to Video Effect Microservice User Guide
(Under resources) on NGC.
By pulling and using Maxine software, you accept the terms and conditions of the corresponding license.