Can i change the resolution of smart video record?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson
• DeepStream Version 6.1
• JetPack Version (valid for Jetson only) 4.6
• TensorRT Version 8.2.0
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs) questions
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

used code:

./deepstream-testsr-app RTSP// --enc-type=1 --sink-type=1 --bbox-enable=1 --sr-mode=1

Can I change the resolution of the smart video record?
Modifying the MUXER_OUTPUT_WIDTH and MUXER_OUTPUT_HEIGHT can save the new resolution of the video with BBOX. But It seems to need more CPU. To save memory and CPU usage, I want to use smart video record function without BBOX, which seems to record video through original RTSP resources. It also works.

used code:

./deepstream-testsr-app RTSP// --enc-type=1 --sink-type=1 --bbox-enable=0 --sr-mode=1

Then I have tried to modify some code in deepstream_test_sr_app.c and rebuild it, but the finally saved video is the same as the original resolution with RTSP. Is any way to change the record video resolution or do I miss anything?

  params.containerType = SMART_REC_CONTAINER;
  params.cacheSize = CACHE_SIZE_SEC;
  params.defaultDuration = SMART_REC_DEFAULT_DURATION;
  params.callback = smart_record_callback;
  params.width = 640;
  params.height = 480;
  params.fileNamePrefix = bbox_enabled ? "With_BBox" : "Without_BBox";

Smart recording APIs just help you to encapsulate the encoded video data (H264 or HEVC) into mp4 or mkv files. So smart recording can not change the resolution of encoded video.

You need to change the resolution before encoding. As to sample deepstream-testsr-app, you can add nvvideoconvert before video encoder to change the resolution.

https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvvideoconvert.html

Thank for your reply so quickly!
I have a try to add a nvvideoconvert before video encoder as follows:

if (!bbox_enabled && (sr_mode == 0 || sr_mode == 1)) {
        GstElement *queue_decode = gst_element_factory_make ("queue", NULL);
        GstElement *decoder1 = gst_element_factory_make ("nvv4l2decoder", NULL);
        GstElement *parser_pre_recordbin =
          gst_element_factory_make ("h264parse", "parser-pre-recordbin");
        GstElement *swconv_caps =  gst_element_factory_make ("capsfilter", NULL);
        GstCaps *conv_caps = gst_caps_from_string ("video/x-raw(memory:NVMM),format=(string)NV12,width=(int)320, height=(int)240");
        g_object_set (G_OBJECT (swconv_caps), "caps", conv_caps, NULL);
        gst_caps_unref (conv_caps);
        GstElement *encoder =
            gst_element_factory_make ("nvv4l2h264enc", "encoder");  
        GstElement *nvvidconv3 = gst_element_factory_make ("nvvideoconvert", "nvvidconv3");
        gst_bin_add_many (GST_BIN (pipeline), queue_decode,decoder1,swconv_caps, nvvidconv3,encoder, NULL);
        gst_bin_add_many (GST_BIN (pipeline), parser_pre_recordbin, NULL);
    
      if (!gst_element_link_many (tee_pre_decode,queue_decode,decoder1,nvvidconv3,swconv_caps,encoder, parser_pre_recordbin,
              nvdssrCtx->recordbin, NULL)) {
        g_print ("Elements not linked. Exiting. \n");
        g_main_loop_quit(loop);
      }
      gst_element_sync_state_with_parent(parser_pre_recordbin);
    }

Now we can record a customed resolution video.
We meet a little problem at the first record which seems can be not synced firstly. But it will be fine at the next record.

Recording started..
In cb_newpad
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
Opening in BLOCKING MODE
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
Stream format not found, dropping the frame
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
H264: Profile = 66, Level = 0
NVMEDIA: Need to set EMC bandwidth : 126000
NVMEDIA: Need to set EMC bandwidth : 126000
NVMEDIA_ENC: bBlitMode is set to TRUE
Recording done.
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
Recording started..
Recording done.

There is no update from you for a period, assuming this is not an issue anymore.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

If you are using nvv4l2h264enc, you may set a relatively short IDR interval to reduce the frame dropping. Please refer to “iframeinterval” property :Gst-nvvideo4linux2 — DeepStream 6.1.1 Release documentation

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.