旋转mp4视频而无需重新编码 [英] Rotate mp4 videos without re-encoding

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

问题描述

我正在寻找一种方法来旋转在Debian Wheezy系统上用Nexus 4拍摄的视频。这些视频以纵向模式拍摄,我想将它们旋转为横向模式。

I'm looking for a way to rotate videos shot with my Nexus 4 on my Debian Wheezy sytem. The videos are shot in portrait mode and I would like to rotate them to landscape mode. Preferably the rotation is command-line driven.

我发现先前的几个问题暗示了一个好的解决方案,但我似乎无法设法使其工作。

I have found several previous questions which are hinting at a good solution but I can't seem to manage to get it working.

首先出现以下问题:
使用FFmpeg旋转视频

但这表示ffmpeg已过时,我应该使用avconv。我发现了这个问题,详细说明了前进的方向。
https://askubuntu.com/问题/ 269429 /如何用avconv将视频旋转180度

But it indicates that ffmpeg is outdated and that I should use avconv. I found this question detailing the way to go forward. https://askubuntu.com/questions/269429/how-can-i-rotate-video-by-180-degrees-with-avconv

这使我使用以下命令: / p>

This made me using following command:

avconv -i original.mp4 -vf "transpose=1" -codec:v libx264 -preset slow -crf 25 -codec:a copy flipped.mp4

但是,这非常缓慢(上次测试花了我6个多小时少于3分钟的镜头),并且不会播放电影。在记录输出时也出现错误,指出Mb速率>级别限制。

However, this is painstakingly slow (last test took me more than 6 hours for less than 3 minutes of footage) and does not result in a playable movie. I also get an error in logging output which states Mb Rate > level limit.

重新编码是否存在问题?在应用旋转之前,我是否应该先将手机中的视频重新编码为另一个更可行的编码?还是我错过了另一个要点?

Is there an issue here with the re-encoding? Should I first re-encode the videos from my phone to another, more "workable" encoding before applying the rotations? Or am I missing another important point?

推荐答案

如果您只想更改元数据,以便考虑该标志的媒体播放器播放旋转文件,请尝试以下操作:

If you just want to change the metadata such that mediaplayers that consider the flag play the file rotated, try something like:

ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=90 output.mp4

找到在stackoverflow上的其他地方

这篇关于旋转mp4视频而无需重新编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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