Topic: What are the best ways to download/post Twitter videos?

Posted under Off Topic

Title should be self explanatory.

Alternatively, is there a method to convert them to a url? If so, i'd prefer that alternative.

This goes for GIFs too.

I usually look to find another source if I can, otherwise I use JDownloader to pull the video from the tweet's url. I generally use https://ezgif.com/video-to-gif/ if I'd rather have it in .gif format, but it will suffer a quality hit unless it's within certain size/fps ranges.

If you're comfortable with the command line, a combination of youtube-dl (which, contrary to its name, can download from a whole variety of sites including Twitter) and ffmpeg (for video conversion) should do the trick. Make sure to use -c:a opus with ffmpeg to meet the recommended encoding standards for video by e621.

If that sounds too difficult, you can use sites such as this to download the video, and sites like this to convert the video into the webm format.

benjiboyo said:
Title should be self explanatory.

1) Ask the artist for the original video file, preferably in WebM.
2) If method #1 doesn't work, find another (favourable) source. Twitter is one of the worst sites to download from.
3) If methods #1 & #2 don't work, see below.

Alternatively, is there a method to convert them to a url? If so, i'd prefer that alternative.

Use Twitter Video Downloader and click the highest resolution link. The quality options should not be any different than that of youtube-dl.
However, you will not be able to direct upload using that link since the format is in MP4. E621 only accepts videos in the WebM format.

If you don't know how to convert MP4 to WebM, read @Mairo 's profile wall under "Converting".

This goes for GIFs too.

You cannot download GIFs from Twitter. Put it through the Twitter Video Downloader and you will get a ~1 second MP4 file.
You can put the direct link into Ezgif's Video to animated GIF converter, as suggested by @RiverInADryLand, but you will need to tweak with the settings a bit to get the right quality and frame rate.

Also, mentioning Twitter, you can try using Nitter instances if you want it much faster browsing. It's basically a wrapper around Twitter's API, if I understand right. I've heard people half-jokingly call some site's codebase 'enclaves', referring to focus creep (not scope creep, that's when it's shadowtech - i.e. Not authorized, but done by internal hands).

It would make it slightly less painful trying to find said videos, to make/use an Nitter instance.

riverinadryland said:
I generally use https://ezgif.com/video-to-gif/ if I'd rather have it in .gif format, but it will suffer a quality hit unless it's within certain size/fps ranges.

thegreatwolfgang said:
You can put the direct link into Ezgif's Video to animated GIF converter, as suggested by @RiverInADryLand, but you will need to tweak with the settings a bit to get the right quality and frame rate.

That's because you are using a goddamn ezgif :V
Stop that. I'm gonna personally slap every single person I see doing this.

http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html

Because GIF is lossless fileformat limited to 256 colors, you kinda have to be aware of how to handle the content to make it work. Just slapping lossy MP4 video into ezgif will work with your memes, but not with content you want to save at high quality.
I even go as far as to discard manually frames that should be identical, but because of video compression have garbage data on them.

ilovemacros said:
If you're comfortable with the command line, a combination of youtube-dl (which, contrary to its name, can download from a whole variety of sites including Twitter) and ffmpeg (for video conversion) should do the trick. Make sure to use -c:a opus with ffmpeg to meet the recommended encoding standards for video by e621.

youtube-dl -f best -g <link to tweet>

prints direct link to highest quality file that can be used as source.
-c:a opus literally only specifies that the encoder should use Opus as codec for audio track. Vorbis is still accepted format and in many videos there's no audio to begin with so this literally does nothing.

ilovemacros said:
and sites like this to convert the video into the webm format.

Stop it.

thegreatwolfgang said:
If you don't know how to convert MP4 to WebM, read @Mairo 's profile wall under "Converting".

Yeah, don't, haven't updated anything in 5 years so the instructions are pretty out of date, also zero time to write and improve the wiki article howto:transcode and convert.
I definitely should try to get something together to avoid stuff like comment #6731921
https://trac.ffmpeg.org/wiki/Encode/VP9

mairo said:
youtube-dl -f best -g <link to tweet> prints direct link to highest quality file that can be used as source.
-c:a opus literally only specifies that the encoder should use Opus as codec for audio track. Vorbis is still accepted format and in many videos there's no audio to begin with so this literally does nothing.

Stop it.

LOL, yeah, it's a container format, for those that missed that detail between the lines. Vorbis or VP9 or whatever is an acceptable codec.

Yeah, don't, haven't updated anything in 5 years so the instructions are pretty out of date, also zero time to write and improve the wiki article howto:transcode and convert.
I definitely should try to get something together to avoid stuff like comment #6731921
https://trac.ffmpeg.org/wiki/Encode/VP9

I guess I could help with that. Double-check to make sure I didn't screw it up too bad?

https://en.wikipedia.org/wiki/VP9 I was looking it up to refresh memory. I think this is the one I've used, the most. Looking at the list at the bottom of this page - Vorbis is the audio codec, only? It's been a while since I used Ogg or the like.

https://en.wikipedia.org/wiki/List_of_codecs#Video_compression_formats Clarification: Theora is the one that is the sister codec to Vorbis. Also, I use VP9 because of the lossless option for stuff from Pixiv, and it has support EVERYWHERE with decent compression. I should get to writing my tool to make VFR (variable frame rate) work correctly. :/

@Mairo Can you please provide me with source to that conversion section on your profile (wall)?

Updated

On the youtube-dl option. I'd actually go with yt-dlp over youtube-dl solely because it is more human-readable when using the -F flag. (Also, it releases stable binaries way more often than youtube-dl.)

mairo said:
youtube-dl -f best -g <link to tweet>

I don't know about Twitter, but when downloading from YouTube it isn't recommended to download with the -f best flag since it only downloads the best pre-merged quality option. If it also happens on Twitter then the best way to go about sourcing video material would be by fetching all the resolution/vcodec/acodec IDs with the -F flag and then merging them by using -f [id]+[id]. (If not then hey, at least I hope someone lurking on the forums learned something haha.)

Anyways, it is true that sourcing from Twitter should be a last resort only to be approached when the artist hasn't uploaded the video anywhere else. It is always best practice look on all their socials and portals to source the material.

alphamule said:
LOL, yeah, it's a container format, for those that missed that detail between the lines. Vorbis or VP9 or whatever is an acceptable codec.

I guess I could help with that. Double-check to make sure I didn't screw it up too bad?

https://en.wikipedia.org/wiki/VP9 I was looking it up to refresh memory. I think this is the one I've used, the most. Looking at the list at the bottom of this page - Vorbis is the audio codec, only? It's been a while since I used Ogg or the like.

https://en.wikipedia.org/wiki/List_of_codecs#Video_compression_formats Clarification: Theora is the one that is the sister codec to Vorbis. Also, I use VP9 because of the lossless option for stuff from Pixiv, and it has support EVERYWHERE with decent compression. I should get to writing my tool to make VFR (variable frame rate) work correctly. :/

@Mairo Can you please provide me with source to that conversion section on your profile (wall)?

Vorbis and Opus are audio codecs that you can use inside WebM container. Opus is highly recommended, it is simply stellar quality even at relatively low bitrates and there's a reason why basically everything uses it these days, Vorbis is still accepted even if used.
VP9 and VP8 are video codecs that you can use inside WebM container. VP9 is super highly recommended, VP8 is essentially obsolete in every way but if the file uses that it's still accepted.
e621:supported_filetypes

Also remember that "lossless" in h264 and VP9 isn't proper lossless. It's still lossy codec so there will be slight alteration and at the very least because using YUV420, the color information is halved regardless. I do personally use lanczos scaling (and nearest for pixel art) to force higher quality scaling on the chroma but that's still lossy regardless. Lossless option is still pretty amazing when converting pixel artwork and vectors to WebM but that's about it. Short loops also work, but because of astronomical bitrate it will cause playback issues with loop and when source is already lossy (Ugoiras are stored as lossy JPG image sequence, ) then the benefits are nonexistant and at that point you might want to use APNG or GIF instead.
VFR does have ever so slight playback issues still so I have been icky using that anywhere.

Source for my bio is my brain after using google a lot years ago.

perkwombo said:
On the youtube-dl option. I'd actually go with yt-dlp over youtube-dl solely because it is more human-readable when using the -F flag. (Also, it releases stable binaries way more often than youtube-dl.)

I don't know about Twitter, but when downloading from YouTube it isn't recommended to download with the -f best flag since it only downloads the best pre-merged quality option. If it also happens on Twitter then the best way to go about sourcing video material would be by fetching all the resolution/vcodec/acodec IDs with the -F flag and then merging them by using -f [id]+[id]. (If not then hey, at least I hope someone lurking on the forums learned something haha.)

Anyways, it is true that sourcing from Twitter should be a last resort only to be approached when the artist hasn't uploaded the video anywhere else. It is always best practice look on all their socials and portals to source the material.

Currently yt-dlp is more up to date and more user friendly option yes, also some websites have been fixed to work.
yt-dlp also does give you warning about -f best as that is indeed not the best quality with all websites. However with twitter specifically, that's always best so it just makes things so much faster to do.
With youtube, it's best non-DASH video, meaning 720p h264 maximum.

And yes, I rage about this on almost daily basis, twitter is not a place to post content. The reason why the quality of GIF and video uploads is so low is because they are optimized for memes viewed on mobile. I have no idea why 90% of animators use twitter to post their animations exclusively without links to higher quality or alternate sources. Technically speaking, Twitter is actively destroying artwork on daily basis.

mairo said:
Also remember that "lossless" in h264 and VP9 isn't proper lossless.

I see. Colorspace losses like micro-law audio files? For source JPEGs it seems good enough.

VFR does have ever so slight playback issues still so I have been icky using that anywhere.

It's... supposed to be well-supported by Google's libraries?

"Source for my bio is my brain after using google a lot years ago. " LOL, I meant for formatting bcode, but I don't think I'll need it. I'm just trying to figure out which parts of it need updating. I'll send you notes as I review/research it.

Currently yt-dlp is more up to date and more user friendly option yes, also some websites have been fixed to work.
yt-dlp also does give you warning about -f best as that is indeed not the best quality with all websites. However with twitter specifically, that's always best so it just makes things so much faster to do.
With youtube, it's best non-DASH video, meaning 720p h264 maximum.

Still processing that. I'll recheck topic in morning when I can focus better. I have a lot of reading to be doing to catch up. I remember reading about Ogg people (Xiph.org) updating audio codecs way back. I just remembered the Vorbis name first.

And yes, I rage about this on almost daily basis, twitter is not a place to post content. The reason why the quality of GIF and video uploads is so low is because they are optimized for memes viewed on mobile. I have no idea why 90% of animators use twitter to post their animations exclusively without links to higher quality or alternate sources. Technically speaking, Twitter is actively destroying artwork on daily basis.

Twitter is cancer, you don't say? :P

Allright, i'm not getting any of these super technical stuff, but if i ever plan on uploading stuff, i'll just use website converters and see if they get rejected or not. I can spare the rejection.

mairo said:
And yes, I rage about this on almost daily basis, twitter is not a place to post content. The reason why the quality of GIF and video uploads is so low is because they are optimized for memes viewed on mobile. I have no idea why 90% of animators use twitter to post their animations exclusively without links to higher quality or alternate sources. Technically speaking, Twitter is actively destroying artwork on daily basis.

I believe it's the remnants of the Tumblr porn ban. And basically people who only exclusively used tumblr now exclusively use twitter. Which, i dunno the comparison on compression on tumblr. But it is unfortunate.

benjiboyo said:
Allright, i'm not getting any of these super technical stuff, but if i ever plan on uploading stuff, i'll just use website converters and see if they get rejected or not. I can spare the rejection.

I believe it's the remnants of the Tumblr porn ban. And basically people who only exclusively used tumblr now exclusively use twitter. Which, i dunno the comparison on compression on tumblr. But it is unfortunate.

They went from a decent platform by force, to a horrible platform by choice, hehe. Oh well, it's still a decent way to send free text messages even if it also inherentted the awful restrictions of SMS/MMS.

Don't use web converters - there are user-friendly front ends for FFMPEG like https://qwinff.github.io/ which is literally the first result on Google for 'ffmpeg front end'. This has sane defaults but lets you tweak it. https://qwinff.github.io/screenshots.html Examples of use.

Haha, figures that the second result mentions Handbrake: https://old.reddit.com/r/ffmpeg/comments/is932j/looking_for_a_good_windows_ffmpeg_gui/

:edit: Trying to open-source front ends on other OSes than Linux/Windows. Mac OS has a bunch of good ones which is not a shock.

Updated

benjiboyo said:
Which, i dunno the comparison on compression on tumblr.

Once upon a time, it used to be pretty good, provided you had the know-how to get the HQ images. Then the process got more and more and more complicated. The latest technique I heard was reblogging the post, then making a backup of your entire blog so that all the images are gathered. No clue if that still nets you good images nowadays. Twitter's a lot simpler in comparison.

alphamule said:
I see. Colorspace losses like micro-law audio files? For source JPEGs it seems good enough.

Don't know audio stuff.
But my point is that it's converting lossy format into lossy format, using lossless option is basically brute forcing the quality significantly after diminishing returns. You will simply get much higher filesizes which are already altered to some degree.

benjiboyo said:
I believe it's the remnants of the Tumblr porn ban. And basically people who only exclusively used tumblr now exclusively use twitter. Which, i dunno the comparison on compression on tumblr. But it is unfortunate.

Tumblr stores videos at original resolution and high quality, images are sampled but reblogging still gives the original quality file even now.

strikerman said:
Once upon a time, it used to be pretty good, provided you had the know-how to get the HQ images. Then the process got more and more and more complicated. The latest technique I heard was reblogging the post, then making a backup of your entire blog so that all the images are gathered. No clue if that still nets you good images nowadays. Twitter's a lot simpler in comparison.

We're talking about videos specifically and you can just fetch good quality by omitting the resolution in the URL.
see e.g. post #2989918, 720p embedded on tumblr, 1698p when omitting 720p from URL.

mairo said:
Don't know audio stuff.
But my point is that it's converting lossy format into lossy format, using lossless option is basically brute forcing the quality significantly after diminishing returns. You will simply get much higher filesizes which are already altered to some degree.

Ah, right. I was thinking in terms of not going through another encoding cycle. Basically, just same data, different container/s. I guess if I'm forced to output a different color space or codec, then it's going to be lossy cycling. :(

In audio, there's this trick where they don't directly encode samples, but only the rough ratio of output level between samples. It lets them throw away the less useful precision of the samples. Say, 8-bit to 4-bit but still recognizably the same sounds. The math is similar for pixels in the color planes of images. Like, grayscale has most of the image's information, and you can do things where color info is stored as a hue. This is related to the technique of transmitting the average of left and right channels, then having the stereo encoded as the difference (and thus far less bandwidth needed since usually both channels are similar).

  • 1