I'm starting to decode/encode videos for an app and it seems that BigFlake's site is the authoritative reference for working video code. I've copied the ExtractMpegFramesTest_egl14.java into my project and modified it to use different file paths, but nothing else. It extracts properly frames from pre recorded videos I copy into the device. However, when trying to use it with a video recorded from the device's camera I get frames which are just horizontal lines:
After testing different recorded videos I realised the problem comes from rotated videos. The device's camera encodes frames as they come from the framebuffer and then slaps a rotation tag on the video. This can be extracted from the MediaFormat
object:
int rotation = format.getInteger("rotation-degrees");
Unfortunately swapping the width/height of the saved image doesn't alter anything, the images still get corrupted. What has to be done to the save code to handle rotated frames correctly?