Deepstream Test3 output save

Hello, Hope you are doing well.
I am doing testing using python-binding code using deepstream-test. I want to save the output in the form of the video. I am not be able to save the output of the input video. Can you guide me how I can save the output of the input stream.
I am using the following code

Thanks

Hi,
You may refer to c++ code
sources/apps/apps-common/src/deepstream_sink_bin.::create_encode_file_bin
for how to encode to file, make customization accordingly to python version.