Gstreamer freeze (like slow motion video) after awhile (URGENT)

I am recording video with gstreamer by running this pipeline.

v4l2src device=/dev/video8 io-mode=mmap ! video/x-raw, format=I420, width=1920, height=1080, framerate=25/1 ! nvvidconv ! omxh264enc bitrate=5000000 ! tee name=t t. ! queue ! matroskamux ! filesink location=output.avi t. ! queue ! decodebin ! videoconvert ! video/x-raw, format=(string)BGR ! appsink emit-signals=true sync=false max-buffers=10 drop=true

In beginning, video is good but after awhile playback start to freezing (like slow motion video) and never back to normal state.

decodebin ! videoconvert ! video/x-raw, format=(string)BGR

With this line of code, I want to create a frame by creating a signal and transmitting the resulting signal to the buffer. Then I need to change the format to BGR to be able to read the frame. When I remove this line of code from the main code, it works but I cannot do what I want. When I remove the BGR conversion process in this line of code, the code works fine, but this time it cannot read the video. How can I solve this freezing (like slow motion) problem?

Hi,
It sounds like the process in appsink is too slow and then the whole pipeline gets slowed down. You may try to return the GstBuffer directly and check if the issue still happens.

We have deprecated omx plugins. Please try nvv4l2h264enc

And you should not need to encode and re-decode, convert to BGR data. This command should be better:

v4l2src device=/dev/video8 io-mode=mmap ! video/x-raw, format=I420, width=1920, height=1080, framerate=25/1 ! tee name=t ! queue ! nvvidconv ! nvv4l2h264enc bitrate=5000000 ! h264parse ! matroskamux ! filesink location=output.mkv t. ! queue ! videoconvert ! video/x-raw, format=(string)BGR ! appsink emit-signals=true sync=false max-buffers=10 drop=true

May apply your string to this sample for a try:
Gstreamer decode live video stream with the delay difference between gst-launch-1.0 command and appsink callback - #6 by DaneLLL

I am running it on a separate queue. why is it slow though?

And also, how can i return the GstBuffer directly ?

Hi,
Please check new_buffer() in the sample. It demonstrates how to get buffer in appsink and returns the buffer back.

I tried your pipeline and it works without freezing but this time the video is completely slow. I guess the signal is transmitted to the buffer late (or slower) every time. how can i solve this problem?

Hi,
Please execute $ sudo nvpmodel -m 0 and $ sudo jetson_clocks. It takes significant CPU loading to get BGR data. Running CPU cores at max clock will bring maximum throughput.

You can check system status by $ sudo tegrastats

Hi,
CPU usage is 30-40% and it has 4 CPU. i checked nvpmodel and it is in mod 3. now, what can i do for slow video problem. Now, when we take these into account, what can i do for slow video problem ?

Hi,
We try the same command with Logitech Brio 4K USB camera but do not observe the issue. It might be specific to the camera. Do you have other cameras for a try?

Hi,
I have another problem about getting images from gstreamer. I was creating a frame by triggering the signal with a buffer. When I returned the number of triggers per second (ie FPS) with the callback method, I saw that it was not constant. I was hoping to see the FPS being 25 unchanged but it varies (sometimes 50, sometimes 20). Why is this happening? How can i solve this problem?

Hi,
You can run the command to ensure the source is in steady framerate:

$ gst-launch-1.0 -v v4l2src device=/dev/video8 io-mode=mmap ! video/x-raw, format=I420, width=1920, height=1080, framerate=25/1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.