-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
VideoWriter resulting size one off error #24081
Copy link
Copy link
Closed
Labels
Description
System Information
OpenCV python version: 4.8.0.74
Operating System / Platform: Ubuntu 20.04
Python version: 3.8.10
Detailed description
Saving an image of shape 960, 1699, 3 gives shape 960, 1698, 3 (1699 vs 1698).
Steps to reproduce
import numpy as np
import cv2
writer = cv2.VideoWriter('res%02d.png', cv2.VideoWriter_fourcc(*'MJPG'), 1, (1699, 960))
writer.write(np.zeros((960, 1699, 3), np.uint8))
writer.release()
print(cv2.imread('res01.png').shape)The reproducer also prints OpenCV: FFMPEG: tag 0x47504a4d/'MJPG' is not supported with codec id 7 and format 'image2 / image2 sequence' after line writer = cv2.VideoWriter('res%02d.png', cv2.VideoWriter_fourcc(*'MJPG'), 1, (1699, 960))
Also reproducible for C++ (tested commit 1794cdc).
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)
Reactions are currently unavailable