-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathShowMetadata.cs
More file actions
27 lines (23 loc) · 807 Bytes
/
Copy pathShowMetadata.cs
File metadata and controls
27 lines (23 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
namespace FFmpeg.Sharp.Example
{
/// <summary>
/// Maps to FFmpeg example: show_metadata.c
/// Open an input file and print all metadata key=value pairs.
/// </summary>
public class ShowMetadata : ExampleBase
{
public ShowMetadata() { Index = 1; Enable = false; }
public override void Execute()
{
var inFile = args.Length > 0 ? args[0] : "input.mp4";
using var demuxer = MediaDemuxer.Open(inFile);
demuxer.DumpFormat();
// Borrowed managed view over the native dictionary (demuxer owns the pointer).
var meta = demuxer.Metadata;
if (meta != null)
foreach (var kv in meta)
Console.WriteLine($"{kv.Key}={kv.Value}");
}
}
}