FixTweet / FxTwitter

Fix broken Twitter/X embeds! Use multiple images, videos, polls, translations and more on Discord, Telegram and others
https://fxtwitter.com
MIT License
2.47k stars 70 forks source link

No sound with Embed Videos #526

Open kevosmin opened 9 months ago

kevosmin commented 9 months ago

The sound for embed videos on discord are not working for some reason

JoshAtticus commented 9 months ago

Same issue here, trying to make a discord bot that sends cat videos from Twitter but there’s no sound

Scrxtchy commented 9 months ago

https://github.com/wukko/cobalt/issues/172

dangeredwolf commented 9 months ago

Oh interesting, thanks for that insight @Scrxtchy. Not sure what we should do about it from our end o.O

BryceRoe03 commented 9 months ago

I'm having this same issue too. None of my embeds have audio anymore on iOS :( It works on my PC (Windows) but not my phone

dangeredwolf commented 9 months ago

We could start remuxing all videos and it shouldn't be too bad, but I have concern for how much Cloudflare is going to bitch about us streaming video using their Free plan.

dangeredwolf commented 9 months ago

Can I have more examples of videos where the issue occurs? I'm trying to pinpoint what ranges of tweets might be affected by this encoding issue. It seems older tweets are fine and the newer tweets I tested worked for me too.

This one is one example that has broken audio on mobile: https://twitter.com/SwiftOnSecurity/status/1689086007721725952

BryceRoe03 commented 9 months ago

Can I have more examples of videos where the issue occurs? I'm trying to pinpoint what ranges of tweets might be affected by this encoding issue. It seems older tweets are fine and the newer tweets I tested worked for me too.

This one is one example that has broken audio on mobile: https://twitter.com/SwiftOnSecurity/status/1689086007721725952

I have a ton of examples, including tweets that were posted today that still don't have audio on my iPhone.

This is one from yesterday: https://twitter.com/smj0fficial/status/1733658754258772172?s=46&t=w1a-MDlScLerW2Ug9MRm7Q

I've been using vxtwitter to get embeds but I also tried this Twitter Video Embeds#4945 bot as well and still got no audio. I get it on my windows laptop but not my phone.

kevosmin commented 9 months ago

Can I have more examples of videos where the issue occurs? I'm trying to pinpoint what ranges of tweets might be affected by this encoding issue. It seems older tweets are fine and the newer tweets I tested worked for me too.

This one is one example that has broken audio on mobile: https://twitter.com/SwiftOnSecurity/status/1689086007721725952

Here’s my example: https://x.com/themetameister/status/1731802273255145896?s=46

dangeredwolf commented 9 months ago

Got it, so Twitter is probably still messing up the video containers given how much more recent that one is.

8times4 commented 9 months ago

Just FYI.

BHTwitter / BHX https://github.com/BandarHL/BHTwitter/commit/92ed4dc65af62f7bc3fa12b6cd024a4b326588f4#diff-d786d2b863a866921f25887df02cbbe1ebcc4f2695164063db5014b17592dfcf

Solved it by converting m3u8 to mp4, then downloading it, which is fuckery in itself but it works. However that's not really possible via Workers afaik, probably due to their size constraints.

AlttiRi commented 9 months ago

converting m3u8 to mp4

It's almost the same thing as remuxing (repacking from mp4 to mp4).

In both cases you do create a new mp4 container.

ffmpeg.exe -i video.mp4 -c copy -map 0 -map_metadata 0 video.remux.mp4

(https://github.com/AlttiRi/twitter-click-and-save/issues/37#issuecomment-1850997495)


There is the audio stream in the mp4 file, but the problem is that the mp4 container created by Twitter's muxer is "too special" (almost corrupted) that results in issues on Apple devices and in VLC player. While it can work fine in other video players.


BTW, it seems that the video stream in m3u8 is the same as in mp4, just splitted to parts. Both videos (Twitter's mp4 file and m3u8 playlist downloaded with yt-dlp) are pixel identical.

8times4 commented 8 months ago

just FYI, this seems to be fixed on Twitter's end.

AlttiRi commented 8 months ago

Confirm.

While they still use Twitter-vork muxer (x264 core 164 r3095 baee400 library), videos uploaded after ~"UTC 2023-12-14 22:00:00" have a fixed mp4 container.

MediaInfo shows that the main change is changing of "Codec ID" from iso5 (iso6/mp41) to isom (isom/iso4). As well as, adding Maximum bit rate metadata.

Also, videos have Encoded date metadata again. That's good, since it's the most useful metadata (a tweet creation time).

Videos uploaded before December* were encoded in mp42 (mp42/mp41/iso4) with Vireo Eyes v2.9.1 (x264 core 161 library).

Also, I note they used Twitter-vork muxer (x264 core 164 r3095 baee400 library) before December too (since February 2022), but only for GIFs (tiny mp4 without sound).


* November 30th (~"UTC 2023-11-30 15:00:00")

dangeredwolf commented 8 months ago

I've noticed another issue (possibly related?) on Discord where the video can't be scrubbed around, only played from the beginning. Example where this happens: https://fxtwitter.com/FangSladeDrum/status/1739260321926459454

It also prevents Discord mobile from playing it at all for me, sound or not.

This is what ffprobe says about the file.... It shows it's isom like what @AlttiRi described but some of the other things seem different about this one

image