Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What does the following error message mean? #176

Closed
yxchng opened this issue Mar 8, 2017 · 4 comments
Closed

What does the following error message mean? #176

yxchng opened this issue Mar 8, 2017 · 4 comments

Comments

@yxchng
Copy link

yxchng commented Mar 8, 2017

OpenCV Error: Assertion failed (image->depth == 8) in writeFrame, file /home/yxchng/OpenCV/modules/videoio/src/cap_ffmpeg.cpp, line 272

I follow the VideoWriter example but I couldnt save a video. Instead I got the above error.

@shrubb
Copy link
Contributor

shrubb commented Mar 8, 2017

It's an error similar to this one. Be careful about image depth (RGB or grayscale) and the type of video codec you use. Try different options.

@yxchng
Copy link
Author

yxchng commented Mar 8, 2017

@shrubb I tried using XVID, MPEG, H264. All don't work. Image depth is rgb.

If i can do imwrite why i cant do videowriter.write?

@shrubb
Copy link
Contributor

shrubb commented Mar 11, 2017

Because OpenCV works this way -- every function has constraints on the types of input matrices (images). imwrite has nothing to do with VideoWriter.write, they are completely different functions with different constraints.

Image depth can't be RGB. This is the channel layout. Depth is the number of bits per pixel. As far as I remember, VideoWriter typically requires 8 bit per channel pixel. So it should work with ByteTensors.

@hahakid
Copy link

hahakid commented Jun 25, 2018

https://stackoverflow.com/questions/38880740/python-opencv-cv2-videowriter-error
add np.uint8(your_variable) before write

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants