Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create a batch file to launch both ffmpeg and a cheatsheet if you have trouble remembering switches or prefer to use notepad as a scratchpad:
- start notepad "C:\webm cheatsheet.txt"
- cmd /k "cd /d C:\Program Files\ffmpeg\bin && cls"
- # dump subs. dumps full subtitle file.
- ffmpeg -i "file.mkv" -an -vn -c:s copy C:\sub.ass
- ## hardsubbing
- ## 1) dump subs at the input timecode, trimming the subtitle file to just the portion that you want
- ffmpeg -ss 10:00:30 -i input.mkv -t 20 -vn -an -c:s copy C:\sub.ass
- ## 2) encode the video with input subtitle file location set
- ffmpeg -ss 10:00:30 -i input.mkv -t 20 -c:v libvpx -b:v 1M -an -vf subtitle=C:\sub.ass C:\output.webm
- # 2-pass encoding
- ffmpeg -i FILE.EXT -c:v libvpx -pass 1 -f webm null
- ffmpeg -i FILE.EXT -c:v libvpx -pass 2 -f webm C:\bokunopico_2pass.webm
- # gif > webm
- ffmpeg -i "" -c:v libvpx -crf 4 -b:v 500K C:\.webm
- # dump meta
- ffmpeg -i input_file -f ffmetadata C:\metadata.txt
- # add meta
- ffmpeg -i input_file -i C:\metadata.txt -map_metadata 1 output_file
- # some switches
- -i "C:\path\file.avi" : input file
- -ss : timecode to seek to and start encoding at (see seeking mode examples below)
- -t : duration of output video in seconds
- -to : timecode to stop encoding at. used with -ss. cannot be used when -t is set. unreliable. use -t
- -f : output format. not necessary to set most of the time.
- -framerate : frames per second. low framerates [1-5] make the video impossible to accurately seek through.
- -fs : sets an output filesize value in bytes. video will stop encoding at this value, cutting your clip short if necessary.
- -sn -an -vn : ignore subs/audio/video
- -mb_threshold : does something
- -crf 0 : 4-63 lower is better quality
- -qmin 0 -qmax 50 : variable quality. unnecessary.
- -threads : for multi-threaded processors. if you do not know what to set this value to, do not use it. can lead to bluescreens.
- -c:v libvpx : sets video codec. webm codec is libvpx
- -b:v [n][KM] : video bitrate. value in bits/kilobits/megabits. ex: 1/1K/1M. bitrate formula for a 3MB target filesize: -b:v 3*8388608/N*0.975 (replace N with runtime in seconds)
- -c:a libvorbis : audio codec. unused for 4chan webms
- -b:a:nnn
- -vf scale=-1:480 : sets the scale. [width]:[height]. -1 will automatically calculate its value based on the other value (preserves aspect ratio)
- -vf crop=w:h:x:y : -vf crop=1280:544:0:88 protip: screenshot your video and edit it in paint to find these co-ordinates if you must crop
- -vf subtitles=sub.ssa : sets subtitle source. if no path is set it is relative to location of ffmpeg.exe
- -metadata author="%artist%"
- -metadata title="%album%" : some forks of 4chanx can extract metadata. always fill this in with the source name or link to where you found it.
- -y : yes to overwrite file prompt (useful when tweaking bitrates)
- #chaining crop/scale/subtitle commands. simply use a comma
- -vf crop=1280:544:0:88,scale=-1:480
- #accurate seeking mode (slow)
- ffmpeg -i "file.avi" -ss 00:10:00 etc etc
- #quick seeking mode (eliminates an initial pause while encoding as ffmpeg has trouble seeking through long, large video files)
- ffmpeg -ss 00:10:00 -i "file.avi" etc etc
- protip: windows users can shift+right-click a file > copy as path to get a full path to the file, quotes included, copied to the clipboard.
- protip: use CTRL+G in MPC-HC to copy millisecond-accurate timecodes.
- #blank command. fill this in and get started making those weebums.
- ffmpeg -i -vf scale=-1:480 -c:v libvpx -b:v 3*8388608/*0.975 -metadata title="" -an -y -threads 8 C:\.webm
- #music blank (used for creating sound webms. can accept images instead of video as source)
- ffmpeg -i [video/image path goes here] -vf scale=-1:240 -i [audio path goes here] -c:v libvpx -b:v 100k -c:a libvorbis -b:a 128k -y -threads 8 C:\.webm
- #album preview blank (i use this to create album crossfades from within foobar2k. i won't explain how to create the crossfade here)
- ffmpeg -framerate 7 -loop 1 -i -c:v libvpx -i -c:a libvorbis -b:a 96k -b:v 90k -vf scale=-1:512 -shortest -threads 8 -y "C:\ preview.webm"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement