簡體   English   中英

使用FFmpeg進行視頻旋轉

[英]Video rotation with FFmpeg

我正在為我的iPhone應用程序開發PHP Web服務,以便用戶上傳視頻。 當用戶想要在網站上看到視頻時,他們會獲得水平視頻,因此我需要使用FFmpeg命令旋轉視頻。 有人能幫我嗎?

function make_rotation($input, $output, $transpose="1") {
    $ffmpegpath = "ffmpeg";
    if(!file_exists($input)) return false;  
    //$command = "$ffmpegpath -i $input -vf 'transpose=$transpose' $output";
    //$command = "ffmpeg -vfilters 'rotate=270' -i $input $output";
    $command ="ffmpeg -i $input -vf 'transpose=$transpose'  $output";
    exec($command);
    return true;
}

謝謝大家

ffmpeg -vfilters "rotate=90" -i input.mp4 output.mp4

以上評論適用於我,添加“rotate = 90”並檢查。

ffmpeg -i <input_video> -vf “transpose=1″ -r 30 -sameq <output_video>

也工作

我用這種方式解決了這個mencode命令的旋轉問題:

function make_rotation($input, $output, $transpose="1") {
    $cmd="mencoder -vf rotate=1 -o $output -oac pcm -ovc lavc $input";
    exec($cmd);
    if(!file_exists($output)) return false;
    if(filesize($output)==0) return false;
    return true;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM