Search code examples
asp.netnreco

How to get "has_b_frames" video property in NReco?


I try to get "has_b_frames" value of video, but failed at select xml node.
The code:

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

the value of root is root value 1 and root value 2 respectively,
and the value of outerxml is outerxml value with XML visualizer.

So how can I get the attribute "has_b_frames" ?
Thank you


Solution

  • You need to use appropriate XPath selector, something like this:

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