如何从视频中提取方向信息? [英] How to extract orientation information from videos?
问题描述
这是一种在iOS项目中修改ffmpeg源并访问矩阵的方法 http://www.seqoy.com/correct-orientation-for -iphone-recorded-movies-with-ffmpeg /
这是一种更清晰的方式,在iOS-4
如何检测(iPhone SDK )如果视频文件以纵向或横向记录。
如何在以下任一选项中提取视频的方向 - < br>
- iOS 3.2
- ffmpeg(通过命令行服务器端)
- ruby
任何帮助将不胜感激。
Si大多数相机将其旋转/方向存储在exif-metadata中,我建议使用 exifttool
和一个ruby包装宝石称为 mini_exiftool
,这是被积极维护的。
安装exiftool:
apt-get exiftool || brew install exiftool ||端口安装exiftool
或使用任何包管理器可用
安装mini_exiftool :
gem install mini_exiftool
尝试:
irb>
需要mini_exiftool
movie = MiniExiftool.new('test_movie.mov')
movie.orientation#=> 90
欢呼
After surfing through tons of documentation on the web it seems that the iPhone always shoots the video at a 480x360 aspect ratio and applies a transformation matrix on the video track. (480x360 may change but its always the same for a given device)
Here is a way of modifying the ffmpeg source within a iOS project and accessing the matrix http://www.seqoy.com/correct-orientation-for-iphone-recorded-movies-with-ffmpeg/
Here is a cleaner way of finding the transformation matrix in iOS-4 How to detect (iPhone SDK) if a video file was recorded in portrait orientation, or landscape.
How can the orientation of the video be extracted in either of the options below -
- iOS 3.2
- ffmpeg (through the command line server side)
- ruby
Any help will be appreciated.
Since most Cameras store their rotation/orientation within the exif-metadata, i would suggest using exifttool
and the a ruby wrapper gem called mini_exiftool
which is actively maintained.
Install exiftool:
apt-get exiftool || brew install exiftool || port install exiftool
or use what ever package manager is available
Install mini_exiftool:
gem install mini_exiftool
Try it:
irb>
require 'mini_exiftool'
movie = MiniExiftool.new('test_movie.mov')
movie.orientation #=> 90
cheers
这篇关于如何从视频中提取方向信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!