Skip to content
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

Question about the future; HEVC/AV1 #220

Open
CristianGrecu opened this issue Jul 31, 2024 · 104 comments
Open

Question about the future; HEVC/AV1 #220

CristianGrecu opened this issue Jul 31, 2024 · 104 comments

Comments

@CristianGrecu
Copy link

CristianGrecu commented Jul 31, 2024

Hi, as you may know, more and more streamers are testing 4k HEVC streams. Rumors point to additional announcements around Twitchcon US.

I know you've said you don't really want to add support for AV1 since not many devices are capable of hardware decoding. It seems that short term this HEVC codec will be available for everyone to use. Is it even possible to integrate it in this app?

I'm just thinking that most TVs nowdays are 4k so it would be a massive improvement. Leaving resolution aside, I think the other incredible thing is that the bitrate behaves differently, so when a lot of stuff happens on stream, it doesn't become a blurry mess anymore.

We all know that Twitch's official app will be horrible, so if more and more streamers start using 4k HEVC permanently, a regular Desktop PC migh be mandatory for watching on a TV.

Thank you!!

@fgl27
Copy link
Owner

fgl27 commented Jul 31, 2024

Is possible, but you need a av1 ready device.

The app will continue to show avc streams as is the only supported by all devices.

The avc will continue to be used even if the stream is av1, so content will just work

The day this is a real feature I can add a way to detect supported devices.

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 1, 2024

AV1 is probably more of a 2025 thing, but what about this HEVC that everyone is testing? If now we are using H.264 and they are testing H.265, shouldn't most devices support it since it's some sort of avc+? I assume that the transcoding is still mostly done by twitch unlike AV1 which makes the users handle most of it.

Also, I thought when a device can't hardware decode it just falls back to software decoding if the CPU is decent. My Sony TV shows AV1 when watching some Youtube 4k videos, but I don't think it has dedicated hardware.

I'm going to be honest, I even love using this app on a tablet, even if it doesn't have regular touch controls.I don't even want to think about using the official apps, mobile or otherwise, they're horrible. I really hope we won't be left behind with 1080p when even really old smart TVs can handle Youtube 4k (which I think is usually VP9).

Thanks for answering and sorry if I got anything wrong, I'm not a developer.

@fgl27
Copy link
Owner

fgl27 commented Aug 1, 2024

Is all the same and part of the same beta program.

If the device support you will be able to use it.

You can't on most tv devices use sw decoder due to the low performance.

You can test it today in the app you can disable the hw decoder and try it

Most devices struggle with h264 SW decoding so anything more complex is not a option for high resolution, anything over 640p is high.

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 1, 2024

I see, thank you! I guess we'll have to wait and see what happens when they enable it for everybody. Right now they don't even save VODs/clips from these tests, so everything is gone.

When I was watching on a PC, the bitrate was still low, seemed to be 10-12 mbps, but 4K. Codec was showing HEVC and it looked really nice.

Just one more question cause I don't want to open another thread. I noticed that recently drops started to work perfectly. I am just finding random stuff to claim all the time. Will it ever be possible for this app to properly detect viewing time and collect channel points/receive gifted subs etc.?

Edit: Just a side note because I just checked. My TVs SoC which is a very modest Mediatek shows in the spec list: Decoding: HEVC 8k 60fps, H. 264 8k 30FPS. So I hope most low-mid range TVs will do alright.

@fgl27
Copy link
Owner

fgl27 commented Aug 1, 2024

On the av1 topic

There is a test hidden stream

If you search for videos "1440p120 av1" it shows. It will only play using avc 1080p on the app, but on twitch site it plays using av1.

https://www.twitch.tv/videos/637388605?t=18h36m31s

I enabled av1 and twitch only sends av1 links not av1 and avc, not a problem is just extra request that will be needed to show it all.

On the 2017 shield it can't play av1 it gets codec errors.

There is a lot of devices like this

If anyone find a h.265 test vod share the link so I can try it.

@fgl27
Copy link
Owner

fgl27 commented Aug 1, 2024

Channel points probably not unless twitch changes things today isn't allowed.

Gifts works, as it is given for those logged in the chat, as long you are setup with yours user and chat logging is enabled must work.

I received a gift once and I only use this app for twitch so it must works for others.

The app can send a on screen warning if you get one.

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 1, 2024

My bad, I used the wrong wording. Getting a gift if you are targeted works, but you don't get random gifts as a loyalty reward. Back when I was watching from a PS4 in 2021 I used to have like 12 subs for free every month just because the system was seeing me as loyal to some streams. So I would have some sort of priority vs people that watch for a couple of minutes and leave. Nowdays 0 random gifts because it's as if I'm not even there.

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 1, 2024

I don't think there are any VODs for HEVC. Can you do anything so we can test the next time someone is live? Like a hidden setting or something?

Oh btw, only the 4K feed was HEVC, the rest were standard avc. Which is another problem in my opinion. I remember when twitch allowed 1440p streams and it would only be 1440p and then straight to 720. It's possible that in the future avc will only get 720p and the rest will be new codecs.

I still can't believe how well Youtube works and barely anyone streams there. I tested a VP9 1440p stream and it was flawless.

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 1, 2024

I think I found one. I'm not at the PC right now to check but live I am 100% sure it was 4k HEVC.

https://www.twitch.tv/burkeblack/v/2211849267?sr=a&t=0s

@fgl27
Copy link
Owner

fgl27 commented Aug 1, 2024

My bad, I used the wrong wording. Getting a gift if you are targeted works, but you don't get random gifts as a loyalty reward. Back when I was watching from a PS4 in 2021 I used to have like 12 subs for free every month just because the system was seeing me as loyal to some streams. So I would have some sort of priority vs people that watch for a couple of minutes and leave. Nowdays 0 random gifts because it's as if I'm not even there.

I never used an official app, so I'm not aware of all things.

I assume this is also forbidden, as is similar and attached to the same way points are calculated.

Not that is forbidden for say forbidden, is just that isn't allowed an app that will generate points or anything related, as one can use that just to span and get things they don't deserve.

An app using such implementation can be easily banned no questions asked of how and why it does.

The "points" are more than just opening the stream, there are several API requests that need to be made to receive it, I assume the sub and anything related are the same.

If someday that changes we can revise it.

@fgl27
Copy link
Owner

fgl27 commented Aug 1, 2024

I think I found one. I'm not at the PC right now to check but live I am 100% sure it was 4k HEVC.

https://www.twitch.tv/burkeblack/v/2211849267?sr=a&t=0s

On the av1 topic

There is a test hidden stream

If you search for videos "1440p120 av1" it shows. It will only play using avc 1080p on the app, but on twitch site it plays using av1.

https://www.twitch.tv/videos/637388605?t=18h36m31s

I will use this two VODs to setup something once all is done I share it with you.

thanks!

@CristianGrecu
Copy link
Author

Thank you!!

@fgl27
Copy link
Owner

fgl27 commented Aug 1, 2024

I have updated the app to better support those vods, they played just fine but not the best quality out of the box.

in this test apk they do.

app-debug.zip

install this after extract, this is a testing app it will add a second SmartTwitchTV with a yellow icon.

this app shares no context with the Play Store one you must setup add users etc.

If any issue let me know.

If you see any stream playing AV1 or HEVC let me know here.

Once I improve this version I release it.

@fgl27
Copy link
Owner

fgl27 commented Aug 1, 2024

I have added this to the settings, technically needs to be set to yes to make it work

image

For those two testing VOD it does nothing, disable will not fall back to avc, I assume that isn't ready yet on the Twitch side.

Also, no guarantee enabling will make it work even if the streamer is using the codecs.

The day we find some live using those codecs we can better test.

@CristianGrecu
Copy link
Author

I know for a fact that Maximilian_dood has been doing test streams for HEVC 4k and he usually has Twitch staff present. I'll keep an eye out. Other streamers mentioned they want to use 1440p 60 permanently in the future.

Honestly I don't think anyone is testing AV1 publicly so that might have to wait.

And thanks again for all the work.

@CristianGrecu
Copy link
Author

That test app seems to work perfectly honestly. I'll test some more on the tv tomorrow because it's getting late. Live will be the true test though.

@fgl27
Copy link
Owner

fgl27 commented Aug 2, 2024

I have made an updated version

app-debug.zip

will test this for a few days, test let me know the result.

extra codec and Codec capability & Blocked codecs are improved

the app allows to control the codec and let the user know if one is available

image

image

The final version will have a proper text on above settings, that is just for testing the functionality that isn't affected by the text

@fgl27
Copy link
Owner

fgl27 commented Aug 2, 2024

This is the final or almost final version, improve some text and quality selection

app-debug.zip

Test this one and let me know

BTW this streamer has HEVC VODs, maybe they do some live in the future for testing

r0dn3y

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 2, 2024

I've done some testing. Here's what I found:

I tried a 4k60 HEVC vod, a 1440p60 Elden Ring vod and that AV1.

On the 60hz Sony TV with a gigabit usb network adapter :

4k60 HEVC: seems to work perfectly, 0 skipped frames
1440p60 HEVC: same as above.
AV1: completely broken, blurry and it seems to be on fast forward. After a while graphical artifacts appean on 50% of the screen.

On a 144hz Snapdragon 870 tablet:

4k60 HEVC: almost perfect, like 1 skipped frame. This tablet has a 3k screen I think, so really good overall.
1440p60 HEVC: perfect, no skipped frames, really crisp image.
AV1: no graphical artifacts, still broken. Blurry image and seems to be on fast forward even though the tablet is 144hz.

Honestly, I wouldn't bother with AV1 until they do public tests, because 120 FPS is too much for normal use anyway.

@fgl27
Copy link
Owner

fgl27 commented Aug 2, 2024

Av1 is device issue most devices can't play av1
I have a phone with a 888 snapdragon plays fine but no audio.

Besides that av, hevc is working great

Will test for a few days then release it

@CristianGrecu
Copy link
Author

But don't you think the 120 fps is the main issue? Because my TV runs 4k60 on youtube using AV1 without a problem.

@fgl27
Copy link
Owner

fgl27 commented Aug 2, 2024

You can check the codec capability in settings to know what the tv can and can not

Just because is av1 doesn't mean it's the same thing

There several ways to encode that one stream isn't the standard.

@CristianGrecu
Copy link
Author

We'll have to see when they start testing 60 fps AV1. That VOD is also quite old so who knows what changed.

It's very nice that HEVC works well, so thank you again. I'll keep looking for a live test but it should be fine.

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 2, 2024

Btw, unrelated, but have you considered adding an auto catch-up function? Sometimes when Twitch is having a bad day I have to manually get it back to live with the remote (shrinking the red bar as much as possible to the right) to reduce the delay as much as I can. It would be nice if let's say every 30 mins - 1 hour the stream would auto catch-up to live.

@fgl27
Copy link
Owner

fgl27 commented Aug 2, 2024

there is a player setting that is disabled by default that does that, isn't exported to the user, I'll see to make it configurable

@CristianGrecu
Copy link
Author

Ok, thank you!!

@fgl27
Copy link
Owner

fgl27 commented Aug 2, 2024

I enabled the feature to keep the stream position even after buffers and related

app-debug.zip

It works automatically, there is no need to enable another setting, enable low latency on the player and it will do the work.

Normal is around 3 to 4 seconds
Lowest 2 to 3
Disabled 14

It isn't possible to go lower as Twitch streams are segmented in 2s, anything lower will cause rebuffers

image

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 2, 2024

It's usually not a problem, I only mentioned it because yesterday I was having issues with literally 3 streams (out of like 50). In the right corner where it says net speed I usually see 200-300 and the same average. Sometimes just a few streams show 15-20 net speed even if the average is still 200. It is very strange but I think it's Twitch 's fault. Even now Kyedae' s stream does the same: net speed shows 17 and average 200 which means the stream is on the edge of buffering all the time. You can check it if you want, but it's probably an Eu problem.

Also, a stream that was doing it yesterday fixed itself today. I really don't get it.

@fgl27
Copy link
Owner

fgl27 commented Aug 2, 2024

OK, but that feature is good, I disabled it in the past because was causing issues as it didn't allow configurations but now is working as expected.

So at the start or after a buffer, the player will always try to correct and find the target position.

@CristianGrecu
Copy link
Author

Yes, of course, I meant I didn't want to bother you with more things!

@CristianGrecu
Copy link
Author

I think it's working for the good streams, you're saying it should work even if it buffered a lot? I found some streams with the progress white dot almost in the middle and a bunch of red to the right.

I have the latest version with everything enabled.

@fgl27
Copy link
Owner

fgl27 commented Aug 6, 2024

if you have not change using the progress bar yes

but if you use the progress bar no it stops as it assumes you have a new manual position

so have you use the progress bar to change the position?

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 6, 2024

You know what, I think so, I've been doing it a lot. The second I see a buffer It annoys me and I drag the bar to the right. I'll leave it alone, sorry.

@fgl27
Copy link
Owner

fgl27 commented Aug 6, 2024

OK expect frustration not a problem

Try and let me know

That progress bar feature is to prevent a very normal use case that you may wanna to rewind but the player keeps pushing it forward

Today there is no logic to disable it.

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 6, 2024

I usually use it to lower the delay, very rarely to rewind. But I'll let it do what it's supposed to. Thanks.

Btw when there were audio issues you said you slowed it down. If you want to add a faster catch up in the settings, I'm happy to test it, maybe it can be pushed a bit further.

@fgl27
Copy link
Owner

fgl27 commented Aug 7, 2024

I push this changes to the play store app, you can use that one for now

any improve we do on a future update

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 7, 2024

Sure, thank you. Also all of the streams seem to be good today, no more low net speed.

I don't know if it has anything to do with the ticket that I've opened. Didn't even get an answer. Oh well.

Also, you can close this I think, it's getting too long. I literally made an account for this app so I don't know If I should close it or not lol.

@fgl27
Copy link
Owner

fgl27 commented Aug 7, 2024

great, I assume not related, is just server load, if after some time too many users start watching the server will load and cause the issue.

but may not 🤞

@CristianGrecu
Copy link
Author

Ok, I'm not going to close the issue, it's up to you!

Thank you for everything.

@fgl27
Copy link
Owner

fgl27 commented Aug 8, 2024

OK, update with Twitch reply if they do, then we can close this.

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 8, 2024

Absolutely no reply and streams have been working perfectly.

It's up to you, but because I was having the same issues on PC, it has nothing to do with this app.

Actually this app was just better as a tool to diagnose because Chrome info is incomplete.

@CristianGrecu
Copy link
Author

I spoke too soon. The net speed is really high on all streams, no skipped frames, but streams still load with a higher delay. Also they seem to gain delay over time with 0 buffering.

Last night it wasn't doing this, definitely a different problem. It's like something is wrong with the low latency mode.

I guess it's still Twitch, butI don't have time to check right now.

@CristianGrecu
Copy link
Author

It had been working well. Also thank you for the new interface changes. My tv shows AV1 hardware encoder enabled, max 4k 66 fps. That would explain why that vod was completely broken, the 120 fps was too much. Also shows a hardware encoder for HEVC 4k 129 fps.

We'll see when live tests actually start.

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 9, 2024

SVID_20240809_205728_1.mp4

And a bonus, here's that av1 test running perfectly on a Snapdragon 8 Gen2. Problem is, there's still 0 audio, so maybe you'll be able to fix that in the future.

@fgl27
Copy link
Owner

fgl27 commented Aug 14, 2024

I don't think that vod has audio at all, none of my devices reproduce it even on a computer.

Do you have a computer that has audio?

@CristianGrecu
Copy link
Author

CristianGrecu commented Aug 14, 2024

Yes, you are absolutely right, there's no sound. I was mostly testing the app, it's been months since I last checked it on PC.

@CristianGrecu
Copy link
Author

CristianGrecu commented Sep 20, 2024

In case you haven't watched the opening ceremony for TwitchCon, they have officially announced HEVC for early 2025.

The stream was 1440p60 and it worked perfectly on my TV, but I do have a question. I know you don't officially support mobile devices but the stream refused to play on my tablet. It said player error 4003, which I think has something to do with the web socket.

So, I checked and that Elden Ring 1440p HEVC VOD works perfectly while this TwitchCon VOD says the same thing as the live, error 4003. Very strange that it only happens on the tablet.

It's not a big deal, hopefully it will work fine on most devices, there's plenty of time until 2025.

@fgl27
Copy link
Owner

fgl27 commented Sep 20, 2024

4003 is Caused by a failure while trying to decode media samples

https://github.com/androidx/media/blob/c35a9d62baec57118ea898e271ac66819399649b/libraries/common/src/main/java/androidx/media3/common/PlaybackException.java#L267

device for some reason can't decode that.

@CristianGrecu
Copy link
Author

CristianGrecu commented Sep 20, 2024

But that can't be right. It says in the settings I have a HEVC hardware decoder for 4k 240fps and 8k 60fps so plenty of room for 1440p 60.

Also Maximilian_dood's vod for Elden ring works perfectly, both say HEVC in the top right corner. Are there multiple versions of HEVC?

If you want to try it yourself, it's the latest VOD on twitch.tv/twitch. I'll do some more testing tomorrow on an Amazon stick etc.

@CristianGrecu
Copy link
Author

OK so I checked on PC, both vods are exactly the same HEVC version, same backend version as well. It's so weird that one works and one doesn't.

@CristianGrecu
Copy link
Author

CristianGrecu commented Sep 20, 2024

Yeah, the official Twitch mobile app allows me to select 1440p and that's also broken, I get stutters and only sound.

I think there's something wrong with this particular stream. I'm sorry that I bothered you.

@CristianGrecu
Copy link
Author

CristianGrecu commented Sep 21, 2024

Just one more question if you don't mind. I found a really old Xiaomi MI A1 from 2017 that I still had and decided to give it a try. This vod from last night worked perfectly with 1440p HEVC and this phone is super weak with a snapdragon 625 so this codec runs on anything.

You know the android ecosystem pretty well. Do you have any idea why the same tablet that plays the 4K vod would be the only device I have doing this? It has a Snapdragon 870.

If not I'll just have to see if I can find another live HEVC later. It's just that it's so strange that I want to know why out of curiosity at this point.

Thanks!

@fgl27
Copy link
Owner

fgl27 commented Sep 21, 2024

Seems to be a QCOM issue my 888 device has the same problem.

Even the codec saying it's the same in the site must have a diff on a computer is possible to check

Next time I'm on the computer I check

As most Android devices today are QCOM there is probably a lot of people with the same issue, unfortunately Twitch isn't the company that cares, they probably didn't even test this codec.

@CristianGrecu
Copy link
Author

CristianGrecu commented Sep 21, 2024

Sure, but the thing is, the 1440p Elden Ring vod has the exact same codec number as the vod from yesterday. I checked every digit.

That Elden Ring one and the 4K one that I linked you with Fallout London both work on this tablet.

Here's my guess why. I might be wrong, but I don't think those hevc tests were included in the mobile app. Last night they probably did the first hevc test in the official app as well as desktop, which would explain why it's so broken.

Also, one more strange thing. I can get the stream to start, but with the software codec which is max 30fps, so of course the stream drops half the frames. On a device that has hardware to do 8k 60. Classic Twitch.

And regarding what you said, it's not just a qualcomm issue. I got the stream to run on 2 snapdragon devices, and more importantly, I tried it on a cheaper tablet with a Helio G99 and it does the exact same thing. And this app tells me that the G99 can do 1440p 145fps max.

I would've guessed that they flagged tablets specifically somehow, but if your 888 device is a phone, I have no idea.

@CristianGrecu
Copy link
Author

CristianGrecu commented Sep 22, 2024

I was wrong, I found another 1440p hevc stream, this time IRL (EsfandTV). This one works perfectly everywhere. It's even in the mobile app. So that Twitch one was probably an exception and not the rule.

@fgl27
Copy link
Owner

fgl27 commented Sep 22, 2024

OK next time I'm in a computer I use those two as examples to see what the diff is.

@fgl27
Copy link
Owner

fgl27 commented Sep 23, 2024

EsfandTV media info

{CAB6FF8B-6B55-4194-9D56-B295FDC75ECC}

Twitch

{5A2C9D2B-A299-4B4A-9689-E6D194908F08}

@fgl27
Copy link
Owner

fgl27 commented Sep 23, 2024

It doesn't seem to have any diff between the streams other than Twitch has subtitles.

I don't know if that breaks it, when I have more time will see if there is anything that can be done from the app side to finger this out.

@CristianGrecu
Copy link
Author

CristianGrecu commented Sep 23, 2024

Yep, good news is that it was stuttering badly in the official mobile app too (no error code) , so a lot of people will report it.

Also, if you update the app in future will you enable hevc by default? Because I don't think most people look through the settings etc. But maybe after you know if the problem is fixed because in my case I had to manually disable it to go back to avc.

Otherwise I guess most people will miss those 1440p streams unless it says so in the stream title.

@fgl27
Copy link
Owner

fgl27 commented Oct 1, 2024

Once I have time to address the error codes issues I'll change the codec to default enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants