---
title: "onemedia cookbook"
url: https://recursiveai.org/onemedia/cookbook/
description: "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…"
version: "0.1.0-preview.1"
---

# 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#](https://recursiveai.org/onemedia/cookbook/get-video-duration-resolution-codec/index.md): 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#](https://recursiveai.org/onemedia/cookbook/read-mkv-webm-info/index.md): 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#](https://recursiveai.org/onemedia/cookbook/read-video-metadata-from-url/index.md): 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#](https://recursiveai.org/onemedia/cookbook/get-video-rotation/index.md): 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#](https://recursiveai.org/onemedia/cookbook/read-mp4-metadata/index.md): 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#](https://recursiveai.org/onemedia/cookbook/video-recording-date-location/index.md): 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#](https://recursiveai.org/onemedia/cookbook/list-video-tracks/index.md): 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#](https://recursiveai.org/onemedia/cookbook/video-keyframes/index.md): 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#](https://recursiveai.org/onemedia/cookbook/extract-audio-from-video/index.md): 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.

## Command line

- [Inspect a video file from the command line](https://recursiveai.org/onemedia/cookbook/inspect-video-cli/index.md): Inspect an MP4, MOV, MKV or WebM file from the command line with the onemedia .NET tool: tracks, RFC 6381 codec strings, tags, capture time, location and rotation, as text or JSON.
