161 lines
5.0 KiB
Go
161 lines
5.0 KiB
Go
|
package metadata
|
||
|
|
||
|
type Format struct {
|
||
|
// The mandatory URL representing the media:
|
||
|
// for plain file media - HTTP URL of this file,
|
||
|
// for RTMP - RTMP URL,
|
||
|
// for HLS - URL of the M3U8 media playlist,
|
||
|
// for HDS - URL of the F4M manifest,
|
||
|
// for DASH
|
||
|
// - HTTP URL to plain file media (in case of
|
||
|
// unfragmented media)
|
||
|
// - URL of the MPD manifest or base URL
|
||
|
// representing the media if MPD manifest
|
||
|
// is parsed from a string (in case of
|
||
|
// fragmented media)
|
||
|
// for MSS - URL of the ISM manifest.
|
||
|
Url string `json:"url"`
|
||
|
|
||
|
// Will be calculated from URL if missing
|
||
|
Ext string `json:"ext"`
|
||
|
|
||
|
// A human-readable description of the format
|
||
|
// ("mp4 container with h264/opus").
|
||
|
// Calculated from the format_id, width, height.
|
||
|
// and format_note fields if missing.
|
||
|
Format string `json:"format"`
|
||
|
|
||
|
// A short description of the format
|
||
|
// ("mp4_h264_opus" or "19").
|
||
|
// Technically optional, but strongly recommended.
|
||
|
FormatID string `json:"format_id"`
|
||
|
|
||
|
// Additional info about the format
|
||
|
// ("3D" or "DASH video")
|
||
|
FormatNote string `json:"format_note"`
|
||
|
|
||
|
// Width of the video, if known
|
||
|
Width int `json:"width"`
|
||
|
|
||
|
// Height of the video, if known
|
||
|
Height int `json:"height"`
|
||
|
|
||
|
// Aspect ratio of the video, if known
|
||
|
// Automatically calculated from width and height
|
||
|
AspectRatio float64 `json:"aspect_ratio"`
|
||
|
|
||
|
// Textual description of width and height
|
||
|
// Automatically calculated from width and height
|
||
|
Resolution string `json:"resolution"`
|
||
|
|
||
|
// The dynamic range of the video. One of:
|
||
|
// "SDR" (None), "HDR10", "HDR10+, "HDR12", "HLG, "DV"
|
||
|
DynamicRange string `json:"dynamic_range"`
|
||
|
|
||
|
// Average bitrate of audio and video in KBit/s
|
||
|
Tbr float64 `json:"tbr"`
|
||
|
|
||
|
// Average audio bitrate in KBit/s
|
||
|
Abr float64 `json:"abr"`
|
||
|
|
||
|
// Average video bitrate in KBit/s
|
||
|
Vbr float64 `json:"vbr"`
|
||
|
|
||
|
// Name of the audio codec in use
|
||
|
ACodec string `json:"acodec"`
|
||
|
|
||
|
// Name of the video codec in use
|
||
|
VCodec string `json:"vcodec"`
|
||
|
|
||
|
// Number of audio channels
|
||
|
AudioChannels int `json:"audio_channels"`
|
||
|
|
||
|
// Frame rate
|
||
|
Fps float64 `json:"fps"`
|
||
|
|
||
|
// Name of the container format
|
||
|
Container string `json:"container"`
|
||
|
|
||
|
// The number of bytes, if known in advance
|
||
|
Filesize *int `json:"filesize"`
|
||
|
|
||
|
// An estimate for the number of bytes
|
||
|
FilesizeApprox *int `json:"filesize_approx"`
|
||
|
|
||
|
// The protocol that will be used for the actual
|
||
|
// download, lower-case. One of "http", "https" or
|
||
|
// one of the protocols defined in downloader.PROTOCOL_MAP
|
||
|
Protocol string `json:"protocol"`
|
||
|
|
||
|
// Base URL for fragments. Each fragment's path
|
||
|
// value (if present) will be relative to
|
||
|
// this URL.
|
||
|
FragmentBaseUrl *string `json:"fragment_base_url"`
|
||
|
|
||
|
// A list of fragments of a fragmented media.
|
||
|
// Each fragment entry must contain either an url
|
||
|
// or a path. If an url is present it should be
|
||
|
// considered by a client. Otherwise both path and
|
||
|
// fragment_base_url must be present.
|
||
|
Fragments []Fragment `json:"fragments"`
|
||
|
|
||
|
// Is a live format that can be downloaded from the start.
|
||
|
IsFromStart bool `json:"is_from_start"`
|
||
|
|
||
|
// Order number of this format. If this field is
|
||
|
// present and not None, the formats get sorted
|
||
|
// by this field, regardless of all other values.
|
||
|
// -1 for default (order by other properties),
|
||
|
// -2 or smaller for less than default.
|
||
|
// < -1000 to hide the format (if there is
|
||
|
// another one which is strictly better)
|
||
|
Preference *int `json:"preference"`
|
||
|
|
||
|
// Language code, e.g. "de" or "en-US".
|
||
|
Language string `json:"language"`
|
||
|
|
||
|
// Is this in the language mentioned in
|
||
|
// the URL?
|
||
|
// 10 if it's what the URL is about,
|
||
|
// -1 for default (don't know),
|
||
|
// -10 otherwise, other values reserved for now.
|
||
|
LanguagePreference int `json:"language_preference"`
|
||
|
|
||
|
// Order number of the video quality of this
|
||
|
// format, irrespective of the file format.
|
||
|
// -1 for default (order by other properties),
|
||
|
// -2 or smaller for less than default.
|
||
|
Quality float64 `json:"quality"`
|
||
|
|
||
|
// Order number for this video source
|
||
|
// (quality takes higher priority)
|
||
|
// -1 for default (order by other properties),
|
||
|
// -2 or smaller for less than default.
|
||
|
SourcePreference int `json:"source_preference"`
|
||
|
|
||
|
// A dictionary of additional HTTP headers to add to the request.
|
||
|
HttpHeaders map[string]string `json:"http_header"`
|
||
|
|
||
|
// If given and not 1, indicates that the
|
||
|
// video's pixels are not square.
|
||
|
// width : height ratio as float.
|
||
|
StretchedRatio *float64 `json:"stretched_ratio"`
|
||
|
|
||
|
// The server does not support resuming the (HTTP or RTMP) download.
|
||
|
NoResume bool `json:"no_resume"`
|
||
|
|
||
|
// The format has DRM and cannot be downloaded.
|
||
|
HasDrm bool `json:"has_drm"`
|
||
|
|
||
|
// A query string to append to each
|
||
|
// fragment's URL, or to update each existing query string
|
||
|
// with. Only applied by the native HLS/DASH downloaders.
|
||
|
ExtraParamToSegmentUrl string `json:"extra_param_to_segment_url"`
|
||
|
|
||
|
// A dictionary of HLS AES-128 decryption information
|
||
|
// used by the native HLS downloader to override the
|
||
|
// values in the media playlist when an '#EXT-X-KEY' tag
|
||
|
// is present in the playlist
|
||
|
HlsAes *HlsAes `json:"hls_aes"`
|
||
|
}
|