I recorded a video from an android phone and turned it from portrait to landscape within the first 5 seconds.

I noticed if I play the video in Windows Media Player - it shows up portrait then turns to a 90 degree angle on its' side. However in VLC player, it shows up in portrait and when the film rotates, the position stays fixed so the video always looks correct, I guess because VLC reads the meta data of the film for the rotation angle and adjusts automatically during playback ?

However I need to save this into the actual video... so that it "automatically" turns for other players or for YouTube etc.

I have no idea how to do this?

Edit: What I mean is that the metadata for current rotation needs to be read and a video saved using this information so that the actual video stays stable when the part in the video where the phone is rotated while filming. Does that make more sense?

Try it out by filming something with your smartphone and then rotate the phone while recording from landscape to portrait or vice versa. Save the video to your PC and play with latest VLC, it stays stable but view in Windows Player and you end up with a rotated video (either it's on the side or something)

  • Can you provide a sample file?
    – llogan
    Commented Jun 22, 2015 at 19:12
  • You mean you want to transcode and make a new video that's actually rotated, instead of just having metadata telling players to rotate? I wouldn't call this "saving" anything into the video. More like applying the metadata. Commented Jun 26, 2015 at 5:24
  • Ah ok I didn't know the correct terms, thanks :)
    – dan2k3k4
    Commented Jun 26, 2015 at 5:44

2 Answers 2


I may not be able to answer this as fully as someone else, but I'd do the following:

  1. Open the video file in (most) any video editor. (something as basic as Windows Movie Maker will suffice)
  2. Split the clip at the point where the device rotates.
  3. Rotate the newly-created second clip to suit your needs.

You have to get Rotation below ways- 1)MediaMetadataRetriever class in android.Check below link http://developer.android.com/reference/android/media/MediaMetadataRetriever.html

This class in Orientation tag supported in Api Level 17(4.2+).

2) Another way FFMPEG Metadataretrival library import and get rotation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.