CaptionTracks

VideoFrame.CaptionTracks property

Gets the collection of closed captions associated with the video frame. This property is read-only and returns an ICaptionsCollection containing all caption tracks.

public ICaptionsCollection CaptionTracks { get; }

Examples

Example:

[C#]
using (Presentation pres = new Presentation("video with captions.pptx"))
{
    foreach (IShape shape in pres.Slides[0].Shapes)
    {
        if (!(shape is IVideoFrame videoFrame)) continue;

        foreach (var captionTrack in videoFrame.CaptionTracks)
        {
            // Extracts the captions binary data and saves them to the file
            System.IO.File.WriteAllBytes(captionTrack.CaptionId + ".vtt", captionTrack.BinaryData);
        }
    }
}

See Also