I need to capture (record and save to file) from nvidia tx2 on-board csi camera or an Usb camera connected to Nvidia, Video segments of 5 seconds without losing Frames between segments using Hardware accelerated Encoding (OMXH264ENC in this case ) and recording at a high rate for ex: 1280x720(HD) 120fps.Videos will be saved in MP4 media Format.
System: Nvidia TX2 Ubuntu 16.04.5 LTS , Gstreamer 1.0 (bad,good,ugly plugins) and Python3
Hw: nvidia 5mp Onboard csi camera, Microsoft USB cam;
- Creating and playing a main Pipeline (src) containing camera config with a tee:
- Creating a second Pipeline (sink) containing the Encoding part and save-to-file Details:
The idea is to keep playing the Pipeline (main) and add/remove repeatedly the recordpipe every 5 seconds.
The problem is that after a while of addind and removing the second(sometimes after 3 segments or after 20 segments ) the main Pipeline freezes and get block without capturing anything while the second recordpipe is working ok.
Please find the code attached (seg.txt)
Sometimes the main pipeline does not starts , sometimes after 20 segments the main pipeline is getting blocked.
I am open to any solution writen in python.