如何使用时间和每秒帧数相同的"melt“命令从视频中读取总帧数。
发布于 2011-01-27 16:44:21
我找到了一个可能的答案来获取XML格式的属性。
用法:melt movie.flv -consumer xml
php代码:
//get total frames and framerate
ob_start();
system('melt '.$video.' -consumer xml');
$clip_prop = ob_get_contents();
ob_end_clean();
$xml_prop = new DOMDocument();
$xml_prop->loadXML( $clip_prop );
$properties = $xml_prop->getElementsByTagName("property");
foreach( $properties as $property )
{
$attribute = $property->getAttribute("name");
//for total frames
if( $attribute == "length" )
$frames = $property->nodeValue;
//for frame rates
if( $attribute == "meta.media.0.stream.frame_rate" )
$fps = $property->nodeValue;
}发布于 2013-05-14 12:40:46
像Florin一样,你也可以用命令行和一些脏的grep来做:
melt AAG_5766.MOV -consumer xml | grep length | grep -Eo '[0-9]+'https://stackoverflow.com/questions/4645910
复制相似问题