{"action":"created","issue":{"url":"https://api.github.com/repos/Itseez/opencv/issues/6275","repository_url":"https://api.github.com/repos/Itseez/opencv","labels_url":"https://api.github.com/repos/Itseez/opencv/issues/6275/labels{/name}","comments_url":"https://api.github.com/repos/Itseez/opencv/issues/6275/comments","events_url":"https://api.github.com/repos/Itseez/opencv/issues/6275/events","html_url":"https://github.com/Itseez/opencv/issues/6275","id":141189669,"number":6275,"title":"VideoCapture get(cv2.CAP_PROP_FRAME_HEIGHT) incorrectly returns width value instead with MJPEG video","user":{"login":"anthonyk91","id":10007449,"avatar_url":"https://avatars.githubusercontent.com/u/10007449?v=3","gravatar_id":"","url":"https://api.github.com/users/anthonyk91","html_url":"https://github.com/anthonyk91","followers_url":"https://api.github.com/users/anthonyk91/followers","following_url":"https://api.github.com/users/anthonyk91/following{/other_user}","gists_url":"https://api.github.com/users/anthonyk91/gists{/gist_id}","starred_url":"https://api.github.com/users/anthonyk91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthonyk91/subscriptions","organizations_url":"https://api.github.com/users/anthonyk91/orgs","repos_url":"https://api.github.com/users/anthonyk91/repos","events_url":"https://api.github.com/users/anthonyk91/events{/privacy}","received_events_url":"https://api.github.com/users/anthonyk91/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Itseez/opencv/labels/invalid","name":"invalid","color":"000000"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-16T06:50:47Z","updated_at":"2016-03-16T07:07:06Z","closed_at":"2016-03-16T07:07:06Z","body":"When reading from a file using the MJPEG codec, querying the frame height property returns an incorrect value, the frame width is returned instead.  I don't know what role the codec has in causing the error, however if I read a file with MPEG4 the error isn't produced.\r\n\r\nSteps that produce the error:\r\n1. find MPEG4 file, which reads the properties correctly\r\n2. convert the file to MJPEG using ffmpeg -i mpeg4file.avi qscale:v 2 -vcodec mjpeg mjpegfile.avi\r\n3. open file using VideoCapture and read height and width properties\r\n\r\n```\r\n>>> import cv2\r\n>>> vc = cv2.VideoCapture('mpeg4file.avi')\r\n>>> vc.get(cv2.CAP_PROP_FRAME_HEIGHT)\r\n240.0\r\n>>> vc.get(cv2.CAP_PROP_FRAME_WIDTH)\r\n320.0\r\n>>> vc = cv2.VideoCapture('mjpegfile.avi')\r\n>>> vc.get(cv2.CAP_PROP_FRAME_HEIGHT)\r\n320.0\r\n>>> vc.get(cv2.CAP_PROP_FRAME_WIDTH)\r\n320.0\r\n>>> r,frame = vc.read()\r\n>>> frame.shape\r\n(240, 320, 3)\r\n```\r\nThe headers of the file seem to be ok:\r\n\r\n```\r\n% ffmpeg -i mjpegfile.avi \r\nffmpeg version 2.6.2 Copyright (c) 2000-2015 the FFmpeg developers\r\n  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)\r\n  configuration: --enable-pic --disable-yasm --enable-shared\r\n  libavutil      54. 20.100 / 54. 20.100\r\n  libavcodec     56. 26.100 / 56. 26.100\r\n  libavformat    56. 25.101 / 56. 25.101\r\n  libavdevice    56.  4.100 / 56.  4.100\r\n  libavfilter     5. 11.102 /  5. 11.102\r\n  libswscale      3.  1.101 /  3.  1.101\r\n  libswresample   1.  1.100 /  1.  1.100\r\nInput #0, avi, from 'mjpegfile.avi':\r\n  Metadata:\r\n    encoder         : Lavf56.25.101\r\n  Duration: 00:03:21.53, start: 0.000000, bitrate: 1540 kb/s\r\n    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 320x240 [SAR 1:1 DAR 4:3], 1537 kb/s, 15 fps, 15 tbr, 15 tbn, 15 tbc\r\n    Metadata:\r\n```\r\n\r\n- OpenCV version: 3.0.0\r\n- Host OS: Linux CentOS 7\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Itseez/opencv/issues/comments/197188448","html_url":"https://github.com/Itseez/opencv/issues/6275#issuecomment-197188448","issue_url":"https://api.github.com/repos/Itseez/opencv/issues/6275","id":197188448,"user":{"login":"alalek","id":4981219,"avatar_url":"https://avatars.githubusercontent.com/u/4981219?v=3","gravatar_id":"","url":"https://api.github.com/users/alalek","html_url":"https://github.com/alalek","followers_url":"https://api.github.com/users/alalek/followers","following_url":"https://api.github.com/users/alalek/following{/other_user}","gists_url":"https://api.github.com/users/alalek/gists{/gist_id}","starred_url":"https://api.github.com/users/alalek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alalek/subscriptions","organizations_url":"https://api.github.com/users/alalek/orgs","repos_url":"https://api.github.com/users/alalek/repos","events_url":"https://api.github.com/users/alalek/events{/privacy}","received_events_url":"https://api.github.com/users/alalek/received_events","type":"User","site_admin":false},"created_at":"2016-03-16T07:07:06Z","updated_at":"2016-03-16T07:07:06Z","body":"Fixed in 3.1.0 (#5671)"}}