Ask Your Question

Revision history [back]

writing to video file and reading file at same time

I am trying to write a web cam video and then read from the video file (on my HD), and display the frames, at same time. My reasoning is to be able to "rewind" or go back multiple frames, pause,etc while still capturing the video, and then to go back to live steam. I thought reading from the written file would be better/easier that having to creating a very long buffer.

Problem: After i start to write the video (which writes fine) and try to open a VideoCapture obj readVideo, the readVideo.isOpened() function returns false. I've tried to delay the readVideo instatiation by writing a bunch of frames( 30,60,100) first, but isOpened() always returns false.

If I create 2 separate programs (one to write a file, the other to read the same file) and then run each binary in two separate terminals (starting with the write file) i can write the file and read it at the same time, but of course there is a lag until the read gets to the end of file.

I'm Using: (Debian offshoot) Linux, and OpenCV 3.1

Maybe this is the wrong approach. Any ideas are appreciated.