0

I've spotted something strange happening. I have an MP4 file that was recorded using an android phone which I am embedding on the page to play using the HTML5 video tag. If I play it in chrome the video is upside down however if I view the same page in chrome on my phone the video plays the correct way round. Is there some sort of orientation meta value that the phone is reading and the desktop browser isn't? Obviously I want it to play the right way round in all browsers so is there a way I can work out which way round it is meant to be displayed either on the client side or with PHP on the server side?

geoffs3310
  • 5,599
  • 11
  • 51
  • 104

1 Answers1

1

The orientation is stored inside the a tag.

Maybe the desktop browser has no support for orentation.

Using PHP's getid3 lib you are probalby able to read that tag. but then you need to reconvert the video as there are no ways to set the video orientation atm.

http://getid3.sourceforge.net/

Anyway if you have maybe ffmpeg installed on the server you can create a function that checks for the orientation wehn uploaded and if its wrong it automatically converts the video.

in ffmpeg the code to rotate the video is (rotates the surce 180deg):

-vf "transpose=2,transpose=2"

Said that, no atm there is no easy way to automatically rotate the video on desktop devices.

cocco
  • 16,442
  • 7
  • 62
  • 77