【问题标题】:Melt command: how to read video properties?Melt 命令:如何读取视频属性?
【发布时间】:2015-08-18 03:18:57
【问题描述】:

如何使用“melt”命令从视频中读取总帧数 时间和每秒帧数相同。

【问题讨论】:

    标签: video mlt


    【解决方案1】:

    像 Florin 一样,您也可以使用命令行和一些肮脏的 grep 来完成:

    melt AAG_5766.MOV -consumer xml | grep length | grep -Eo '[0-9]+'
    

    【讨论】:

      【解决方案2】:

      我找到了以 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;
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-01-03
        • 1970-01-01
        • 1970-01-01
        • 2014-12-15
        • 2021-12-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多