How to change nveglglessink to filesink in python apps test_3

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
Jetson nano
• DeepStream Version 5.1
• JetPack Version (valid for Jetson only) 4.5.1
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• 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)

my camera uri:rtsp://admin:123456@192.168.123.10:554/h264/ch1/main/av_stream

Hello there,I need help! I can watch video by python app test_3,but I want to save videos witch I see
Anybody can give help?
Thanks advance!

Hi,
Please refer to
Save part of video from frames in DS4.0 pipeline in deepstream-test2-app - #4 by DaneLLL

You would need to replace the display plugins with video encoding plugins.

Thanks DaneLLL!
but I still have problem with here,how can I modify this?

On the 292 line code:
print(“Creating EGLSink \n”)
sink = Gst.ElementFactory.make(“nveglglessink”, “nvvideo-renderer”)
if not sink:
sys.stderr.write(" Unable to create egl sink \n")

if is_live:
    print("Atleast one of the sources is live")
    streammux.set_property('live-source', 1)

streammux.set_property('width', 1920)
streammux.set_property('height', 1080)
streammux.set_property('batch-size', number_sources)
streammux.set_property('batched-push-timeout', 4000000)
pgie.set_property('config-file-path', "dstest3_pgie_config.txt")
pgie_batch_size=pgie.get_property("batch-size")
if(pgie_batch_size != number_sources):
    print("WARNING: Overriding infer-config batch-size",pgie_batch_size," with number of sources ", number_sources," \n")
    pgie.set_property("batch-size",number_sources)
tiler_rows=int(math.sqrt(number_sources))
tiler_columns=int(math.ceil((1.0*number_sources)/tiler_rows))
tiler.set_property("rows",tiler_rows)
tiler.set_property("columns",tiler_columns)
tiler.set_property("width", TILED_OUTPUT_WIDTH)
tiler.set_property("height", TILED_OUTPUT_HEIGHT)
sink.set_property("qos",0)

print("Adding elements to Pipeline \n")
pipeline.add(pgie)
pipeline.add(tiler)
pipeline.add(nvvidconv)
pipeline.add(nvosd)
if is_aarch64():
    pipeline.add(transform)
pipeline.add(sink)

print("Linking elements in the Pipeline \n")
streammux.link(queue1)
queue1.link(pgie)
pgie.link(queue2)
queue2.link(tiler)
tiler.link(queue3)
queue3.link(nvvidconv)
nvvidconv.link(queue4)
queue4.link(nvosd)

the path of .py file : /opt/nvidia/deepstream/deepstream-5.1/sources/deepstream_python_apps/apps/deepstream-test3/deepstream_test_3.py

Thanks again!!

btw, I can achieve function which can save video file by deepstream aplication << cd /opt/nvidia/deepstream/deepstream-5.1/samples/configs/deepstream-app

sudo deepstream-app -c source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_nano.txt >>

I changed this file with
[sink1]
#2 = eglsink 3 = file
type = 3 # default type = 2

can I get some enlightenments in there?

Thanks!

Hi,
In your use-case, you don’t create egl sink, so the check has to be removed also:

    if not sink:
        sys.stderr.write(" Unable to create egl sink \n")

Yes,sir.Got it!
but what elements should I add?
Thanks!

I was in trouble there for weeks,I am very appreciate to receive your reply,please!

Hello DaneLLL,I need your help,please!

Hi,
There is no existing patch for it, so you would need to check the open-source sample and do implementation. You may take a look at
deepstream_python_apps/deepstream_test1_rtsp_out.py at master · NVIDIA-AI-IOT/deepstream_python_apps · GitHub

There is code about creating encoder:

    # Make the encoder
    if codec == "H264":
        encoder = Gst.ElementFactory.make("nvv4l2h264enc", "encoder")
        print("Creating H264 Encoder")
    elif codec == "H265":
        encoder = Gst.ElementFactory.make("nvv4l2h265enc", "encoder")
        print("Creating H265 Encoder")
    if not encoder:
        sys.stderr.write(" Unable to create encoder")
    encoder.set_property('bitrate', bitrate)
    if is_aarch64():
        encoder.set_property('preset-level', 1)
        encoder.set_property('insert-sps-pps', 1)
        encoder.set_property('bufapi-version', 1)

Thanks DaneLLL!
With your help I am more clear about it
can you give me a command use gst-launch to achieve this function?(I am failed)
such as << gst-launch-1.0 -v rtspsrc location=rtsp://admin:123456@192.168.123.20:554/h265/ch1/main/av_stream ! queue ! nvvidconv ! nvv4l2h264enc ! filesink location=‘22.mp4’ >>
I would like thank you for many years!!!
Looking forward your reply!

Hi,
Here is a gst-launch-1.0 command close to this use-case:
Nvmultistreamtiler/nvstreamdemux with omxh264enc won't work - #5 by DaneLLL

This use-case should be

$ gst-launch-1.0 uridecodebin uri=rtsp://admin:123456@192.168.123.20:554/h265/ch1/main/av_stream ! mx.sink_0 nvstreammux width=1920 height=1080 batch-size=1 name=mx ! nvinfer config-file-path=/home/nvidia/deepstream-4.0/samples/configs/deepstream-app/config_infer_primary.txt unique-id=8 ! nvmultistreamtiler width=1920 height=1080 rows=1 columns=1 ! nvvideoconvert ! nvdsosd ! nvvideoconvert ! nvv4l2h264enc ! h264parse ! matroskamux ! filesink location=a.mkv

Thank you very much!!!
With your help,the problem was solved!
Good luck!