How to increase quality of output video by using config file

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) GPU Tesla T4
• DeepStream Version DeepStream version 5.0
• JetPack Version (valid for Jetson only) N/A
I am running deepstream from docker: deepstream:5.0-dp-20.04-triton.

After successfully installed deepstream 5.0, I try to run the deepstream-app from sample_apps/deepstream-app with a stream from my local camera. I change one of the sample config files to receive source from rtsp and change output sink to a video file. However, the output is very lagging and choppy. Sometimes this would interfere with tracking and detection.
My question is how can I improve the quality of output stream/video? Is it something that I can config with the config file?
Command I run: $ ./deepstream-app -c config-file.txt
The config file:

[application]
enable-perf-measurement=1
perf-measurement-interval-sec=1

[tiled-display]
enable=1
rows=1
columns=1
width=1280
height=720
gpu-id=0

[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI
type=4
num-sources=1
uri=rtsp://my-link
gpu-id=0


[streammux]
gpu-id=0
batch-size=1
live-source=1
batched-push-timeout=40000
## Set muxer output width and height
width=1920
height=1080

[sink0]
enable = 0
type = 4
codec = 1
sync = 1
qos = 1
enc_type=0
source-id = 0
gpu-id = 0
bitrate = 1000000
rtsp-port = 8554
width = 640
height = 480
udp-port = 5400

[osd]
enable=1
gpu-id=0
border-width=3
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Arial

[primary-gie]
enable=1
gpu-id=0
# Modify as necessary
model-engine-file=../../models/tlt_pretrained_models/peoplenet/resnet34_peoplenet_pruned.etlt_b1_gpu0_fp16.engine
batch-size=1
#Required by the app for OSD, not a plugin property
bbox-border-color0=1;0;0;1
bbox-border-color1=0;1;1;1
bbox-border-color2=0;0;1;1
bbox-border-color3=0;1;0;1
gie-unique-id=1
config-file=config_infer_primary_peoplenet.txt

[sink1]
enable=1
type=3
#1=mp4 2=mkv
container=2
#1=h264 2=h265 3=mpeg4
codec=3
#encoder type 0=Hardware 1=Software
enc-type=0
sync=1
bitrate=2000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=4
output-file=output.mkv
source-id=0

[sink2]
enable=0
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming 5=Overlay
type=4
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=4000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0
# set below properties in case of RTSPStreaming
rtsp-port=8554
udp-port=5400

[tracker]
enable=1
tracker-width=960
tracker-height=544
#ll-lib-file=/opt/nvidia/deepstream/deepstream-5.0/lib/libnvds_mot_iou.so
ll-lib-file=/opt/nvidia/deepstream/deepstream-5.0/lib/libnvds_nvdcf.so
#ll-lib-file=/opt/nvidia/deepstream/deepstream-5.0/lib/libnvds_mot_klt.so
#ll-config-file required for DCF/IOU only
ll-config-file=../deepstream-app/tracker_config.yml
#ll-config-file=iou_config.txt
gpu-id=0
#enable-batch-process applicable to DCF only
enable-batch-process=1

[tests]
file-loop=0
1 Like

Hi,
In the sink options, use sync=0

Thank you for the suggestion. I have try to enable sink=0 for [sink1], but the output video is still of low quality: the video is choppy at time, and still have a lot of blur when someone is moving around.

1 Like

@ghung1103
Do you mean you want to improve the video quality of the ‘sink1’ in your config file? It is a compressed video. The compressed video quality will be impacted by the codec parameters in sink settings. As to your configuration, the mpeg4 codec is selected. So only bitrate is useful. The 1920x1080 resolution video can be compressed as higher bitrate than 2000000. Can you try higher bitrate and check the result? For h264 or H265 codecs, there are more parameters can be used to improve the compressed video quality, but it need specific knowledge for the codecs. Please ask video codec experts to help you getting reasonable settings for your cases.