hello friends! new(ish)!

WebM: Difference between revisions

From InstallGentoo Wiki v2
Jump to navigation Jump to search
>Hevnoraak
(Created page; Outlining (possible) future categories; put most important information in (haphazardly, sorry))
 
>Hevnoraak
m (Added another .bat)
Line 23: Line 23:
# Open a shell. Run the command <code>chmod +x ~/bin/my_script.sh</code>
# Open a shell. Run the command <code>chmod +x ~/bin/my_script.sh</code>
# The script can now be called as <code>~/bin/my_script.sh some_file.type</code> or if you have your PATH set correctly, <code>my_script.sh some_file.type</code>
# The script can now be called as <code>~/bin/my_script.sh some_file.type</code> or if you have your PATH set correctly, <code>my_script.sh some_file.type</code>


'''Basic .gif to .webm'''
'''Basic .gif to .webm'''
Line 28: Line 29:
  out=${1%%.gif}.webm
  out=${1%%.gif}.webm
  ffmpeg -i $1 -c:v libvpx -crf 32 -b:v 300K $out
  ffmpeg -i $1 -c:v libvpx -crf 32 -b:v 300K $out


'''Basic video to .webm'''
'''Basic video to .webm'''
Line 41: Line 43:


'''Basic video 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"


Run this command:
 
  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 ==
== Other WebM Creation ==
Please see [[Reccomended_software]] for a list of good software for handling video files such as WebM.
Please see [[Reccomended_software]] for a list of good software for handling video files such as WebM.

Revision as of 17:24, 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.