TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Twitter's GIF hack

280 pointsby kwntmalmost 11 years ago

33 comments

arsalmost 11 years ago
This is not true:<p>&quot;A GIF is literally a sequence of independent images squeezed into the same file. An mp4 video can take advantage of all kinds of fancy compression techniques like keyframes and forward-predictive frames.&quot;<p>That&#x27;s not why the mp4 is smaller. A GIF is not [just] independent images, you can have each frame reuse pixels from previous frames.<p>The mp4 is smaller because lossy jpeg compression is used on each frame, while the gif stores each frames losslessly.<p>This has implications from the predictive frames as well - the jpeg is lossy, so two almost similar parts of the images can be considered &quot;the same&quot;, while the gif is not, so they must be identical in order to compress that way, and the realities of video noise makes that unlikely.
评论 #7917593 未加载
评论 #7918720 未加载
评论 #7917591 未加载
评论 #7918578 未加载
评论 #7917585 未加载
评论 #7919561 未加载
Rudismalmost 11 years ago
Correct me if I&#x27;m wrong, but wasn&#x27;t the whole reason gifs started proliferating on the net because people wanted to share short video loops, but didn&#x27;t want to embed flash or video which may not load or play correctly in a user&#x27;s browser? And now we are championing the conversion of those gifs back into video? Seems like a strange round-about way of doing things.<p>I forsee a future where all video clips on the net have been converted back and forth between gif and video so often that they all slowly merge into a single amorphous blob of greyish-brown pixels. Actually, now that I think about it, that would almost certainly be an improvement over the current situation.
评论 #7918146 未加载
评论 #7918015 未加载
评论 #7918837 未加载
评论 #7918846 未加载
评论 #7918270 未加载
评论 #7918951 未加载
评论 #7918587 未加载
评论 #7918010 未加载
kudualmost 11 years ago
This article makes it sound like Twitter invented a whole new optimization, when they really just recycled a concept already in use by gfycat (<a href="http://www.gfycat.com/" rel="nofollow">http:&#x2F;&#x2F;www.gfycat.com&#x2F;</a>) and MediaCrush (<a href="https://mediacru.sh/" rel="nofollow">https:&#x2F;&#x2F;mediacru.sh&#x2F;</a>).
评论 #7917849 未加载
Permitalmost 11 years ago
I&#x27;m curious if anyone is noticed the flickering Loading icon when the .mp4 version loops? It only shows up for 50 ms, but seems kind of annoying. Or maybe it&#x27;s just my machine?<p>Here&#x27;s a cap: <a href="http://imgur.com/2R84ImD" rel="nofollow">http:&#x2F;&#x2F;imgur.com&#x2F;2R84ImD</a>
评论 #7918029 未加载
评论 #7918038 未加载
评论 #7917555 未加载
评论 #7917588 未加载
评论 #7919693 未加载
评论 #7918187 未加载
stonogoalmost 11 years ago
This is on a fully-patched RHEL6 workstation:<p><a href="http://i.imgur.com/NleqJTD.png" rel="nofollow">http:&#x2F;&#x2F;i.imgur.com&#x2F;NleqJTD.png</a><p>Another example of &quot;use bleeding-edge tech or go fuck yourself&quot; from the modern web.
评论 #7917441 未加载
评论 #7917490 未加载
评论 #7917448 未加载
评论 #7917476 未加载
评论 #7917564 未加载
评论 #7917517 未加载
评论 #7917606 未加载
评论 #7917892 未加载
评论 #7917581 未加载
评论 #7917481 未加载
Sir_Cmpwnalmost 11 years ago
I made a site that drove this innovation, MediaCrush. It&#x27;s open source.<p><a href="https://github.com/MediaCrush/MediaCrush" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;MediaCrush&#x2F;MediaCrush</a><p>if you want to try to do this yourself, our code is a good reference.<p><a href="https://mediacru.sh" rel="nofollow">https:&#x2F;&#x2F;mediacru.sh</a>
评论 #7918196 未加载
billmalarkyalmost 11 years ago
&quot;Videos allow Twitter to leverage the browser. This means play, pause, and seek, but also cool things like slow-motion. Think your GIF is funny now? Wait til you see it in slow motion.&quot;<p>Gifs have built in slow motion, it&#x27;s called waiting for the 10mb file to download frame by frame upon initial play-through.
protopetealmost 11 years ago
Unfortunately the MP4 looks worse than the GIF, due to chroma compression in the YUV 420 colorspace. While each pixels luminance value is kept, the color information for a 4-pixel square is stored as a single CrCb pair, which is really obvious when you look at how the orange hat has artifacts against the blue background. Increasing the bitrate won&#x27;t solve this either, since it&#x27;s a limitation of the colorspace.
评论 #7917782 未加载
评论 #7917716 未加载
评论 #7919718 未加载
评论 #7917544 未加载
rudogalmost 11 years ago
We&#x27;ve been doing that at my company on our mobile applications for a few years now. There is no reason to be shoving 5-10mb GIFs down a users throat on a mobile device. Not only does are MP4s smaller (file size), frames per second will be constant on all browsers, unlike GIF (although most browsers are supporting up to 50fps these days). Although outdated, you can read more about that here. <a href="http://nullsleep.tumblr.com/post/16524517190/animated-gif-minimum-frame-delay-browser-compatibility" rel="nofollow">http:&#x2F;&#x2F;nullsleep.tumblr.com&#x2F;post&#x2F;16524517190&#x2F;animated-gif-mi...</a><p>I wrote a simple js lib for detecting the duration of a GIF for each browser. It was a fun weekend project. <a href="https://github.com/rfrench/gify" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rfrench&#x2F;gify</a><p>If webp gains more adoption, it&#x27;s another alternative now that it supports animation.
bluedinoalmost 11 years ago
Haven&#x27;t things like gfyCat been doing HTML5 video from GIF&#x27;s for a while?
评论 #7917681 未加载
TazeTSchnitzelalmost 11 years ago
Much like what <a href="http://gfycat.com/" rel="nofollow">http:&#x2F;&#x2F;gfycat.com&#x2F;</a> do, then?<p>Interesting also that 4chan recently added looping, muted WebM videos for similar reasons.
gdullialmost 11 years ago
Is there a flash blocker solution that removes all traces of the page element rather than leave an ugly placeholder? It&#x27;s going to be annoying to see this on Twitter from now on.
eph_unitalmost 11 years ago
So, what is an easy way to convert gifs to mp4? How did they do this. I run a small gif-sharing site and should probably do this.
评论 #7917546 未加载
评论 #7917411 未加载
评论 #7917409 未加载
评论 #7917425 未加载
brickmortalmost 11 years ago
I think now would be a good time to introduce HTML5 videos to the feed, or gfycats. At least on certain browsers.
jstalinalmost 11 years ago
It&#x27;s annoying to an oldtimer, like me, that <i>animated</i> gifs have now simply become <i>gifs</i>.
ahassanalmost 11 years ago
This is why 4chan supports WebM videos now in addition to the traditional gifs.
supercoderalmost 11 years ago
Can I skip the GIF and have Twitter just play an MP4 I upload ?
pyrocatalmost 11 years ago
The twitter &quot;GIF&quot; is a black box. gg
cbralmost 11 years ago
Another option (for supporting browsers) is to use animated webp: <a href="https://developers.google.com/speed/webp/faq#why_should_i_use_animated_webp" rel="nofollow">https:&#x2F;&#x2F;developers.google.com&#x2F;speed&#x2F;webp&#x2F;faq#why_should_i_us...</a>
shmerlalmost 11 years ago
GIFs indeed are bad for video (quality, size, no control, no sound, etc.) but in order for that to be really true, the site must allow embedding videos using the video tag (i.e. videos which people upload in proper video formats). Does Twitter allow it?
lawlalmost 11 years ago
So. Who was first. 4chan or twitter?<p>How long has twitter been doing this? Just out of curiousity.<p>(Yes I know 4chan doesn&#x27;t convert but there was some talk that 4chan might be a major player in pushing webm forward. Is it even webm or x264? On mobile. Can&#x27;t check right now.)
评论 #7917601 未加载
评论 #7917980 未加载
megablastalmost 11 years ago
This is what I see on the page: <a href="http://i.imgur.com/wFjEY8t.jpg" rel="nofollow">http:&#x2F;&#x2F;i.imgur.com&#x2F;wFjEY8t.jpg</a><p>I can understand why twitter is saving money on hosting these new &quot;gifs&quot;
cosmeenalmost 11 years ago
This is what Gfycat <a href="http://gfycat.com/" rel="nofollow">http:&#x2F;&#x2F;gfycat.com&#x2F;</a> is been doing since last year but as a service.
RRRAalmost 11 years ago
The saddest part is that you can&#x27;t add a zip to that gif and use twitter as a sharing platform.<p>cat x.zip &gt;&gt; y.gif and upload would have been nice ;)
评论 #7917548 未加载
评论 #7917918 未加载
评论 #7917614 未加载
user24almost 11 years ago
Great, and we&#x27;ve lost the ability to save them to your computer, and to share them outside of twitter&#x27;s ecosystem.
malkiaalmost 11 years ago
I would think it&#x27;s to avoid any traces of steganography... naaah I&#x27;m just kidding....
johnnymonsteralmost 11 years ago
Does anyone know what they are doing for the conversion? Any services out there do this?
goblin89almost 11 years ago
For me the main lesson here is that I should be more attentive and investigate. I remember noticing some un<i>gif</i>fy vibe about animated clips on Twitter, but quickly dismissing the observation. Perhaps if my timeline contained a lot of GIFs I&#x27;d dig deeper, but it doesn&#x27;t help feeling shallow.
webXLalmost 11 years ago
This is an automated fix. Animated GIFs are the hack!
zobzualmost 11 years ago
its like many other sites do it and its much better that way
tomphooleryalmost 11 years ago
attn: reddit, please do this
neotoyalmost 11 years ago
Hopefully this will contribute to the extinction of gifs.
raverbashingalmost 11 years ago
I had noticed that. Because of flashblock.<p>Yeah, a 20+ years file format doesn&#x27;t do compression between frames, who would have thought...
评论 #7917444 未加载