0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00

loadfile,select.lua: print bitrates of tracks

This commit is contained in:
Guido Cella 2024-06-27 16:33:48 +02:00 committed by Kacper Michajłow
parent 7bcd525dce
commit 5f8ac5b862
2 changed files with 9 additions and 3 deletions

View File

@ -299,8 +299,10 @@ static void print_stream(struct MPContext *mpctx, struct track *t, bool indent)
if (s && s->codec->samplerate)
APPEND(b, " %d Hz", s->codec->samplerate);
}
if (s && s->hls_bitrate > 0)
APPEND(b, " %d kbps", (s->hls_bitrate + 500) / 1000);
if (s && s->codec->bitrate)
APPEND(b, " %d kbps", (s->codec->bitrate + 500) / 1000);
if (s && s->hls_bitrate)
APPEND(b, " %d HLS kbps", (s->hls_bitrate + 500) / 1000);
APPEND(b, ")");
bool first = true;

View File

@ -97,7 +97,11 @@ local function format_track(track)
(track["codec-profile"] and track.type == "audio"
and track["codec-profile"] .. " " or "") ..
(track["demux-samplerate"] and track["demux-samplerate"] / 1000 ..
" kHz " or "")
" kHz " or "") ..
(track["demux-bitrate"] and string.format("%.0f", track["demux-bitrate"] / 1000)
.. " kbps " or "") ..
(track["hls-bitrate"] and string.format("%.0f", track["hls-bitrate"] / 1000)
.. " HLS kbps " or "")
):sub(1, -2) .. ")" .. format_flags(track)
end