我一直在尝试找出如何使用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度也是一个极好的选择。旋转选项哪里去了?
-vf "vflip,hflip"
-vf "vflip,hflip"
魅力。