开发者

How can I rotate video with FFmpeg?

开发者 https://www.devze.com 2023-01-04 16:24 出处:网络
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?

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 '.$e开发者_StackOverflowxtra_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;
} 


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

(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
0

精彩评论

暂无评论...
验证码 换一张
取 消