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

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

问题描述

我正在处理在 iPhone 3GS 上加载了 FFmpeg 的 h264 视频.问题是任何以纵向"方向录制的视频都应用了一个变换矩阵,导致它们显示旋转 90 度的逆时钟.

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.

据我目前所知,我只需要修改tkhd"原子中的变换矩阵.问题是我无法访问或修改此数据.我检查了 FFmpeg 实现:

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)

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

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?

任何帮助将不胜感激.

谢谢,马特.

推荐答案

对于那些无法使用 v 过滤器选项的人,经过一番搜索,我找到了一个适用于我的构建的替代选项:

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

这会将视频顺时针翻转 90 度.希望这能帮助所有像我一样在 ubuntu 上挣扎的人!!:)

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

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

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