TJW-Tech Wiki

Mandatory Happiness

User Tools

Site Tools


scripts:ffmpeg

FFMPEG Cheat Sheet

# Remux as mp4 with web-playback
ffmpeg -i <input> -codec copy -movflags faststart <output>.mp4

# Transcode to mp4 with web-playback
ffmpeg -i <input> -c:v libx264 -pix_fmt yuv420p -movflags faststart <output>.mp4

# Accurately slice video without transcoding and remux as mp4 (time in hh:mm:ss.ddd format)
ffmpeg -i <input> -ss <start time> -t <length of clip> -vcodec copy -acodec copy -movflags faststart <output>.mp4

# Fast slice video without transcoding and remux as mp4 (time in hh:mm:ss.ddd format)
ffmpeg -ss <start time> -i <input> -t <length of clip> -vcodec copy -acodec copy -movflags faststart <output>.mp4

# Transcode to VP8 with a webm container aiming for average bitrate
ffmpeg -i <input> -c:v libvpx -b:v <bitrate K, M> -c:a libvorbis -threads <1.5*cpu cores> <output>.webm

# Transcode to VP8 with a webm container using qmin and qmax for quality selection
ffmpeg -i <input> -qmax <0-51 (0=high_bitrate 51=low_bitrate)> -qmin <0-51 (0=high_bitrate 51=low_bitrate)> -threads <1.5*cpu cores> <output>.webm

# Mute audio
use the -an flag

# Burn subtitles into video
ffmpeg -i <source> -vf subtitles=video.mkv <output>

# Scale video
-vf scale=-2:720

# Image sequance to video
ffmpeg -framerate 30 -pattern_type glob -i '*.jpg' -c:v libx264 out.mp4

# Pull image from webcam
ffmpeg -f video4linux2 -i /dev/v4l/by-id/usb-0c45_USB_camera-video-index0 -vframes 1 test.jpeg

scripts/ffmpeg.txt · Last modified: 2017/01/20 13:09 by timothy