mirror of
https://github.com/mpv-player/mpv
synced 2024-11-14 22:48:35 +01:00
ytdl_hook, edl: add fps, samplerate codec parameters
Well, didn't help much in the case I was interested it.
This commit is contained in:
parent
2eab35fdf7
commit
605e1fb766
@ -291,6 +291,13 @@ This has the following parameters:
|
|||||||
``w``, ``h``
|
``w``, ``h``
|
||||||
For video codecs: expected video size. See ``codec`` for details.
|
For video codecs: expected video size. See ``codec`` for details.
|
||||||
|
|
||||||
|
``fps``
|
||||||
|
For video codecs: expected video framerate, as integer. (The rate is usually
|
||||||
|
only crudely reported, and it makes no sense to expect exact values.)
|
||||||
|
|
||||||
|
``samplerate``
|
||||||
|
For audio codecs: expected sample rate, as integer.
|
||||||
|
|
||||||
The ``delay_open`` header is not part of the core EDL format. It may be changed
|
The ``delay_open`` header is not part of the core EDL format. It may be changed
|
||||||
or removed at any time, depending on mpv's internal requirements.
|
or removed at any time, depending on mpv's internal requirements.
|
||||||
|
|
||||||
|
@ -270,6 +270,8 @@ static struct tl_root *parse_edl(bstr str, struct mp_log *log)
|
|||||||
sh->codec->codec = "null";
|
sh->codec->codec = "null";
|
||||||
sh->codec->disp_w = get_param_int(&ctx, "w", 0);
|
sh->codec->disp_w = get_param_int(&ctx, "w", 0);
|
||||||
sh->codec->disp_h = get_param_int(&ctx, "h", 0);
|
sh->codec->disp_h = get_param_int(&ctx, "h", 0);
|
||||||
|
sh->codec->fps = get_param_int(&ctx, "fps", 0);
|
||||||
|
sh->codec->samplerate = get_param_int(&ctx, "samplerate", 0);
|
||||||
tl->delay_open = true;
|
tl->delay_open = true;
|
||||||
} else {
|
} else {
|
||||||
mp_err(log, "Unknown header: '%.*s'\n", BSTR_P(f_type));
|
mp_err(log, "Unknown header: '%.*s'\n", BSTR_P(f_type));
|
||||||
|
@ -403,9 +403,16 @@ local function formats_to_edl(json, formats, use_all_formats)
|
|||||||
for _, sub in ipairs(tracks) do
|
for _, sub in ipairs(tracks) do
|
||||||
-- A single track that is either audio or video. Delay load it.
|
-- A single track that is either audio or video. Delay load it.
|
||||||
local codec = map_codec_to_mpv(sub.codec)
|
local codec = map_codec_to_mpv(sub.codec)
|
||||||
|
local props = ""
|
||||||
|
if sub.media_type == "video" then
|
||||||
|
props = props .. ",w=" .. as_integer(track.width)
|
||||||
|
.. ",h=" .. as_integer(track.height)
|
||||||
|
.. ",fps=" .. as_integer(track.fps)
|
||||||
|
elseif sub.media_type == "audio" then
|
||||||
|
props = props .. ",samplerate=" .. as_integer(track.asr)
|
||||||
|
end
|
||||||
hdr[#hdr + 1] = "!delay_open,media_type=" .. sub.media_type ..
|
hdr[#hdr + 1] = "!delay_open,media_type=" .. sub.media_type ..
|
||||||
",codec=" .. (codec or "null") .. ",w=" ..
|
",codec=" .. (codec or "null") .. props
|
||||||
as_integer(track.width) .. ",h=" .. as_integer(track.height)
|
|
||||||
|
|
||||||
-- Add bitrate information etc. for better user selection.
|
-- Add bitrate information etc. for better user selection.
|
||||||
local byterate = 0
|
local byterate = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user