Back-to-back detector with DeepStream 5.0

I tried the back-to-back sample - deepstream_reference_apps/README.md at master · NVIDIA-AI-IOT/deepstream_reference_apps · GitHub with below change for DeepStream 5.0, it works.
The change to back_to_back_detectors.c is for dumping the output to h264 file in Jetson platform.
You may could refer to this sample for your back-to-back implementation,

diff --git a/back-to-back-detectors/Makefile b/back-to-back-detectors/Makefile
index 7171e3b..748d9cb 100644
--- a/back-to-back-detectors/Makefile
+++ b/back-to-back-detectors/Makefile
@@ -24,7 +24,7 @@ APP:= back-to-back-detectors

 TARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)

-NVDS_VERSION:=4.0
+NVDS_VERSION:=5.0

 LIB_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/

diff --git a/back-to-back-detectors/back_to_back_detectors.c b/back-to-back-detectors/back_to_back_detectors.c
index 302b55b..3775adc 100644
--- a/back-to-back-detectors/back_to_back_detectors.c
+++ b/back-to-back-detectors/back_to_back_detectors.c
@@ -237,10 +237,15 @@ main (int argc, char *argv[])
 #ifdef PLATFORM_TEGRA
   transform = gst_element_factory_make ("nvegltransform", "nvegl-transform");
 #endif
-  sink = gst_element_factory_make ("nveglglessink", "nvvideo-renderer");
+  GstElement *parser1 = gst_element_factory_make ("h264parse", "h264-parser1");
+  GstElement *enc = gst_element_factory_make ("nvv4l2h264enc", "h264-enc");
+  GstElement *nvvidconv1 = gst_element_factory_make ("nvvideoconvert", "nvvideo-converter1");
+  //sink = gst_element_factory_make ("nveglglessink", "nvvideo-renderer");
+  sink = gst_element_factory_make ("filesink", "file-sink");
+  g_object_set (G_OBJECT (sink), "location", "./out.h264", NULL);

   if (!source || !h264parser || !decoder || !primary_detector || !secondary_detector
-      || !nvvidconv || !nvosd || !sink) {
+      || !nvvidconv || !nvosd || !enc || !sink) {
     g_printerr ("One element could not be created. Exiting.\n");
     return -1;
   }
@@ -279,11 +284,11 @@ main (int argc, char *argv[])
 #ifdef PLATFORM_TEGRA
   gst_bin_add_many (GST_BIN (pipeline),
       source, h264parser, decoder, streammux, primary_detector, secondary_detector,
-      nvvidconv, nvosd, transform, sink, NULL);
+      nvvidconv, nvosd, nvvidconv1, enc, parser1, sink, NULL);
 #else
   gst_bin_add_many (GST_BIN (pipeline),
       source, h264parser, decoder, streammux, primary_detector, secondary_detector,
-      nvvidconv, nvosd, sink, NULL);
+      nvvidconv, nvosd, enc, sink, NULL);
 #endif

   GstPad *sinkpad, *srcpad;
@@ -321,13 +326,13 @@ main (int argc, char *argv[])

 #ifdef PLATFORM_TEGRA
   if (!gst_element_link_many (streammux, primary_detector, secondary_detector,
-      nvvidconv, nvosd, transform, sink, NULL)) {
+      nvvidconv, nvosd, nvvidconv1, enc, parser1, sink, NULL)) {
     g_printerr ("Elements could not be linked: 2. Exiting.\n");
     return -1;
   }
 #else
   if (!gst_element_link_many (streammux, primary_detector, secondary_detector,
-      nvvidconv, nvosd, sink, NULL)) {
+      nvvidconv, nvosd, enc, sink, NULL)) {
     g_printerr ("Elements could not be linked: 2. Exiting.\n");
     return -1;
   }
diff --git a/back-to-back-detectors/primary_detector_config.txt b/back-to-back-detectors/primary_detector_config.txt
index ff714cb..2b6ad6e 100644
--- a/back-to-back-detectors/primary_detector_config.txt
+++ b/back-to-back-detectors/primary_detector_config.txt
@@ -60,10 +60,10 @@
 [property]
 gpu-id=0
 net-scale-factor=0.0039215697906911373
-model-file=../../../../samples/models/Primary_Detector/resnet10.caffemodel
-proto-file=../../../../samples/models/Primary_Detector/resnet10.prototxt
-labelfile-path=../../../../samples/models/Primary_Detector/labels.txt
-int8-calib-file=../../../../samples/models/Primary_Detector/cal_trt.bin
+model-file=../../../../../samples/models/Primary_Detector/resnet10.caffemodel
+proto-file=../../../../../samples/models/Primary_Detector/resnet10.prototxt
+labelfile-path=../../../../../samples/models/Primary_Detector/labels.txt
+int8-calib-file=../../../../../samples/models/Primary_Detector/cal_trt.bin
 batch-size=1
 network-mode=1
 num-detected-classes=4
diff --git a/back-to-back-detectors/secondary_detector_config.txt b/back-to-back-detectors/secondary_detector_config.txt
index 2112830..511a2a2 100644
--- a/back-to-back-detectors/secondary_detector_config.txt
+++ b/back-to-back-detectors/secondary_detector_config.txt
@@ -61,11 +61,11 @@
 gpu-id=0
 process-mode=2
 net-scale-factor=0.0039215697906911373
-model-file=../../../../samples/models/Secondary_FaceDetect/fd_lpd.caffemodel
-proto-file=../../../../samples/models/Secondary_FaceDetect/fd_lpd.prototxt
-model-engine-file=../../../../samples/models/Secondary_FaceDetect/fd_lpd_model/fd_lpd.caffemodel_b1_fp32.engine
-labelfile-path=../../../../samples/models/Secondary_FaceDetect/labels.txt
-int8-calib-file=../../../../samples/models/Secondary_FaceDetect/cal_trt.bin
+model-file=../../../../../samples/models/Secondary_FaceDetect/fd_lpd.caffemodel
+proto-file=../../../../../samples/models/Secondary_FaceDetect/fd_lpd.prototxt
+model-engine-file=../../../../../samples/models/Secondary_FaceDetect/fd_lpd_model/fd_lpd.caffemodel_b1_fp32.engine
+labelfile-path=../../../../../samples/models/Secondary_FaceDetect/labels.txt
+int8-calib-file=../../../../../samples/models/Secondary_FaceDetect/cal_trt.bin
 batch-size=1
 network-mode=0
 num-detected-classes=3