hello friends! new(ish)!

WebM: Difference between revisions

From InstallGentoo Wiki v2
Jump to navigation Jump to search
>Hevnoraak
m (yeah)
>Hevnoraak
(Edited conversion .bat; added .webm tutorial)
Line 48: Line 48:
'''Heftier video to .webm'''
'''Heftier video to .webm'''
  @echo off
  @echo off
  rem 3megabyte in bit
  rem about 3megabyte in bit 3*1024*1024*8*0.95
  set MAXSIZE=25165824
  set /A MAXSIZE=23907532
  set WIDTH=720
  set WIDTH=720
  ffmpeg -i %1 2> webm.tmp
  ffmpeg -i %1 2> webm.tmp
Line 57: Line 57:
  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 -threads 0 -sn -an -c:v libvpx -b:v %BITRATE% -vf scale=-1:%WIDTH% -quality best -cpu-used 0 -slices 8 -auto-alt-ref 1 -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 -threads 0 -sn -an -c:v libvpx -b:v %BITRATE% -vf scale=-1:%WIDTH% -quality best -cpu-used 0 -slices 8 -auto-alt-ref 1 -f webm -pass 2 "%~n1.webm"
  del ffmpeg2pass-0.log > NUL
  del ffmpeg2pass-0.log > NUL
  goto :EOF
  goto :EOF
 
:calcLength
FOR /F "tokens=* delims=0" %%A IN ("%3") DO SET /A s=%%A
FOR /F "tokens=* delims=0" %%A IN ("%2") DO SET /A s=s+%%A*60
FOR /F "tokens=* delims=0" %%A IN ("%1") DO SET /A s=s+%%A*60*60
set /A VSECONDS=s


== Other WebM Creation ==
== Other WebM Creation ==
Line 68: Line 72:
== Sources and Resources ==
== Sources and Resources ==
#https://trac.ffmpeg.org/wiki/vpxEncodingGuide
#https://trac.ffmpeg.org/wiki/vpxEncodingGuide
#WebM of a WebM tutorial: https://rbt.asia/boards/g/img/0411/75/1396646705233.webm
#

Revision as of 18:09, 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 about 3megabyte in bit 3*1024*1024*8*0.95
set /A MAXSIZE=23907532
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 -threads 0 -sn -an -c:v libvpx -b:v %BITRATE% -vf scale=-1:%WIDTH% -quality best -cpu-used 0 -slices 8 -auto-alt-ref 1 -f webm -pass 1 NUL
ffmpeg -y -i %1 -threads 0 -sn -an -c:v libvpx -b:v %BITRATE% -vf scale=-1:%WIDTH% -quality best -cpu-used 0 -slices 8 -auto-alt-ref 1 -f webm -pass 2 "%~n1.webm"
del ffmpeg2pass-0.log > NUL
goto :EOF
:calcLength
FOR /F "tokens=* delims=0" %%A IN ("%3") DO SET /A s=%%A
FOR /F "tokens=* delims=0" %%A IN ("%2") DO SET /A s=s+%%A*60
FOR /F "tokens=* delims=0" %%A IN ("%1") DO SET /A s=s+%%A*60*60
set /A VSECONDS=s

Other WebM Creation

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

Sources and Resources

  1. https://trac.ffmpeg.org/wiki/vpxEncodingGuide
  2. WebM of a WebM tutorial: https://rbt.asia/boards/g/img/0411/75/1396646705233.webm