2010-10-21 117 views
3

我编译了新版本的FFMPEG,并且填充命令已被弃用。
当我尝试熟悉新的-vf pad =命令时,我想问,我如何在不改变宽高比的情况下转换视频。PHP FFmpeg视频宽高比问题

我检查了很多从stackoverflow解决方案,似乎没有任何工作。
有人可以发布一个有效的PHP示例或cmd行。我会非常高兴。

请注意,有问题的视频,可能是4:3,也为16:9

比方说,我16转换:9视频为640x480格式。这将需要一些酒吧在顶部和底部
。那是我想要做的。

感谢

+0

垫和作物命令已被替换-vf垫= X:X:X:X:黑色此脚本需要更新。 – paj 2012-01-19 22:07:03

+0

嗯......当使用1280x720输入视频运行此示例代码时,出现错误[pad @ 0x7f8a48c1f9e0]输入区域0:60:1280:780不在填充区域0:0:640:480或零尺寸内 – Brian 2012-05-02 16:57:39

+0

我从来没有机会在这样的视频上运行它,真的不知道:( – Herr 2012-05-02 20:16:38

回答

2

感谢您分享此代码。

我不得不做的变化:

//keep always the same video size 
//we need to add padding and then crop the same size to keep vieos with same WxH sizes  
$command = FLV_LITE_FFMPEG_PATH . ' -i ' . $original_video; 
$command .= ' -s '.FLV_LITE_VIDEO_WIDTH . 'x' .FLV_LITE_VIDEO_HEIGHT; 
$command .= ' -croptop ' . $pad_top; 
$command .= ' -cropbottom ' . $pad_bottom; 
$command .= ' -cropleft ' . $pad_left; 
$command .= ' -cropright ' . $pad_right; 
$command .= ' -padtop ' . $pad_top; 
$command .= ' -padbottom ' . $pad_bottom; 
$command .= ' -padleft ' . $pad_left; 
$command .= ' -padright ' . $pad_right; 
$command .= ' -padcolor 0x000000'; 
$command .= ' -ab 32 -f flv -ar 22050 -b 256 -r 24 -y'; 
$command .= ' ' . $converted_video; 

exec($command, $output, $status); 
0

是没可能检查什么宽高比要转换的视频:

ffmpeg -i input.file

然后设置这在FFmpeg命令-aspect标志?

+0

问题是,我需要确定宽高比并将一个说,16:9视频转换为640x480。在顶部和底部的黑色条纹 – Herr 2010-10-21 15:33:51

+0

啊我看到了。也许这个线程会帮助http://ubuntuforums.org/showthread.php?t=702188 - 阅读philc的回复。 – Abs 2010-10-21 15:37:24

+0

你好,谢谢你找到那个网址。问题是,pad *命令已被弃用和删除,所以我不能再使用它们了。我解决了这个问题,并会在即将到来的时间内更新它。 – Herr 2010-10-21 15:44:59