如何使用“融化”命令从视频中读取总帧数 时间和每秒帧数相同。
答案 0 :(得分:2)
像Florin一样,你也可以使用命令行和一些脏grep:
melt AAG_5766.MOV -consumer xml | grep length | grep -Eo '[0-9]+'
答案 1 :(得分: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;
}