1

During my work I usually use CVOpenGLESTextureCacheCreateTextureFromImage to get the cache texture from fob. I then use asssetwriter to write a mov file, the mov plays good but the video is upside-down.

I did search the internet and found that i should code this :

assetWriterInput.transform=CGAffineTransformMakeScale(1.0, -1.0);

It works fine, but when I play it on Windows XP, it is still upside down. I found that it plays well just on iOS or the Quicktime video player on non Apple OS.

So what's the reason? Why does it not work?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982

1 Answers1

0

The CGAffineTransformMaskScale' merely sets some meta information in themov` container to apply some image transformation to the video image at playback. However only the Quicktime player do respect this flag.

That the image is upside down in the first place, is due to OpenGL assuming the image origin in the lower left, while most video image formats place it in the upper left, which will of course flip the image if those assumptions collide. The sane solution would be to actually flip the image and not just set this metadata flag.

Flipping a image is easy enough, as you simply have to reverse the scanlines in an intermediate step.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • That is mean i should flip the image before recording the video,i use the opengl rendering the yup pic,how to reverse it ?can u give me somes examples about reverse the scan line? – user1586321 Feb 06 '13 at 01:41
  • @user1586321: Could you pleast add the code you use so far so that I can see how I can add it into what you have already. – datenwolf Feb 06 '13 at 11:56