Skip to content

Instantly share code, notes, and snippets.

@Efetivos
Last active April 24, 2023 19:16
Show Gist options
  • Select an option

  • Save Efetivos/1a1870e2d1ae75b658195790a4ef232b to your computer and use it in GitHub Desktop.

Select an option

Save Efetivos/1a1870e2d1ae75b658195790a4ef232b to your computer and use it in GitHub Desktop.
WebP & WEBM Converter | CLI | Converting to webp using cli

Converting images to WebM using cli

tutorial: https://www.youtube.com/watch?v=mB6XuGxh0Mc (skip to chapter of code in line)

1. Download the ffmpeg

FFMPEG: https://ffmpeg.org/download.html
gyan.dev: https://www.gyan.dev/ffmpeg/builds

2. Paste all mp4 videos into (bin) folder

3. Open cmd (Prompt command) of Windows and go to the repository folder

4. Run the command following the files extension

Change quality after -crf 30 (0 to 50, 25 is the middle)

for %i in (*.mp4); do ffmpeg -i "%i" -c:v libvpx-vp9 -crf 30 "%~ni.webm"

Converting images to WebP using cli

documentation: https://developers.google.com/speed/webp/download

1. Download the libwep ( libwebp-1.1.0-windows-x64 )

https://developers.google.com/speed/webp/download

2. Drop the file "cwebp.exe" on the images folder.

3. Open cmd (Prompt command) of Windows and go to the repository folder

D:\Desktop\test webp>

4. Run the command following the files extension

for %f in (*.png) do cwebp -q 80 %f -o "%~nf".webp

alternative to save images in a different/inner folder

for %f in (*.jpg) do cwebp -q 80 %f -o ./webp/"%~nf".webp

Navigating between folders on CMD

1. Open cmd (Prompt of Command) on run as Administrator (important)

C:\WINDOWS\system32>

2. Swift disk C: to D:

type:

d:

3. See if it does switch to:

D:\>

4. Copy directory path and paste on cmd

cd D:\Desktop\Mobile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment