Skip to content

FFmpeg

Terminal window
ffmpeg -y -ss ${timecode} -i input.mp4 -t ${clipDuration} -preset veryfast output.mp4
Terminal window
ffmpeg -y -i input.mp4 -i logo.png -filter_complex "overlay=${x in pixels}:${y in pixels}" -preset veryfast output.mp4

Stream camera to twitch with dynamic text overlay

Section titled “Stream camera to twitch with dynamic text overlay”
Terminal window
ffmpeg -rtsp_transport tcp -i ${camera_input} -re -stream_loop -1 -i {logo_path} -filter_complex overlay,scale=1280:-2,drawtext="fontfile={font_path}:bordercolor=0x000000:borderrw=1:fontcolor=0xFFFFFF:textfile={text_file_path}:reload=1:x=5:y=10:fontsize=38,format=yuv420p" -c:v libx264 -preset veryfast -b:v 4000k -f flv "rtmp://live.twitch.tv/app/{twitch_key}"
Terminal window
ffmpeg -i input.jpg -vf scale={size_in_px}:-2 output.png
Terminal window
ffmpeg -i input.mp4 -vframes 1 output.png
Terminal window
ffmpeg -i input.mp4 -ss 01:23:45 -vframes 1 output.png
-i input file the path to the input file
-ss 01:23:45 seek the position to the specified timestamp
-vframes 1 only handle one video frame
output.png output filename, should have a well-known extension
The -ss parameter accepts a value in the form HH:MM:SS[.xxx] or as a number in seconds.
Terminal window
ffmpeg -rtsp_transport tcp -i "rtsp://ip:port" -vframes 1 screenshot.png
Terminal window
arecord -l
arecord -L
Terminal window
arecord --dump-hw-params -D ${DEVICE_NAME}
Terminal window
ffmpeg -f alsa -i ${DEVICE_NAME} -t 30 output.wav

Record 30 seconds from an audio device by specifying codec

Section titled “Record 30 seconds from an audio device by specifying codec”
Terminal window
ffmpeg -f alsa -c:a pcm_s32le -i ${DEVICE_NAME} -t 30 output.wav
Terminal window
ffmpeg -stream_loop -1 -i gif1.gif -stream_loop -1 -i gif2.gif -i videoInput.mp4 -filter_complex "[2:v][0:v]overlay=10:10[bg];[bg][1:v]overlay=10:250" -preset veryfast -t 60 output.mp4

Create video from still images where images repeat themselves (1/10 for 10 seconds per image)

Section titled “Create video from still images where images repeat themselves (1/10 for 10 seconds per image)”
Terminal window
ffmpeg -y -framerate 1/10 -i logo%d.png -r 25 output.mp4
Terminal window
ffmpeg -re \
-f lavfi \
-i "testsrc=size=1280x720:rate=30,drawtext=text='Stream-#$(openssl rand -hex 6)':fontsize=50:fontcolor=black:x=(w-text_w)/2:y=(h-text_h*2)" \
-f mpegts udp://localhost:1234