FormatParser.Video
(format_parser v2.14.0)
Copy Markdown
A Video struct and functions.
The Video struct contains the fields format, width_px, height_px and nature.
Supported Formats
- FLV (Flash Video)
- MP4 (MPEG-4 Part 14)
- AVI (Audio Video Interleave)
- WMV (Windows Media Video)
- MOV (QuickTime)
- WebM
- MKV (Matroska)
Summary
Functions
Parses a video file or result.
Types
@type t() :: %FormatParser.Video{ format: atom() | nil, height_px: integer() | nil, nature: atom(), width_px: integer() | nil }
A struct representing a parsed video file.
Fields
:format- The video format as an atom (e.g.,:mp4,:mkv,:webm):width_px- The video width in pixels (if available):height_px- The video height in pixels (if available):nature- Always:videofor video files
Functions
Parses a video file or result.
- If given a tuple
{:error, file}wherefileis a binary, attempts to parse the video file. - If given a binary
file, attempts to parse the video file. - For any other input, returns the input as-is.
Examples
iex> {:ok, file} = File.read("priv/test.mp4")
iex> result = FormatParser.Video.parse(file)
iex> result.format
:mp4
iex> result.nature
:video
iex> FormatParser.Video.parse(%FormatParser.Image{})
%FormatParser.Image{}