1

I was running a simple program on reading a video file (.mp4 format) and writing it back after inverting every frame. I get an error and a bug warning.

BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called for the first time off the main thread.

Error in CoreDragRemoveTrackingHandler: -1856

I am using El Captain OSX , I have installed python virtual environment to use Python 3.5 with OpenCV 3.2.0-rc. Can somebody help me with this.?

Thanks

import numpy as np
import cv2
cap = cv2.VideoCapture('Root.mp4')
# Define the codec and create VideoWriter object
#fourcc = cv2.VideoWriter_fourcc(*'AVRN')
#out = cv2.VideoWriter('Root1.mp4',fourcc, 20.0, (640,360))
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
out = cv2.VideoWriter('Root1.avi',fourcc, 20.0, (640,360))
while(cap.isOpened()):
    ret, frame = cap.read()
    if ret==True:
        frame = cv2.flip(frame,0)

        # write the flipped frame
        out.write(frame)

        cv2.imshow('frame',frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
    else:
        break

# Release everything if job is finished
cap.release()
out.release()
cv2.destroyAllWindows()
3
  • alway put text instead of screenshot - now nobody can copy-paste your code to test it and make modifications. Commented Dec 31, 2016 at 21:50
  • ok. thanks. I will change it Commented Dec 31, 2016 at 21:52
  • maybe ask on OpenCV issues Commented Dec 31, 2016 at 21:52

3 Answers 3

1

Seems to be fixed by reinstalling opencv3 with --with-ffmpeg flag.

https://github.com/opencv/opencv/issues/7474

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

Comments

0

One thing i can tell you, there is no problem in the script you mentioned above :p, it is running fine on my system. Reinstall opencv and python in new virtual environment.

Comments

0

Try this:

cap = cv2.VideoCapture(0)
fps = 15
capSize = (1280, 720)
#print cap.get(3)
#print cap.get(4)
fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v')
out = cv2.VideoWriter('output.mov',fourcc, fps, capSize, True)

It works for me, so I hope it helps you!

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.