0

When I record a video (.mov) through my iPhone it display vertically which is right. But after converting the .mov to .flv(using ffmpeg) it displays horizontally.

My code:

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;
}
blahdiblah
  • 33,069
  • 21
  • 98
  • 152
user291247
  • 53
  • 1
  • 2
  • 7

2 Answers2

2

iPhone's store orientation information in .mov metadata that ffmpeg ignores, leading to rotated output. Correctly parsing the metadata is a problem.

If you're recording movies in a consistent orientation you can rotate them by adding -vf "transpose=1" to your ffmpeg command. Docs for transpose.

blahdiblah
  • 33,069
  • 21
  • 98
  • 152
0

The orientation is a meta-data field in the video file - the actual file is not recorded in an alternate orientation. You would need to apply a transform in ffmpeg to rotate the video.

Yann Ramin
  • 32,895
  • 3
  • 59
  • 82