@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?