Unable to record live video feed from a CSI MIPI camera

I am trying to construct a gstreamer pipeline which can stream a live video feed using RTSP server and record a portion of the feed on trigger. I am attaching my script for reference stream-app-probe.py (12.0 KB) . I am able to successfully generate a RTSP stream. For the recording feature I have created a “tee” which creates a separate branch, which uses the following elements : omxh26enc → matroskamux → filesink.
The pipeline doesnt work and throws the following error :

GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
NvMMLiteVideoEncDoWork: Surface resolution (0 x 0) smaller than encode resolution (1280 x 720)
VENC: NvMMLiteVideoEncDoWork: 4283: BlockSide error 0x4
Event_BlockError from 0BlockAvcEnc : Error code - 4
**Sending error event from 0BlockAvcEncH264: Profile = 66, Level = 0 **
Error: gst-library-error-quark: GStreamer encountered a general supporting library error. (1): /dvs/git/dirty/git-master_linux/3rdparty/gst/gst-omx/omx/gstomxvideoenc.c(1331): gst_omx_video_enc_loop (): /GstPipeline:pipeline0/GstOMXH264Enc-omxh264enc:omxh264encoder:
OpenMAX component in error state Bad parameter (0x80001005) .

How do I resolve this? Any help is appreciated.

Since we have deprecated omxplugins, you may replace with nvv4l2h264enc ! h264parse ! filesink. And suggest check if the pipeline can be launched successfully through gst-launch-1.0.

1 Like

@DaneLLL I tried running the following pipeline :
gst-launch-1.0 nvarguscamerasrc ! nvvideoconvert ! “video/x-raw(memory:NVMM), format=NV12, width=1280, height=720” ! nvv4l2h264enc ! tee name=t t. ! queue ! h264parse ! matroskamux ! filesink location=test.mkv

The pipeline runs without errors, but the video file is corrupt. What could be the issue?

gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! ‘video/x-raw(memory:NVMM), format=NV12, width=1280, height=720’ ! nvv4l2h264enc ! tee name=t t. ! queue ! h264parse ! matroskamux ! filesink location=test.mkv
We run your pipeline like this. The video file can be played on “Videos” application but it can not played on “VLC” application. There is a general problem on ARM architecture while using VLC. this problem could be based on different reasons like hardware decoding, missing codecs, missing components, incorrect audio/video codecs settings.

1 Like

@ozguryildiz I tried running the above pipeline on my Jetson Nano, but it still produces a corrupt or empty file.
I tried running the saved file using the following pipeline :

gst-launch-1.0 filesrc location=test.mkv ! decodebin ! autovideosink

But I get an error saying : input stream contains no data.


Did you check the pipeline below? It recorded “.mkv” file and it played with your pipeline.