0

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

honeytoast
  • 55
  • 1
  • 1
  • 5

1 Answers1

0

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;
Vitaliy Fedorchenko
  • 8,447
  • 3
  • 37
  • 34