如何在NReco中获取“ has_b_frames”视频属性?

时间:2019-04-10 10:00:37

标签: asp.net nreco

我尝试获取视频的“ has_b_frames”值,但在选择xml节点时失败。
代码:

var videoInfo = new FFProbe();
var root = videoInfo.GetMediaInfo(filename).Result.CreateNavigator();
root.Select("/ffprobe/streams");
root.MoveToNextAttribute();

root的值为 root value 1root value 2
并且externalxml的值为outerxml value with XML visualizer

那么如何获取属性“ has_b_frames”?
谢谢

1 个答案:

答案 0 :(得分:0)

您需要使用适当的XPath选择器,如下所示:

var mediaInfo = videoInfo.GetMediaInfo(filename);
var has_b_frames = mediaInfo.Result.CreateNavigator().SelectSingleNode(
  "/ffprobe/streams/stream[@index=\"0\"]/@has_b_frames")?.Value;