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

Twitter starting to serve HEVC video files #711

Open
Cynosphere opened this issue Mar 11, 2024 · 13 comments
Open

Twitter starting to serve HEVC video files #711

Cynosphere opened this issue Mar 11, 2024 · 13 comments
Assignees
Labels
Discord Issue pertains specifically to embedding in Discord embeds This issue affects embeds on one or more platforms

Comments

@Cynosphere
Copy link

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

@dangeredwolf
Copy link
Member

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 dangeredwolf self-assigned this Mar 12, 2024
@dangeredwolf dangeredwolf added Discord Issue pertains specifically to embedding in Discord embeds This issue affects embeds on one or more platforms labels Mar 12, 2024
dangeredwolf added a commit that referenced this issue Mar 12, 2024
@Invertex
Copy link

Invertex commented Mar 12, 2024

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....

@dangeredwolf
Copy link
Member

I appear to have implemented the fix improperly, stand by

@dangeredwolf
Copy link
Member

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

@ThibaultVlacich
Copy link

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

@Clawthorn
Copy link

Clawthorn commented Mar 24, 2024

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.

@dangeredwolf
Copy link
Member

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

@kevosmin
Copy link

kevosmin commented Apr 2, 2024

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

@Cynosphere
Copy link
Author

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

@ThibaultVlacich
Copy link

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.

@Cynosphere
Copy link
Author

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.

@dangeredwolf
Copy link
Member

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.

@Delphox
Copy link

Delphox commented Jun 17, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discord Issue pertains specifically to embedding in Discord embeds This issue affects embeds on one or more platforms
Projects
None yet
Development

No branches or pull requests

7 participants