[Regression] Bring back original video quality option, handle attributes correctly#30393
Conversation
34f96b9 to
305af70
Compare
305af70 to
d2696d6
Compare
d2696d6 to
a0026be
Compare
501968b to
14dab6f
Compare
| } | ||
| const auto overrideDuration = _stories | ||
| || (_chosenQuality && _chosenQuality != _document); | ||
| const auto durationDocument = (_chosenQuality && _chosenQuality != _document) |
There was a problem hiding this comment.
_chosenQuality != _document)
Does it really make sense?
There was a problem hiding this comment.
This is necessary. We do not want to rely on the provided duration attribute, which might be fake.
See: https://t.me/cursedvideofiles/7
If you open the 720p or 480p stream in 6.6.2, you'll end up with
- fake duration
- video player dimensions change according to fake w, h attributes
a2e44ea to
9621d03
Compare
|
Made the player more resistant against incorrect width, height, duration attributes. Unfortunately, fake w, h are common.
Put some edge cases the current player doesn't account for in https://t.me/cursedvideofiles Should fix #30407 |
9621d03 to
899ded0
Compare
899ded0 to
580eb8b
Compare
| // Propagate physical resolution parsed from the stream | ||
| to.realSize = from.realSize; |
There was a problem hiding this comment.
Physical as in the stream resolution as reported by ffmpeg, as opposed to size which is adjusted for SAR.
I can rename it to smth like "encoded resolution" if that makes more sense?
580eb8b to
6153758
Compare
|
I tested this PR, and the results are excellent. Previously, the system would generate an AV1-encoded video, which caused the video playback to freeze; now, it utilizes the original video (H.264), thereby preventing the freezing issue. |
|
I'll rewrite it, but thanks. |
|
ah. now conflicts , sorry @comdev1337, fix please |
6153758 to
32532a8
Compare
|
@john-preston fixed |
This may still be an issue if you select a transcoded stream. I believe the client prioritizes fetching av01 over h264 for these. |
Yes, now I just need to select the original video. It would be helpful to improve the video quality selection button by displaying the video's encoding format and file size; this would make debugging much easier. This is how it works on Telegram for Android. |
The Android client doesn't display the codec, from what I can see |

Fixes #29780
Fixes #30407
Fixes: a bug (?) where the video quality text (SD/HD/4K) is not displayed on the gear button if a video has no
alt_documents(only speed options are available in the dropdown).Summary
This PR aims to help the minor subset of users with a functioning eyesight by restoring the original video quality option in the media player. The original stream is included as the second option (consistent with the ordering in the Android client).
Example video. Observe: wheels turn into slop when 1080p is selected.
tg_original_quality_h264.mp4
Example video. Handling wrong attributes correctly. We now have a 1080p stream!
tg_original_wh_fix.mp4
Implementation
Media::kVideoQualityOriginalOffset). This eliminates resolution ambiguity between an original 1080p stream and a sloppy 1080p.chooseQuality()where selecting the transcoded 1080p option selects the original 1080p, if the transcoded stream size is over the original file size, due toif (abs == closestAbs && quality->size < closestSize)realsize), do not rely on attributes whenever possible.Tried throwing a bunch of different videos at it. Works on my machine.