2

Does anybody know what the command to release a VideoWriter object in python is?

In my code I import the following:

import cv2
import cv2.cv as cv

The documentation I can find does not say how to release the videoObject using cv2 or python at all. That is the documentation for OpenCV 2.4.5.0.

I've tried

cv.ReleaseVideoWriter(videoWriter)

and other random combinations using cv2 and cv. Nothing seems to work.

Thanks!

1
  • May be it is released automatically when you exit the program. Commented Jun 13, 2013 at 5:08

2 Answers 2

5

I compiled OpenCV 2.4.5 from its source in Fedora, and it does have a release function. Please see my IPython session which demonstrates this feature.

In [22]: out = cv2.VideoWriter('out.avi', cv2.cv.CV_FOURCC(*'MJPG'), 30.0, (100, 100), False)

In [23]: out.isOpened()
Out[23]: True

In [24]: out.    # Press `Tab`, Just checking available methods, see release is there
out.avi       out.isOpened  out.open      out.release   out.write     

In [24]: out.release()

In [25]: out.isOpened()
Out[25]: False

So please check your version.

Sign up to request clarification or add additional context in comments.

2 Comments

When I type "out." and then press the Tab key, out.release isn't an available method.
which version do you use?
3

This worked for me:

videoWriter = None

Source: "OpenCV Computer Vision with Python, by Joseph Howse", chapter 2.

1 Comment

This is works like a charm, must be the accepted answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.