fuxiaopang
2017-02-25 23:08:15 +08:00
```
cmd = "/root/bin/ffmpeg -i /data/origin/{$uploadVideo->id}_.mp4 " .
"-filter:v \"scale=iw*min(1920/iw\\,1080/ih):ih*min(1920/iw\\,1080/ih), pad=1920:1080:(1920-iw*min(1920/iw\\,1080/ih))/2:(1080-ih*min(1920/iw\\,1080/ih))/2\" " .
"-b:v 4000k -minrate 3500k -maxrate 10000k -bufsize 4000k " .
"-r 25 -g 25 -c:v libx264 -ar 48000 -b:a 192k -strict -2 /data/origin/{$uploadVideo->id}_o.mp4 -y";
exec($cmd." 2>&1", $out, $ret);
if ($ret) { // Error
$uploadVideo->status = Video::STATUS_FINISH_DOWN;
$uploadVideo->save();
$cmd = "rm -rf /data/encode/{$uploadVideo->id}_*";
shell_exec($cmd);
Email::report('ENCODE VIDEO ERR', print_r($out, true));
return false;
}
```
这个是我写的用来转换自动加遮幅到 1080P 4M H264 的代码,这样上传到 youku 刚好是 1080