hello friends! new(ish)!

WebM: Difference between revisions

From InstallGentoo Wiki v2
Jump to navigation Jump to search
>Hevnoraak
m (Added another .bat)
>Hevnoraak
m (I have no idea how to format this shit)
Line 48: Line 48:
'''Heftier video to .webm'''
'''Heftier video to .webm'''
  @echo off
  @echo off
  rem 3megabyte in bit
  rem 3megabyte in bit
  set MAXSIZE=25165824
  set MAXSIZE=25165824
  set WIDTH=720
  set WIDTH=720
  ffmpeg -i %1 2> webm.tmp
  ffmpeg -i %1 2> webm.tmp
  for /F "tokens=1,2,3,4,5,6 delims=:., " %%i in (webm.tmp) do (
  for /F "tokens=1,2,3,4,5,6 delims=:., " %%i in (webm.tmp) do (
     if "%%i"=="Duration" call :calcLength %%j %%k %%l %%m
     if "%%i"=="Duration" call :calcLength %%j %%k %%l %%m
  )
  )
  del webm.tmp
  del webm.tmp
  SET /a BITRATE=%MAXSIZE%/%VSECONDS%
  SET /a BITRATE=%MAXSIZE%/%VSECONDS%
  ffmpeg -y -i %1 -an -vf scale=-1:%WIDTH% -c:v libvpx -crf 5 -qmin 0 -qmax 50 -b:v %BITRATE% -f webm -pass 1 NUL
  ffmpeg -y -i %1 -an -vf scale=-1:%WIDTH% -c:v libvpx -crf 5 -qmin 0 -qmax 50 -b:v %BITRATE% -f webm -pass 1 NUL
  ffmpeg -y -i %1 -an -vf scale=-1:%WIDTH% -c:v libvpx -crf 5 -qmin 0 -qmax 50 -b:v %BITRATE% -f webm -pass 2 "%~n1.webm"
  ffmpeg -y -i %1 -an -vf scale=-1:%WIDTH% -c:v libvpx -crf 5 -qmin 0 -qmax 50 -b:v %BITRATE% -f webm -pass 2 "%~n1.webm"
  del ffmpeg2pass-0.log > NUL
  del ffmpeg2pass-0.log > NUL
  goto :EOF
  goto :EOF



Revision as of 17:25, 5 April 2014

WebM support is (hopefully) the newest addition to 4chan. This wiki page is meant to serve as an instructional tool to help you get started converting your content to WebM for posting.

WebM {is being, was} tested in these threads:

... and on a few /jp/ threads.


Converting with ffmpeg

Note: avconv and ffmpeg are not entirely drop-in replacements. Make sure you know which one you are using.

Linux and OS X Scripts

If you're using OS X or Linux, you probably know how to save and execute these scripts already, but here's a quick overview:

  1. Create a file, such as ~/bin/my_script.sh
  2. Copy and paste the code into this file with your favorite editor.
  3. Open a shell. Run the command chmod +x ~/bin/my_script.sh
  4. The script can now be called as ~/bin/my_script.sh some_file.type or if you have your PATH set correctly, my_script.sh some_file.type


Basic .gif to .webm

#!/bin/bash
out=${1%%.gif}.webm
ffmpeg -i $1 -c:v libvpx -crf 32 -b:v 300K $out


Basic video to .webm

#!/bin/bash
ffmpeg -i $1 -c:v libvpx -an $1.webm

Windows

After installing ffmpeg/avconv, most of these commands can be saved as .bat files and placed in the folder of the media file you wish to work with. Or you can just run them from the command prompt, assuming you have your PATH set correctly.

Basic .gif to .webm


Basic video to .webm

ffmpeg.exe -i "C:\Users\Anon\Input_File.mkv" -ss 30 -t 15 -codec:v vp8 -an "C:\Users\Anon\Output_File.webm"


Heftier video to .webm

@echo off
rem 3megabyte in bit
set MAXSIZE=25165824
set WIDTH=720
ffmpeg -i %1 2> webm.tmp
for /F "tokens=1,2,3,4,5,6 delims=:., " %%i in (webm.tmp) do (
    if "%%i"=="Duration" call :calcLength %%j %%k %%l %%m
)
del webm.tmp
SET /a BITRATE=%MAXSIZE%/%VSECONDS%
ffmpeg -y -i %1 -an -vf scale=-1:%WIDTH% -c:v libvpx -crf 5 -qmin 0 -qmax 50 -b:v %BITRATE% -f webm -pass 1 NUL
ffmpeg -y -i %1 -an -vf scale=-1:%WIDTH% -c:v libvpx -crf 5 -qmin 0 -qmax 50 -b:v %BITRATE% -f webm -pass 2 "%~n1.webm"
del ffmpeg2pass-0.log > NUL
goto :EOF


Other WebM Creation

Please see Reccomended_software for a list of good software for handling video files such as WebM.