1

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;
} 
TRiG
  • 10,148
  • 7
  • 57
  • 107
user291247
  • 53
  • 1
  • 2
  • 7
  • see http://stackoverflow.com/questions/2208522/ffmpeg-on-iphone-modifying-video-orientation. Specifically, the answer. – Jason B Jun 27 '10 at 03:45
  • which version of ffmpeg is required to run this command ffmpeg -vfilters "rotate=90" -i input.mp4 output.mp4 – user291247 Jun 28 '10 at 05:42
  • You may have to build your own and use the --enable-vfilters switch when running configure. What OS are you on? – Jason B Jun 28 '10 at 12:55
  • Hello Jason, I am new to ffmpeg and using first time, I am not getting how can I build our own,and when to use the -enable-vfilters switch, I have downloaded and my tech. support was installed it on my server.Currently I am using Mac OS on my local pc. – user291247 Jun 29 '10 at 05:43
  • I've never built it on Mac OS but here is a guide: http://stephenjungels.com/jungels.net/articles/ffmpeg-howto.html Basically you need to download the source code from their site (www.ffmpeg.org) and then run `configure`, `make`, and `make install` in the directory. You can pass arguments to the configure command to specify what parts of ffmpeg get built. --enable-vfilters is one of these options. It seems like most of the pre-built binaries available are not built with the vfilters enabled. – Jason B Jun 29 '10 at 14:01

1 Answers1

2

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
Ben Clayton
  • 80,996
  • 26
  • 120
  • 129