When converting .mov to .flv video plays horizontally
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;
}
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.
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.
精彩评论