You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Iphone video read output changes with FFMPEG 3.3 #252
Recently we upgrade from FFMPEG 3.2 to 3.3. It seems imageio is giving out frames (mov and mp4s) from row-major to column-major. Not sure if this is an imageio or ffmpeg problem.. Anyone else seeing this?
Interesting case. I am not sure whether imageio should take a stance on whether image data should be produced in C mode or F mode. Most libs that need either mode will convert if necessary. So if your code depends on the data being in C-mode, you should probably use something like:
im=np.array(im, copy=False, order='C')
which will convert if needed, or let the image pass through otherwise.
Ah looks like it's not the byte order problem. For context, I got WARNING:root:Warning: the frame size for reading (1080, 1920) is different from the source frame size (1920, 1080). from an iphone mp4 (or .mov ). And with ffmpeg 3.2.4 I got correct image with dimension 1080 * 1920 but with ffmpeg 3.3.1 I got 1920 × 1080.
changed the title [-]imageio with FFMPEG 3.3 read video pixels in opposite order[/-][+]Iphone video read output changes with FFMPEG 3.3[/+]on Jun 6, 2017
Are you sure that the shape is incorrect? In imageio, its typical for images stored in numpy arrays to have a shape that is (height, width). I suspect that Finder reports width*height. Maybe try this:
I'm not exactly sure what we can do. I guess we can start with posting a possible workaround here (i.e. how to correct the image). But I don't think that we can reliably detect the case (consider this a challenge to proof me wrong).
Have you found a way to swizzle your image to make it correct again? If not, can you send me the image in npz format so I can have a go?
@almarklein I'm closing this issue and for context I would recommend people either swizzle manually or use the default installation function built-in from imageio.
Activity
chenliu0831 commentedon May 12, 2017
update:
ffmpeg 3.3dumps to pngs just fine. But it might be related to https://trac.ffmpeg.org/ticket/6370almarklein commentedon May 20, 2017
Does it do this with this too:
I get the correct shape
(720, 1280, 3)on Linux with the new binaries that I just uploaded (3.3.1).almarklein commentedon May 21, 2017
Reading this again, I wonder whether you meant that the images were rotated, or whether the arrays where in F mode instead of C mode.
chenliu0831 commentedon May 30, 2017
@almarklein sorry I was on vacation. yeah I mean the shape appears to be correct, but the array seems to be filled in F mode.
almarklein commentedon May 30, 2017
No need to apologize for a vacation :)
Interesting case. I am not sure whether imageio should take a stance on whether image data should be produced in C mode or F mode. Most libs that need either mode will convert if necessary. So if your code depends on the data being in C-mode, you should probably use something like:
which will convert if needed, or let the image pass through otherwise.
@blink1073 what do you think? Also cc @kuchi
blink1073 commentedon May 30, 2017
Sounds fair to me.
chenliu0831 commentedon May 31, 2017
@almarklein Cool that's a great workaround. If you guys think the root cause might be in ffmpeg feel free to close this one. Thanks.
chenliu0831 commentedon Jun 1, 2017
Ah looks like it's not the byte order problem. For context, I got
WARNING:root:Warning: the frame size for reading (1080, 1920) is different from the source frame size (1920, 1080).from an iphone mp4 (or.mov). And withffmpeg 3.2.4I got correct image with dimension1080 * 1920but withffmpeg 3.3.1I got1920 × 1080.almarklein commentedon Jun 2, 2017
Ok, so this issue should be reopened?
chenliu0831 commentedon Jun 2, 2017
@almarklein I think so. Thanks
almarklein commentedon Jun 3, 2017
Can I get a (sample of) a video to reproduce this issue?
chenliu0831 commentedon Jun 4, 2017
@almarklein could you try this link?
[-]imageio with FFMPEG 3.3 read video pixels in opposite order[/-][+]Iphone video read output changes with FFMPEG 3.3[/+]almarklein commentedon Jun 16, 2017
I get this (with ffmpeg 3.3.2):
chenliu0831 commentedon Jun 19, 2017
@almarklein right and in mac finder it shows
1080*1920and if I use raw ffempg (either 3.3 or 3.2) to dump individual frames as jpgs it looks correct.chenliu0831 commentedon Jun 22, 2017
@almarklein any update on this? it seems you were testing it under windows? On mac/linux I'm still getting the incorrect shape with 3.3+
almarklein commentedon Jun 23, 2017
Are you sure that the shape is incorrect? In imageio, its typical for images stored in numpy arrays to have a shape that is
(height, width). I suspect that Finder reportswidth*height. Maybe try this:chenliu0831 commentedon Jun 23, 2017
Yeah.... see below.

chenliu0831 commentedon Jul 13, 2017
@almarklein Just check in if you got any chance to look into this issue?
almarklein commentedon Jul 14, 2017
I'm not exactly sure what we can do. I guess we can start with posting a possible workaround here (i.e. how to correct the image). But I don't think that we can reliably detect the case (consider this a challenge to proof me wrong).
Have you found a way to swizzle your image to make it correct again? If not, can you send me the image in npz format so I can have a go?
chenliu0831 commentedon Aug 25, 2017
@almarklein I'm closing this issue and for context I would recommend people either swizzle manually or use the default installation function built-in from imageio.