-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
various: sync track information output #14453
Conversation
Download the artifacts for this pull request: |
646b914
to
b8738e6
Compare
This isn't an accurate description of images:
The behavior is also different for different demuxers. For example, for gif animations, |
single frame AV1 is basically an AVIF image. It is correct to call it image. |
player/lua/stats.lua
Outdated
local flags = {"default", "forced", "external", "dependent", | ||
"hearing-impaired", "visual-impaired", "image", "albumart"} | ||
local flags = {"default", "forced", "dependent", "visual-impaired", | ||
"hearing-impaired", "albumart", "external"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still leave image flag here, even if redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restored.
I know, I wrote that paragraph. ;) I indeed explicitly programmed |
player/lua/select.lua
Outdated
@@ -79,15 +98,16 @@ local function format_track(track) | |||
and track["codec-profile"] .. " " or "") .. | |||
(track["demux-samplerate"] and track["demux-samplerate"] / 1000 .. | |||
" kHz " or "") .. | |||
(track.external and "external " or "") | |||
):sub(1, -2) .. ")" | |||
(track["hls-bitrate"] and track["hls-bitrate"] .. " kbps " or "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also demux-bitrate
if you want to use that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
Show the same flags in loadfile.c, select.lua and stats.lua. The only differences are that only stats.lua prints both image and albumart because it's supposed to show detailed track information, and select.lua prints the image flag because pressing g-v doesn't show Video or Image like in loadfile.c and stats.lua.
player/loadfile.c
Outdated
if (s && s->hls_bitrate > 0) | ||
APPEND(b, " %d kbps", (s->hls_bitrate + 500) / 1000); | ||
if (s && s->codec->bitrate) | ||
APPEND(b, " %d KiBps", s->codec->bitrate / 8 / 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1024, but see other comments first.
@@ -0,0 +1,2 @@ | |||
remove deprecated `packet-video-bitrate` `packet-audio-bitrate` and | |||
`packet-sub-bitrate` properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No line breaks. The lines are wrapped automatically by the generation scripts.
player/command.c
Outdated
} else { | ||
*(char **)arg = talloc_asprintf(NULL, "%.3f Mbps", rate / 1000.0); | ||
*(char **)arg = talloc_asprintf(NULL, "%.3f MiBps", rate / 1024); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be changed. Are there any software or websites even using these units?
player/command.c
Outdated
} else { | ||
*(char **)arg = talloc_asprintf(NULL, "%.3f Mbps", rate / 1000.0); | ||
*(char **)arg = talloc_asprintf(NULL, "%.3f MiBps", rate / 1024); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO KiB/s
looks less cursed than KiBps
.
But it also more common to use bits per second. So maybe we should stick to that, to avoid angry users coming at us. And kilobits per seconds, not kibibits.
I know I suggested using utils.format_bytes_humanized
, but it seems to do more harm than good. Unless we actually change there.
So to summary. I would use bits
, kb/s
, Mb/s
for bitrates. That would be compatible with common values that other software show.
EDIT:
We can add, to be used with bits values, like bitrate. And keep using the other one for cache size. Dunno.
function mp_utils.format_bits_humanized(b)
local d = {"bits", "kb", "Mb", "Gb", "Tb", "Pb"}
local i = 1
while b >= 1000 do
b = b / 1000
i = i + 1
end
return string.format("%0.2f %s", b, d[i] and d[i] or "*1000^" .. (i-1))
end
player/loadfile.c
Outdated
if (s && s->codec->bitrate) | ||
APPEND(b, " %d kbps", (s->codec->bitrate + 500) / 1000); | ||
if (s && s->hls_bitrate) | ||
APPEND(b, " %d kbps", (s->hls_bitrate + 500) / 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks confusing to have two bitrates printed without any indications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added "HLS" to hls-bitrate
only since it's the only that's totally inaccurate.
These have been deprecated for 9 years so it's fine to remove them. Using the replacement properties like video-bitrate in stats.lua will convert big enough bitrates to Mbps.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks strange to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, apart from HLS naming, looks odd.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what kind of unit is "HLS kbps"?
I get the idea to indicate where the bitrate came from but it looks weird and I don't think users really care.
my suggestion is to print codec bitrate if available or else print hls bitrate, but without the extra "HLS"
(based on the assumption that codec bitrate is generally more accurate than hls bitrate)
Print demux-bitrate if available, else hls-bitrate, not both (as demux-bitrate is generally more reliable). This avoids printing "HLS kbps" which looks weird. Fixes mpv-player#14453 (comment)
Print demux-bitrate if available, else hls-bitrate, not both (as demux-bitrate is generally more reliable). This avoids printing "HLS kbps" which looks weird. Fixes #14453 (comment)
Print "Image" instead of "Video" for video tracks. This fixes #8561.
Print the hls-bitrate in select.lua.
Show the same flags in loadfile.c, select.lua and stats.lua. The only differences are that only stats.lua prints albumart because it's supposed to show detailed track information, and select.lua prints the image flag because pressing g-v doesn't show Video or Image like in loadfile.c and stats.lua.