how to get a video file's orientation in Python - python

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.

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

use qtrotate. It's just one file, and it works on .Mov files
https://github.com/danielgtaylor/qtrotate

Related

Kivy Video class rtsp stream not working on other pc

I have created an app that displays rtsp streams in Kivy grid view. It works just fine on my computer, but when I deploy it to another PC everything works up until the video needs to be playing in the grid (i just get white squares in the lower left of the tile). I strongly feel that there is a package I need to download that Kivy Documentation does not mention.
I have pip installed all kivy dependencies, Cython, and Pillow on the other PC.
I would like to see video in each block as I do on the PC that I built the app on
No RTSP Stream Coming Through
***Update: (On the other PC (mini PC)) I uninstalled Python 3.7.3, reinstalled it, installed kivy in the proper order according to their install for windows documentation, and installed Cython. This got it working but now some the text is missing in the app. Also, I am getting multiple .dll errors (libopus-0.dll and libgstopus.dll) I tried removing gstreamer from the python share folder and that got it back to just showing white boxes.

Opencv failed to parse AVI

I've installed opencv3.1.0 through anaconda along with the ffmpeg package. opencv still gives
Failed to parse avi: index was not found
when I try to read an .avi file.
Is it possible to have .avi files work straight out of anaconda or do I have to compile everything manually (a process I have not have had much luck with so far).

Pillow cannot read different TIFF files

I'm using Pillow 2.2.1 (installed it with pip) on Ubuntu Server 12.04 64-bit and trying to batch resize images into jpeg format. I've also installed both zlib1g-dev and libtiff-dev with apt-get.
I use the following line
Image.open(path/to/image)
to open the image files (jpeg and tiff's). I can open some tiff images, but for others I just get the following error:
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 2006, in open
raise IOError("cannot identify image file")
Since this doesn't occur for every tiff image I try to open does this mean that these files are corrupted? I have no problem opening the images in question with windows photo viewer or even with GIMP though.
Note: All the images were just given to me by my client so I have no idea how he digitized the images (scanned or took a picture of them is my best guess), or if that even matters.
Am I missing a package or dependency, or is there really just something about the image files that I'm not seeing?
TIFF is only a container format (like AVI on the video). The file extension does not actually signify how the image data inside is encoded. Most professional photo editing applications create their own flavour of TIFF which is unreadable in other software. PIL might support only certain subset of TIFF flavours (e.g. uncompressed).
If your system is a web upload style system I suggest you stop accepting TIFF format to avoid problems altogether.
More information: http://en.wikipedia.org/wiki/Tagged_Image_File_Format

full built file support PYGAME

I cant load images thats not BMP files in pygame.
Ive searched everywhere for solution but I couldn't find one.
In pygame site they say this:
The image module is a required dependency of Pygame, but it only
optionally supports any extended file formats. By default it can only
load uncompressed BMP images. When built with full image support, the
pygame.image.load - load new image from a file function can support
the following formats.
I couldn't understand what to do, and how can I get the full build image support.
I am running python 3.3 on ubuntu 13.04.
I'm new to python.
help?
the error:
File "/home2/tor/workspace/PYGAME/src/Main.py", line 13, in <module>
ball = pygame.image.load("/home2/tor/Downloads/ball.gif")
pygame.error: File is not a Windows BMP file
BTW I also tried this on jpg file.
Your version of Pygame may not be sufficient for Python 3 on your system, I believe ubuntu 13.04 comes with Python 3 installed by default, I am not sure if it has Python 2, but if it did happen to have it, I would use that instead.
Information from this question: PyGame.error in ubuntu
Right below where it says "can support the following formats" the list says:
JPG
PNG
GIF (non animated)
BMP
PCX
TGA (uncompressed)
TIF
LBM (and PBM)
PBM (and PGM, PPM)
XPM
Although it does say it is not a Windows BMP file, that does not mean it has to be bmp. I do not believe gif is supported when animated as the list says.
Here is an example from the pygame comments for a png image.
char_surf=pygame.image.load(os.path.join('data', 'char.png'))

How do I use Ghostscript with Python? converting images from eps to png / jpg/ pdf

Question(s):
I am trying to get a turtle graphic window to save as a jpg. Presently I can get it to save as a .ps or .eps file.
can=turtle.getscreen().getcanvas()
can.postscript(file="test1.eps")
From here, I was hoping to use Ghostscript to convert the file to jpg/png/pdf.
Using the ghostscript documentation, it looks like this would work: (https://www.ghostscript.com/doc/9.22/Use.htm#Invoking)
ps2pdf file.ps
Here is my dilemma. I cannot install ghostscript to my boot drive. I am on a network so this prevents me. I do have a drive I can install to, but I don't know if that will work with ghostscript and python. Any ideas?
GHOSTSCRIPT : I am not sure how ghostscript works with python (or otherwise). I tried to log into the IRC chat on the ghostscript site, but that doesn't seem active for non-paying customers.

Categories

Resources