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

查看:453
本文介绍了使用FFmpeg根据其旋转< rotate>旋转视频元数据?为什么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看到视频的元数据时,对于正常录制的视频,我有一个rotate = 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?

提前谢谢。

推荐答案

p>在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.

所以文件中的元数据是正确的。实际的问题是您的浏览器忽略它们。见我的问题此处

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

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

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