使用FFmpeg的基于其与LT旋转视频;旋转>元数据?为什么Android的放错了元数据? [英] Use FFmpeg to rotate the video based on its <rotate> metadata? Why does Android put the wrong metadata?

查看:363
本文介绍了使用FFmpeg的基于其与LT旋转视频;旋转>元数据?为什么Android的放错了元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,用户上传的视频。结果
对于我的网站,我也有一个Android应用程序。结果
该网站(从浏览器或Android)创建每个上传视频的缩略图。

I have a website where the user uploads a video.
For my website i have also an Android application.
The website creates a thumbnail of each uploaded video (from browser or Android).

问题是正常的视频这一切都不错,但为Android我的视频被旋转90°。

The problem is that for normal videos it's all OK, but for android my videos are rotated by 90°.

我认为,Android有一个漏洞,因为当我的FFmpeg看到该视频的元数据,对于一个正常录制的视频我得到了一个旋转= 90值以及90°旋转的视频,我没有在任何元数据(以及缩略图是正确的)。

I think that Android has a bug, because when I see with FFmpeg the video's metadata, for a normal recorded video I got a rotate=90 value, and for a 90° rotated video, I don't have anything in the metadata (and the thumbnail is correct).

为什么呢?

这是一个正常录制的视频图像(与手机的肖像模式)。

This is an image of a normal recorded video (with the phone in portrait mode).

反正我在视频中的元数据,我可以创建基于元数据的缩略图而不提取元数据旋转值,然后使用的ffmpeg 旋转此值的视频?

Anyway, I have the metadata in the video, can I create its thumbnail based on its metadata's rotate value without extracting the metadata and then use ffmpeg to rotate the video on this value?

感谢您提前。

推荐答案

在Android上,拿着手机在肖像被认为是90度。这一点,Android是用约定:

On android, holding your phone in portrait is considered to be 90 degrees. This the convention that android is using:

景观:0
画像:90
相反的景观:180
相反的肖像:270

landscape: 0 portrait: 90 reverse landscape: 180 reverse portrait: 270

我知道这是没有道理的手机,但它确实为平板电脑并没有真的在Android平板电脑和手机之间没有什么区别。

I know this doesn't make sense for phones but it does for tablets and there is realy no difference between tablets and phones on android.

因此​​,文件中的元数据是正确的。实际的问题是,您的浏览器会忽略它们。见我问 href=\"http://stackoverflow.com/questions/21834100/mp4-video-rotation-metadata\">

So the metadata in the file are correct. The actual problem is that your browser ignores them. See me question here

这篇关于使用FFmpeg的基于其与LT旋转视频;旋转>元数据?为什么Android的放错了元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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