【发布时间】:2015-08-18 03:18:57
【问题描述】:
如何使用“melt”命令从视频中读取总帧数 时间和每秒帧数相同。
【问题讨论】:
如何使用“melt”命令从视频中读取总帧数 时间和每秒帧数相同。
【问题讨论】:
像 Florin 一样,您也可以使用命令行和一些肮脏的 grep 来完成:
melt AAG_5766.MOV -consumer xml | grep length | grep -Eo '[0-9]+'
【讨论】:
我找到了以 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;
}
【讨论】: