0

Why No video saved?

    self.writer = cv.CreateVideoWriter("test1.mp4", cv2.cv.CV_FOURCC('M', 'J', 'P', 'G'), fps, frame_size, is_color )

    self.writer = cv.CreateVideoWriter("tsest3.mp4",cv.CV_FOURCC(*'H264'), fps, (320, 240), is_color )
    self.writer = cv.CreateVideoWriter("test4.mpg", cv.CV_FOURCC('P', 'I', 'M', '1'), fps, (320, 240), is_color )

I used WriteFrame too but still no file created or the size is 0kb.

4
  • you should first threshold your image so that anything but white is blacked out. then you can remove noise (and small white object) with opening. try optical flow on the resulting image. Commented Oct 23, 2015 at 6:28
  • I would suggest simpler background subtraction for this task, instead of optical flow. See for example this excellent tutorial Commented Oct 23, 2015 at 6:32
  • @Azad you mean this ? github.com/dereks/motion_tracking Commented Oct 23, 2015 at 7:24
  • @EladJoseph I saw that but some how it will alwayz find some thing to track no matter how I change params Commented Oct 23, 2015 at 7:31

1 Answer 1

2

According to the OpenCV 2.4.11.0 documentation-

However, OpenCV is mainly a computer vision library, not a video stream, codec and write one. Therefore, the developers tried to keep this part as simple as possible. Due to this OpenCV for video containers supports only the avi extension, its first version. A direct limitation of this is that you cannot save a video file larger than 2 GB.

Workaround-

As an alternative, create the video track with OpenCV and expand it with sound tracks or convert it to other formats by using video manipulation programs such as VirtualDub or AviSynth.

Do read the complete section describing the structure of video files. Also have a look at https://stackoverflow.com/a/29746666/3681882

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

Comments

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.