I have a n rtsp source. I'd like to reduce its framerate to 2 frames /
second.
I am using the following pipeline:
rtspsrc location={url} latency=10000 !
rtph264depay !
h264parse !
avdec_h264 !
videoconvert !
videorate ! video/x-raw,framerate=2/1 !
appsink max-buffers=60 drop=true
Then, in Python, I am reading it like this:
cap = cv2.VideoCapture(pipeline, cv2.CAP_GSTREAMER)
start = time.time()
counter = 0
while True:
ret, frame = cap.read()
counter += 1
print("FPS", counter / (time.time() - start))
I have two problems. The first one is definitely more important to me:
1) The framerate is stable in its arithmetic meaning (number of images per
second). However, if I look at the frames, sometimes I have something like 8
frames from the same second, than maybe 4 seconds are skipped, and then it
actually works at 2FPS, then again it get stucks (many frames from the same
seconds) then it skips some seconds, etc. I am sure about this because in my
video I have the timestamp (it's printed by the camera in the video frames).
So for instance, if I want 2 FPS I should expect the seconds in the frame to
be [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, etc] while I have something like [0,
0, 0, 0, 0, 0, 4, 4, 5, 5, 5, 5, 7, 7]. Like on the average it is working,
but there are sudden burst and slow. I tried to increase the size of buffer
and latency hoping it could help, but it does not solve the problem
completely.
2) In Python, the framerate seems to be 4 FPS according to print. However, I
don't understand why, if I save the frames to a cv2.VideoWriter with 2fps
the framerate seems ok.
--
Sent from:
http://gstreamer-devel.966125.n4.nabble.com/_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel