MP4视频旋转元 [英] Mp4 video rotation metadata

查看:602
本文介绍了MP4视频旋转元的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个Android / IOS视频共享应用程序,可以记录视频和上传到Amazon S3的。对于与H264 / AAC codeCS mp4格式兼容这两种机器人/ IOS记录。

I have developed an android/ios video sharing app that records a video and uploads it to amazon s3. For compatibility both android/ios record in mp4 format with H264/AAC codecs.

的用户可能会拍摄纵向还是横向的应用程序,从传感器获得的信息,设置文件(mediarecorder.setOrientationHint在Android和iOS上类似的东西)的旋转

The users might shoot portrait or landscape and the app, getting info from the sensors, set the rotation of the file (mediarecorder.setOrientationHint on android and something similar on iOS)

这是iOS的的视频播放罚款的Andr​​oid,反之亦然。问题是,当我想在web浏览器播放视频。支持MP4格式(例如,铬)的浏览器显示视频,但忽略旋转元数据。当我播放这些视频使用MPlayer在Linux同样的事情发生。

The videos from iOS play fine on android and vice versa. The problem is when i want to play a video on a web browser. The browsers that support mp4 format (ie, chrome) display the video but ignore the rotation metadata. The same thing happens when i playback those videos with mplayer on linux.

这想到的第一个解决方案是

The first solution that comes to mind is

ffmpeg -i in.mp4 -vf transpose=<rotation value> out.mp4

还有一个原因,为什么浏览器会忽略旋转元数据?是不是一个错误?我能做些什么来解决这个问题,同时录制视频?

Is there a reason why browsers ignore rotation metadata? Is it a bug? Could i do something to fix this while recording the video?

下面分别从iOS和Android 2样。

Here are 2 sample from iOS and android respectively.

Thansk

IOS影片 <一href="https://dzlf1jjn1x4to.cloudfront.net/peeks/3b5b4e88609e52780431442b52a93c28dd94a40a.mp4">android影片

推荐答案

方法1:旋转的HTML元素如果纵横比不是水平
<一href="http://stackoverflow.com/questions/12486870/chrome-html5-video-flipping-portrait-sideways">Chrome HTML5视频翻转肖像侧身

Method 1: Rotate the HTML Element if the aspect ratio is not horizontal
Chrome HTML5 Video Flipping Portrait Sideways

方法2:重新连接code iPhone的视频
<一href="http://stackoverflow.com/questions/12409613/displaying-vertical-videos-with-html5-on-chrome">Displaying与HTML5对铬垂直视频

Method 2: Re-encode the iPhone-Video
Displaying vertical videos with html5 on chrome

方法3:正确地在iOS智能设备(高级)设置方向
的iOS AVFoundation:设置视频的方向

Method 3: Set orientation properly on iOS-Devices (Advanced)
iOS AVFoundation: Setting Orientation of Video

方法4:问这个家伙,如果他已经找到了答案
<一href="http://stackoverflow.com/questions/23158281/use-ffmpeg-to-rotate-the-video-based-on-its-rotate-metadata-why-android-put?rq=1">Use FFmpeg的基础上它的&LT旋转视频,旋转&GT;元数据?为什么安卓放错了元数据?

Method 4: Ask this guy if he has found an answer
Use FFmpeg to rotate the video based on it's <rotate> metadata? Why Android put the wrong metadata?

这篇关于MP4视频旋转元的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆