如何使用“melt”命令从视频中读取总帧数时间和每秒帧数相同。
问问题
645 次
2 回答
2
Like Florin you could also do it with the command line and some dirty grep:
melt AAG_5766.MOV -consumer xml | grep length | grep -Eo '[0-9]+'
于 2013-05-14T04:40:46.063 回答
0
我找到了一个可能的答案来获取 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;
}
于 2011-01-27T08:44:20.853 回答