How to set the sharpness of the output video stream as possibly smaller bitrate?

I used 3 M bps video output, but the mosaic is serious. How to change it ? If I try to use ffmpeg ,I found it’s much better. Can I keep the sharpness at the smallest bit rate possible?
I used deepstream-test5,which sink’s config like this:

enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming 5=Overlay 6=MsgConvBroker 7=Rtmp
type=4
#1=h264 2=h265
codec=1
sync=0
bitrate=3000000
# set below properties in case of RTSPStreaming
rtsp-port=8554
udp-port=5400
source-id=0
gpu-id=0

and I know it 's used nvv4l2h64enc and h264parse.

How to set the sharpness of the output video stream as possible smaller bitrate?

Hi,
Please share your output resolution. If you run 1920x1080, 3Mbps is too low. Would suggest you set higher bitrate.

If you have to fix at 3Mbps, you can try to configure ‘preset-level=4’

* preset-level        : HW preset level for encoder
                        flags: readable, writable, changeable only in NULL or READY state
                        Enum "GstV4L2VideoEncHwPreset" Default: 1, "UltraFastPreset"
                           (0): DisablePreset    - Disable HW-Preset
                           (1): UltraFastPreset  - UltraFastPreset for high perf
                           (2): FastPreset       - FastPreset
                           (3): MediumPreset     - MediumPreset
                           (4): SlowPreset       - SlowPreset

It will bring tiny improvement in video quality but encoding speed gets slower.

@DaneLLL
My resolution is 1280X720. and I change preset-level=4,but it’s still blur.My code like this:

static gboolean
create_udpsink_bin (NvDsSinkEncoderConfig * config, NvDsSinkBinSubBin * bin)
{
  GstCaps *caps = NULL;
  gboolean ret = FALSE;
  gchar elem_name[50];
  gchar encode_name[50];
  gchar rtppay_name[50];

  //guint rtsp_port_num = g_rtsp_port_num++;
  uid++;

  g_snprintf (elem_name, sizeof (elem_name), "sink_sub_bin%d", uid);
  bin->bin = gst_bin_new (elem_name);
  if (!bin->bin) {
    NVGSTDS_ERR_MSG_V ("Failed to create '%s'", elem_name);
    goto done;
  }

  g_snprintf (elem_name, sizeof (elem_name), "sink_sub_bin_queue%d", uid);
  bin->queue = gst_element_factory_make (NVDS_ELEM_QUEUE, elem_name);
  if (!bin->queue) {
    NVGSTDS_ERR_MSG_V ("Failed to create '%s'", elem_name);
    goto done;
  }

  g_snprintf (elem_name, sizeof (elem_name), "sink_sub_bin_transform%d", uid);
  bin->transform = gst_element_factory_make (NVDS_ELEM_VIDEO_CONV, elem_name);
  if (!bin->transform) {
    NVGSTDS_ERR_MSG_V ("Failed to create '%s'", elem_name);
    goto done;
  }

  g_snprintf (elem_name, sizeof (elem_name), "sink_sub_bin_cap_filter%d", uid);
  bin->cap_filter = gst_element_factory_make (NVDS_ELEM_CAPS_FILTER, elem_name);
  if (!bin->cap_filter) {
    NVGSTDS_ERR_MSG_V ("Failed to create '%s'", elem_name);
    goto done;
  }

  caps = gst_caps_from_string ("video/x-raw(memory:NVMM), format=I420");
  g_object_set (G_OBJECT (bin->cap_filter), "caps", caps, NULL);

  g_snprintf (encode_name, sizeof (encode_name), "sink_sub_bin_encoder%d", uid);
  g_snprintf (rtppay_name, sizeof (rtppay_name), "sink_sub_bin_rtppay%d", uid);

  switch (config->codec) {
    case NV_DS_ENCODER_H264:
      bin->codecparse = gst_element_factory_make ("h264parse", "h264-parser");
      bin->encoder = gst_element_factory_make (NVDS_ELEM_ENC_H264, encode_name);
      bin->rtppay = gst_element_factory_make ("rtph264pay", rtppay_name);
      break;
    case NV_DS_ENCODER_H265:
      bin->codecparse = gst_element_factory_make ("h265parse", "h265-parser");
      bin->encoder = gst_element_factory_make (NVDS_ELEM_ENC_H265, encode_name);
      bin->rtppay = gst_element_factory_make ("rtph265pay", rtppay_name);
      break;
    default:
      goto done;
  }

  if (!bin->encoder) {
    NVGSTDS_ERR_MSG_V ("Failed to create '%s'", encode_name);
    goto done;
  }

  if (!bin->rtppay) {
    NVGSTDS_ERR_MSG_V ("Failed to create '%s'", rtppay_name);
    goto done;
  }

  g_object_set (G_OBJECT (bin->encoder), "bitrate", config->bitrate, NULL);
  g_object_set (G_OBJECT (bin->encoder), "iframeinterval", config->iframeinterval, NULL);
//modify default to 4
 g_object_set (G_OBJECT (bin->encoder), "preset-level", 4, NULL);


#ifdef IS_TEGRA

  g_object_set (G_OBJECT (bin->encoder), "insert-sps-pps", 1, NULL);
  g_object_set (G_OBJECT (bin->encoder), "bufapi-version", 1, NULL);
#else
 
  g_object_set (G_OBJECT (bin->transform), "gpu-id", config->gpu_id, NULL);
#endif

and this:

[streammux]
gpu-id=0
##Boolean property to inform muxer that sources are live
live-source=0
batch-size=4
##time out in usec, to wait after the first buffer is available
##to push the batch even if the complete batch is not formed
batched-push-timeout=40000
## Set muxer output width and height
width=1280
height=720
##Enable to maintain aspect ratio wrt source, and allow black borders, works
##along with width, height properties
enable-padding=0
nvbuf-memory-type=0

so,maybe sth has no correct?

Hi,
Suggest you compare the video quality in pure video encoding and pick one mode that is good in video quality and bitrate.

$ gst-launch-1.0 uridecodebin uri=file:///home/nvidia/jellyfish-10-mbps-hd-hevc.mkv ! nvvideoconvert ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvv4l2h264enc bitrate=3000000 ! h264parse ! qtmux  ! filesink location=a.mp4
$ gst-launch-1.0 uridecodebin uri=file:///home/nvidia/jellyfish-10-mbps-hd-hevc.mkv ! nvvideoconvert ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvv4l2h264enc preset-level=4 bitrate=3000000 ! h264parse ! qtmux  ! filesink location=a.mp4
$ gst-launch-1.0 uridecodebin uri=file:///home/nvidia/jellyfish-10-mbps-hd-hevc.mkv ! nvvideoconvert ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvv4l2h264enc bitrate=5000000 ! h264parse ! qtmux  ! filesink location=a.mp4

Video quality and birtate are trade-off. If you have to have low bitrate, quality will be secrificed.

You may also tune qp-range:

* qp-range            : Qunatization range for P, I and B frame,
                         Use string with values of Qunatization Range
                         in MinQpP-MaxQpP:MinQpI-MaxQpI:MinQpB-MaxQpB order, to set the property.
                        flags: readable, writable
                        String. Default: null

@DaneLLL,I try to use your commands and get this error:

ERROR: pipeline doesn’t want to preroll.

gst-launch-1.0 uridecodebin uri=file:///home/test/data/mp4/p1.mp4 ! nvvideoconvert ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvv4l2h264enc bitrate=3000000 ! h264parse ! qtmux  ! filesink location=a1.mp4
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Redistribute latency...
Redistribute latency...
Redistribute latency...
Redistribute latency...
Redistribute latency...
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0: Internal data stream error.
Additional debug info:
qtdemux.c(6073): gst_qtdemux_loop (): /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline

maybe some error?

Hi,
Do you use Jetson platforms? Please share information about your platform, and the version of DeepStream SDK.

Hi tms2003,

Have you managed to resolve the issue? Or please share information about your platform, and the version of DeepStream SDK. T
We haven’t heard back from you in a couple weeks, so marking this topic closed.
Please open a new forum issue when you are ready and we’ll pick it up there.