FixTweet icon indicating copy to clipboard operation
FixTweet copied to clipboard

Twitter starting to serve HEVC video files

Open Cynosphere opened this issue 11 months ago • 13 comments

Example tweet, found in the wild: https://twitter.com/blephin_/status/1767231724621062406

Cynosphere avatar Mar 11 '24 17:03 Cynosphere

Pushed a hotfix to exclude HEVC versions of media where possible. This still breaks https://twitter.com/blephin_/status/1767231724621062406 because it only is encoded in HEVC (which also means it doesn't work in Firefox at all)

But this will fix posts like https://twitter.com/denfaminicogame/status/1767329323206525435 where a lower quality h264 version is available

dangeredwolf avatar Mar 12 '24 00:03 dangeredwolf

Pushed a hotfix to exclude HEVC versions of media where possible. This still breaks https://twitter.com/blephin_/status/1767231724621062406 because it only is encoded in HEVC (which also means it doesn't work in Firefox at all)

There is still an avc1 fallback, the issue there is that for some reason Twitter isn't including it in the m3u8 for the amplify_video type uploads.

(These are the results I get for that specific Tweet)

So instead, when requesting the TweetDetail of a post, need to enumerate the variants and grab the mp4 entry that has avc1, instead of grabbing the m3u8

Edit: Ah it seems you already do enumerate the variants, having looked at the code now. So yeah just need to also ignore the m3u8 as well, but only if there is an AVC1 variant listed....

Invertex avatar Mar 12 '24 00:03 Invertex

I appear to have implemented the fix improperly, stand by

dangeredwolf avatar Mar 12 '24 00:03 dangeredwolf

Okay I pushed a better fix that filters it properly, my previous fix was incomplete and broke with the formats in a different order, oops

dangeredwolf avatar Mar 12 '24 01:03 dangeredwolf

I'm getting a lot of videos where the embed doesn't work on the iOS app, is this the reason?

ThibaultVlacich avatar Mar 18 '24 17:03 ThibaultVlacich

I'm not sure if this is the exact same problem, but I'm encountering a video embed problem with Telegram.

The tweet in question: https://x.com/Dansgaming/status/1771528971722564063?s=20

When linked via fxtwitter the video don't embed correctly and instead just shows up as a photo. And when using a bot to embed the video, telegram's API errors out claiming the video supplied by FXTwitter is not a video file, or at least not a valid MP4.

The video that fxtwitter supplies: https://video.twimg.com/ext_tw_video/1771528865896185857/pu/vid/avc1/1920x1080/b1RrTEUFcdjXd2mu.mp4?tag=14

No idea if this is HEVC somehow leaking out or what's going on.

Clawthorn avatar Mar 24 '24 06:03 Clawthorn

Telegram supports transcoding HEVC videos, might be 20 MB limit? I'll look at that tomorrow it's getting late here haha

dangeredwolf avatar Mar 24 '24 07:03 dangeredwolf

I’m having an issue where the embed links don’t play for some reason, here’s a screen recording of it https://github.com/FixTweet/FxTwitter/assets/36827792/32269173-e1f2-415c-8b2b-929d3645f2fa

kevosmin avatar Apr 02 '24 22:04 kevosmin

I'm blaming Discord mobile being the buggy mess that it is, as it plays on desktop just fine.

Cynosphere avatar Apr 02 '24 22:04 Cynosphere

I'm blaming Discord mobile being the buggy mess that it is, as it plays on desktop just fine.

In my experience it doesn't play properly on Desktop (Windows) also. Often when video doesn't work on Mobile, on Desktop it'll play, but impossible to seek into the video. If you click somewhere along the progress bar, the video restarts from 0.

ThibaultVlacich avatar Apr 23 '24 07:04 ThibaultVlacich

but impossible to seek into the video. If you click somewhere along the progress bar, the video restarts from 0.

If I remember correctly, this is caused by the lack of a specific HTTP header or something of the sort, I don't think it has to do at all with the format of the video.

Cynosphere avatar Apr 23 '24 21:04 Cynosphere

but impossible to seek into the video. If you click somewhere along the progress bar, the video restarts from 0.

If I remember correctly, this is caused by the lack of a specific HTTP header or something of the sort, I don't think it has to do at all with the format of the video.

Discord calculates it based on the metadata length of the file. If the metadata length is incorrect, the seek bar will have weird behavior.

dangeredwolf avatar Apr 24 '24 17:04 dangeredwolf

FYI Discord started supporting HEVC videos as of yesterday (?), so if Twitter starts serving HEVC videos again (and also for videos from that timeframe, such as this one) the workaround is no longer necessary.

EDIT: just learned that they aren't playing properly on the Windows desktop client yet (despite playing fine on web, mobile and Mac desktop client), only the audio plays. It's probably some minor Electron issue and should hopefully be fixed by Discord soon.

EDIT2: they fixed the Windows Desktop client, HEVC videos play fine in all platforms now.

Delphox avatar Jun 17 '24 18:06 Delphox