Save output Deepstream Test App 2

hi all,
Does exists a way to save the output of my sample app 2 in a mp4 file?
I have to add something to the pipeline?

Please refer to deepstream-app source codes for the mp4 file generation.

The sample codes are in /opt/nvidia/deepstream/deepstream-5.0/sources/apps/sample_apps

It is better to be familiar with gstreamer before you start to read and understand deepstream codes.