iPhone上的FFmpeg - 修改视频方向 [英] FFmpeg on iPhone - Modifying Video Orientation

查看:405
本文介绍了iPhone上的FFmpeg - 修改视频方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在搞笑iPhone 3GS上加载FFmpeg的h264影片。问题是以纵向方向记录的任何视频都应用了一个转换矩阵,使它们显示旋转的90度逆时针。



从我迄今为止所了解的,我只需要修改'tkhd'原子中的变换矩阵。问题是我无法访问或修改这些数据。我检查了FFmpeg的实现:

  static int mov_read_tkhd(MOVContext * c,ByteIocontext * pb,MOVAtom atom)

这清楚地显示了如何在avformat中访问矩阵,但是当我尝试使用相同的函数访问头字节时没有任何理性的价值观。即使我成功地拉矩阵我不知道如何替换它? FFmpeg具有检索和附加到轨道标题的功能,但没有替换它似乎?



任何帮助将不胜感激。



谢谢,
Matt。

解决方案

对于那些无法获得v过滤器选项的人,经过一些搜索,我发现一个替代选项适用于我的构建:

  ffmpeg -i in.avi -vftranspose = 1 out.avi 

这会将视频顺时针旋转90度。希望这有助于所有ubuntu上的人像我一样挣扎! :)


I'm messing with h264 videos loaded with FFmpeg on the iPhone 3GS. The problem is any videos recorded in "Portrait" orientation have a transformation matrix applied to them causing them to display rotated 90 degrees counter-clock.

From what I understand thus far, I just need to modify the transform matrix in the 'tkhd' atom. The problem is I am having trouble accessing or modifying this data. I checked out the FFmpeg implementation for:

static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)

which clearly shows how the matrix is accessed in avformat but when I try to access the header bytes using the same functions I am not getting any rational values. Even if I were to successfully pull the matrix I'm not sure how to replace it? FFmpeg has functions for retrieving and appending to the track header but nothing for replace it seems?

Any help would be greatly appreciated.

Thanks, Matt.

解决方案

To those who cannot get the v filter option to work, after some searching I found an alternative option which works for my build:

ffmpeg -i in.avi -vf "transpose=1" out.avi

this flips the video 90 degrees clockwise. hope this helps all those on ubuntu struggling like I was!! :)

这篇关于iPhone上的FFmpeg - 修改视频方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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