如何用FFmpeg旋转视频? [英] How can I rotate video with FFmpeg?

查看:395
本文介绍了如何用FFmpeg旋转视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现有的视频是 .mov 并且垂直播放,但是当我使用FFmpeg将其转换为 .flv 水平播放

My existing video is .mov and plays vertically, but when I convert it to .flv with FFmpeg it plays horizontally. How can I correct the converted video to play vertically?

function convert_flv($vidtime, $infile, $outfile, $w = 0, $h = 0, $extra_infile = '', $extra_outfile = '') {
  $parms = '';
  if($w == 0 && $h == 0) {
    //$parms .= '-sameq ';
  } else {
    $parms = '-s {$w}x{$h} ';
  }

  if($vidtime==60)
  {
    $cmd = ffmpeg($infile, $outfile, $parms.' '.$extra_infile, '-t 00:01:00 -ar 22050 -r 15 -f flv '.$extra_outfile);
  }
  else
  {
    $cmd = ffmpeg($infile, $outfile, $parms.' '.$extra_infile, '-t 00:04:00 -ar 22050 -r 15 -f flv '.$extra_outfile);
  }
  print_r($cmd);
  return $cmd;
} 


推荐答案

SVN,您可以使用-vftranspose = 1旋转视频。

这是一个使用命令行的示例,我相信很容易转换为php:

With the current version pulled from SVN, you can rotate video using -vf "transpose=1".
Here's an example using the command-line, which I'm sure is easy to convert to php:

ffmpeg -vf "transpose=1" -i input.mp4 output.mp4

(以下是我如何构建ffmpeg,以帮助您)

(here's how I built ffmpeg in case this helps)

svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-shared  --disable-mmx --arch=x86_64
make
sudo make install

这篇关于如何用FFmpeg旋转视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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