5

I would like to load a video file's frames into a numpy array. I want the frames to be properly upright, which means I need to read the orientation metadata in the video file, and rotate the loaded frames accordingly.

I have a means of loading the frames (opencv's python bindings), so all I need is a way to read the video file's orientation metadata.

I'm trying to read a .MOV file recorded off my iPhone, in python running on an Ubuntu 14.04 machine.

Stuff I've looked at:

  • opencv: no way of inspecting video orientation
  • hachoir-metadata: doesn't display orientation metadata
  • enzyme: only works on .mkv files, AFAICT.
  • ffmpeg: no longer available as a stand-alone executable on Ubuntu's repositories. This is a dealbreaker since I'd rather just hand-specify the rotation rather than go through the trouble of compiling ffmpeg from source just to get video orientation.
  • PIL, pyexiv: AFAICT, only loads image files.

I'm running the code on an Ubuntu 14.04 machine, so I'm looking for libraries or command-line programs available on that platform.

Any pointers would be greatly appreciated.

SuperElectric
  • 17,548
  • 10
  • 52
  • 69
  • Use ffmpeg to extract image and use the image processing of pillow http://linuxers.org/tutorial/how-extract-images-video-using-ffmpeg – shevski Jan 05 '15 at 14:51
  • Possible duplicate of [How to extract orientation information from videos?](http://stackoverflow.com/questions/5287603/how-to-extract-orientation-information-from-videos) – llogan Dec 23 '16 at 18:44

2 Answers2

1

We use MediaInfo (libmediainfo)

it is running both on Windows and Ubuntu, and you can get all you need (codec, aspect, fps, bitrate, orientation...).

SuperElectric
  • 17,548
  • 10
  • 52
  • 69
Eyal Ch
  • 9,552
  • 5
  • 44
  • 54
1

use qtrotate. It's just one file, and it works on .Mov files

https://github.com/danielgtaylor/qtrotate

scanner
  • 293
  • 3
  • 16