【发布时间】:2011-04-25 15:24:42
【问题描述】:
我一直在试图弄清楚如何使用 FFmpeg 旋转视频。我正在处理以纵向模式拍摄的 iPhone 视频。我知道如何使用MediaInfo(优秀的库,顺便说一句)确定当前的旋转度数,但我现在被困在 FFmpeg 上。
根据我的阅读,您需要使用 vfilter 选项。根据我看到的应该是这样的:
ffmpeg -vfilters "rotate=90" -i input.mp4 output.mp4
但是,我无法让它工作。首先,-vfilters 不再存在,现在只是 -vf。其次,我得到这个错误:
No such filter: 'rotate'
Error opening filters!
据我所知,我有一个全选项的 FFmpeg。运行 ffmpeg -filters 会显示:
Filters:
anull Pass the source unchanged to the output.
aspect Set the frame aspect ratio.
crop Crop the input video to x:y:width:height.
fifo Buffer input images and send them when they are requested.
format Convert the input video to one of the specified pixel formats.
hflip Horizontally flip the input video.
noformat Force libavfilter not to use any of the specified pixel formats
for the input to the next filter.
null Pass the source unchanged to the output.
pad Pad input image to width:height[:x:y[:color]] (default x and y:
0, default color: black).
pixdesctest Test pixel format definitions.
pixelaspect Set the pixel aspect ratio.
scale Scale the input video to width:height size and/or convert the i
mage format.
slicify Pass the images of input video on to next video filter as multi
ple slices.
unsharp Sharpen or blur the input video.
vflip Flip the input video vertically.
buffer Buffer video frames, and make them accessible to the filterchai
n.
color Provide an uniformly colored input, syntax is: [color[:size[:ra
te]]]
nullsrc Null video source, never return images.
nullsink Do absolutely nothing with the input video.
拥有 vflip 和 hflip 的选项非常棒,但它们无法将我带到我需要去的地方。我需要至少能够将视频旋转 90 度。 270 度也是一个很好的选择。旋转选项哪里去了?
【问题讨论】:
-
对于任何搜索 180 度旋转的人:
-vf "vflip,hflip" -
我想知道,如果这可以在不解码然后重新编码视频的情况下实现 - jpegtran 可以无损旋转 JPEG 图像的方式...
-
旋转标志请参见此处:stackoverflow.com/questions/15335073/…
-
另请参阅How to flip a video 180° (vertical/upside down) with FFmpeg? 的详细答案不要忘记重置任何现有的轮换元数据(请参阅链接)。
-
我刚刚将“transpose=1,transpose=1”的 180° 旋转视频上传到 vimeo。即使我可以播放旋转的视频,它也被 vimeo 拒绝。 @OrangeDog 的方法
-vf "vflip,hflip"很有魅力。
标签: ffmpeg rotation video-processing