Ask Your Question
0

Stall in VideoCapture.set(cv2.CAP_PROP_POS_FRAMES, 0)

asked 2018-11-07 02:42:08 -0600

tabsun gravatar image

I'm using python binding of opencv compiled from source with ffmpeg support. When I want to jump between frames, as we know, I can use cap.set(cv2.CAP_PROP_POS_FRAMES, frame_id). This is correct for most videos, but there exists some videos. When I do the same operation on it, the code will stall and no return no error no warning.

As my opencv and ffmpeg are both compiled from source, I can trace the stall is caused by :

  • set(cv2.CAP_PROP_POS_FRAMES, 0)

  • av_seek_frame(ic, video_stream, time_stamp, AVSEEK_FLAG_BACKWARD) in modules/videoio/cap_ffmpeg_impl.hpp

  • seek_frame_internal(AVFormatContext*s, ...) in libavformat/utils.c

  • avio_seek

But I am really not familiar with ffmpeg, and can not figure out the real reason for this issue. Mostly it's caused by video format, but I'm not sure about it.

here is one of the problem-videos: https://drive.google.com/file/d/11irV...

Anyone has ideas about this?

edit retag flag offensive close merge delete

Comments

not all combinations of codec/container support "seeking".

berak gravatar imageberak ( 2018-11-07 06:27:01 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-11-07 06:26:27 -0600

supra56 gravatar image

W/out second parameter. Use get.

cap.get(cv2.CAP_PROP_POS_FRAMES)
edit flag offensive delete link more

Comments

I want to jump between frames by using set instead of querying display position:)

tabsun gravatar imagetabsun ( 2018-11-07 07:13:34 -0600 )edit

You didn't say jump or scroll.. I used this on raspberry pi 3. frame by frame

supra56 gravatar imagesupra56 ( 2018-11-07 07:35:49 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-07 02:40:44 -0600

Seen: 1,234 times

Last updated: Nov 07 '18