Jump to content

[Tutorial] Convert video/gifs to webm.

HEY!

 

So, we've recently added webm/gifv support on the forums, and I'm gonna show you all how to convert things to webm/gifv with very little hassle.

 

But why ixi?! Why use webm?! My gif is just fine!

No, it's not. It's huge! 

 

for example : 

https://giant.gfycat.com/CompetentIncompatibleAmericanbittern.webm

Is 18MB. The gif version of this webm is 249MB. That's a huuuuge difference.

 

I'm going to split this into multiple parts to make it easier to follow, The first part will go about grabbing the source video so that you can then manipulate it to your will [insert evil laugh here]

 

so lets do this!

 

Part 1 : Grabbing the source.

 

If you're just converting a gif, there's no need to look at this part, just skip to the conversion part.

 

I use 4k Video Downloader because it's free and allows me to download the source of the videos i want to mess with.

Once it's downloaded and installed, you can then set about downloading the source video you want to edit.

To do this go to the video you want to make a webm/gifv of, and copy the URL.

Paste the link into 4k Video Downloader, once that's done a new window will pop up saying "parsing" then "download clip"

On the Download Clip window, select the quality you want and make sure the format is set to MP4, set your download location and then click download.

I recommend downloading the highest quality possible just to allow for headroom.

You can now move to Part 2.

 

This is a bit more involved but if you want to make a webm of a movie or anything that's in a MKV container you'll have to do this, especially if you want to add things or edit the video as almost all video editing programs don't support mkv files for editing.

 

Okay, so.  To start, you're gonna need something to rip the h.264 file out of the mkv container.

I use MKVtoolnix with MKVextract GUI to extract h.264 files from the mkv files and My MP4Box GUI to mux it into an mp4 file.

 

Go here. If you want to download it, the zip contains a portable version of mkvtoolnix and the My MP4Box GUI installer.

 

once it's downloaded and extracted and you've installed My MP4Box, you can then start to extract the file. 

 

Navigate to the mkvtoolnix folder and open the file called "MKVextractGUI"

find the mkv file you want to extract and add it to the input box, select where you want the output to go and choose the track that contains the video, it'll usually be track 1 or it'll say video. Once you've selected that, press extract.

 

Now open My MP4Box GUI and in the mux tab, add the file you just extracted. and press mux. The file will be saved in the same directory as the h.264 file.

 

You can also demux with My MP4Box , but I prefer my way :P

 

You can now edit the video, cut it to size, etc in your favorite video editing program.

 

 

Part 2 : Converting the file.

 

There's many ways to convert gifs to webm, such as just uploading them to a service that'll do it for you, such as gfycat. But the downside to this is that you've got no real control over the quality settings that they use. They're usually just fine though.

 

If I've got a gif that i want to convert to a webm or a video i want to do the same with and don't want to edit it, I'll just use ffmpeg. It's a command line converter and it's simple to use, usually fast and lets me choose between a lot of quality options. It also doubles as a h.265 converter if you're into that :P

 

To use ffmpeg, you'll need to download it and run it from the link above. Once that's done, extract it and place the gif/video you want to convert into the bin folder. Once that's also done open ffmpeg.

 

You'll be greeted by a nice command line.

 

to actually convert the file, you're gonna want to know what the commands are and what they do.

 

  • -i <filename> Tells ffmpeg what the input file is.
  • -c:v Specifies the video codec to use. webm isn't actually an encoding type unto itself, but an audio/video container, like mkv. Nevertheless, you will almost always use libvpx for the video.
  • -b: Sets the target bitrate. -b:v sets video bitrate and -b:a sets audio. Only use this option if you desire a constant bitrate, which will produce a higher quality file. If you are looking for a smaller file size, consider leaving this out.
  • -c:a: Specifies the audio codec to use. Some options include libvorbis, libmp3lame, etc. If you are unsure stick with libvorbis.
  • -threads: Tells ffmpeg to use multithreading. Enter the number of cores your processor has as a parameter or put 0 to use them all.
  • -ac: Sets number of audio channels, normally 2 or 1. Sometimes setting to 1 will give you a smaller filesize. You should probably not touch this unless you know what you're doing.
  • -an: Disable audio. Use when converting .gif files to .webm.
  • -crf: Sets CRF value. Must be from 4-63. Lower is higher quality. I use 4 most of the time.
  • -ss: Seeks to a position in the file. Useful for cutting out small scenes. Takes time in seconds as a parameter or HH:MM:SS syntax. use -t in tandem to set the file duration. For example, -t 00:00:10 cuts out the first ten seconds of the video for conversion, and -ss 00:00:10 -t 00:00:10 would skip the first ten seconds and cut out the next ten for conversion.

Thanks /g/ wiki for the easy copypaste :P

 

  • -x265-params allows you to encode in h.265

 

Okay, so. Now you're ready to convert.

 

Here's an example ffmpeg command :

using that command, the gif.gif file in the bin folder will be converted to output.webm and then you're ready to upload and post on the forums :D

 

If you want to convert a video it's a bit more in depth, for example :

notice the seeking in the video, this is essential as you don't want to convert the whole video :P

 

And that's you! Ready to go!

 

https://fat.gfycat.com/LinearSecondaryGibbon.webm

 

To embed a webm/gifv file to the forum, just copy the direct link to the webm (with file extension) and it will auto embed.

ffmpeg -i gif.gif -c:v libvpx -crf 4 -threads 0 -an -b:v 10M output.webm
ffmpeg -i video.mkv -c:v libvpx -crf 4 -threads 0 -an -ss 00:00:22 -t 00:00:5 -b:v 10M output.webm

 

Spoiler
Spoiler

"You know I was taught that if you don't have anything nice to say, don't say anything at all. You feeling me cocksucker?"

Spoiler

"Ethernet is internet juice. You have to press the internet really hard and you will get it."

Spoiler

"My quantum milk machine brings every boy to all the yards." non futuis et sursum

 

PC Specs! | I7-950 | 24GB RAM | 10TB Storage | GTX 970 Strix and a 560TI DCUII for Physx | 120GB 840 + 250GB 850 EVO | Asus xonar DGX

 

 

Please take a moment to look over the forum CoC here.

 

Link to comment
Share on other sites

Link to post
Share on other sites

Awesome great tutorial :)

 

queue massive gif spam on the forum (probably by me)

Desktop - Corsair 300r i7 4770k H100i MSI 780ti 16GB Vengeance Pro 2400mhz Crucial MX100 512gb Samsung Evo 250gb 2 TB WD Green, AOC Q2770PQU 1440p 27" monitor Laptop Clevo W110er - 11.6" 768p, i5 3230m, 650m GT 2gb, OCZ vertex 4 256gb,  4gb ram, Server: Fractal Define Mini, MSI Z78-G43, Intel G3220, 8GB Corsair Vengeance, 4x 3tb WD Reds in Raid 10, Phone Oppo Reno 10x 256gb , Camera Sony A7iii

Link to comment
Share on other sites

Link to post
Share on other sites

Awesome great tutorial :)

 

queue massive gif spam on the forum (probably by me)

I'll join you x)

 

 

 

Ty for this btw !

 

NOW I HAVE TO LOOK AT THE FREAKING PANDATHINY SOO CUTE

Link to comment
Share on other sites

Link to post
Share on other sites

Awesome great tutorial :)

 

queue massive gif spam on the forum (probably by me)

I'll join you x)

 

 

 

Ty for this btw !

 

NOW I HAVE TO LOOK AT THE FREAKING PANDATHINY SOO CUTE

Are you forgetting about Sir Luka the Gifmaster?

@virtualTune yaay we can embed our fav webms now  :wub:

"Unofficially Official" Leading Scientific Research and Development Officer of the Official Star Citizen LTT Conglomerate | Reaper Squad, Idris Captain | 1x Aurora LN


Game developer, AI researcher, Developing the UOLTT mobile apps


G SIX [My Mac Pro G5 CaseMod Thread]

Link to comment
Share on other sites

Link to post
Share on other sites

We gonna set the serverroom on fire ? :P

check my profile hahaha

"Unofficially Official" Leading Scientific Research and Development Officer of the Official Star Citizen LTT Conglomerate | Reaper Squad, Idris Captain | 1x Aurora LN


Game developer, AI researcher, Developing the UOLTT mobile apps


G SIX [My Mac Pro G5 CaseMod Thread]

Link to comment
Share on other sites

Link to post
Share on other sites

Are you forgetting about Sir Luka the Gifmaster?

@virtualTune yaay we can embed our fav webms now  :wub:

You're hardly the gifmaster :P

 

Spoiler
Spoiler

"You know I was taught that if you don't have anything nice to say, don't say anything at all. You feeling me cocksucker?"

Spoiler

"Ethernet is internet juice. You have to press the internet really hard and you will get it."

Spoiler

"My quantum milk machine brings every boy to all the yards." non futuis et sursum

 

PC Specs! | I7-950 | 24GB RAM | 10TB Storage | GTX 970 Strix and a 560TI DCUII for Physx | 120GB 840 + 250GB 850 EVO | Asus xonar DGX

 

 

Please take a moment to look over the forum CoC here.

 

Link to comment
Share on other sites

Link to post
Share on other sites

BTW, imgur's .gifv format works fine as well (though don't try to convert files to .gifv because it's just a webm/mp4 redirect).

HTTP/2 203

Link to comment
Share on other sites

Link to post
Share on other sites

You're hardly the gifmaster :P

2a26e9946e7340259a61a738b22d0c8f.jpg

"Unofficially Official" Leading Scientific Research and Development Officer of the Official Star Citizen LTT Conglomerate | Reaper Squad, Idris Captain | 1x Aurora LN


Game developer, AI researcher, Developing the UOLTT mobile apps


G SIX [My Mac Pro G5 CaseMod Thread]

Link to comment
Share on other sites

Link to post
Share on other sites

 

Spoiler
Spoiler

"You know I was taught that if you don't have anything nice to say, don't say anything at all. You feeling me cocksucker?"

Spoiler

"Ethernet is internet juice. You have to press the internet really hard and you will get it."

Spoiler

"My quantum milk machine brings every boy to all the yards." non futuis et sursum

 

PC Specs! | I7-950 | 24GB RAM | 10TB Storage | GTX 970 Strix and a 560TI DCUII for Physx | 120GB 840 + 250GB 850 EVO | Asus xonar DGX

 

 

Please take a moment to look over the forum CoC here.

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×