onemediaCookbook
onemedia cookbook
Answers to common video file tasks in C#: duration, resolution and codec, MP4 and MKV tags, when and where a video was recorded, rotation, tracks, keyframes, reading a file over HTTP, and the audio track decoded with OneAudio. Each recipe is a complete program with the output it really prints on OneMedia 0.1.0-preview.1. OneMedia reads containers; it decodes no video.
Video file info
Get video duration, resolution and codec in C#Read a video’s duration, width and height, frame rate and codec (with its RFC 6381 string) from MP4, MOV, MKV or WebM in C#, without FFmpeg or ffprobe.Read MKV and WebM file info in C#Read an MKV or WebM file’s duration, tracks, codecs, title and Matroska tags in C#, with the Segment info (muxing and writing app, date) and tag targets, without MKVToolNix or FFmpeg.Read video metadata from a URL without downloading it in C#Read a remote video’s duration, codecs and tags in C# with HTTP range requests, fetching only the header bytes instead of downloading the whole MP4 or MKV file.Get video rotation in C#Find out whether a phone video is portrait or landscape in C#: read the MP4 or MOV rotation (0, 90, 180 or 270 degrees) and the display width and height, without decoding.
Tags and metadata
Read MP4 metadata tags in C#Read the title, artist, description, copyright and every other tag of an MP4, M4A or MOV file in C#: iTunes, QuickTime, 3GPP and XMP tags, with a common view over all of them.Get when and where a video was recorded in C#Read a video’s capture date and GPS location, and the phone make and model, from iPhone and Android MP4 and MOV files in C#, with every candidate and where it came from.
Tracks, packets and audio
List the audio, video and subtitle tracks of a video in C#List every video, audio and subtitle track of an MKV or MP4 file in C#, with codec, language, name and default flags, and pick a track by language.Get video keyframe timestamps in C#List the keyframes (I-frames, sync samples) of an MP4 or MKV video in C# with their timestamps and byte offsets, by reading packets without decoding.Extract the audio from a video to WAV in C#Extract the audio track of an MP4, MOV, MKV or WebM video and save it as WAV in C#, decoded by OneAudio: AAC, Opus, Vorbis, FLAC, MP3 and AMR, with no FFmpeg.