Example of complete command : ffmpeg -hide_banner -i `ls -rth *mkv | tail -1` -ss 1 -t 5 -filter_complex "[0:v] fps=12,crop=1600:1024:0:0,split [a][b];[a] palettegen [p];[b][p] paletteuse" -y ok.gif; gwenview ok.gif

From personal use

  • overlay image to virtual webcam ffmpeg -i /dev/video0 -i new.svg -filter_complex "[1]hflip[f],[0][f]overlay=format=auto,format=yuv420p[v]" -map "[v]" -f v4l2 /dev/video2 -nostdin -hide_banner -nostats &
    • use sudo modprobe v4l2loopback to get /dev/video2
  • screen capture without OBS ffmpeg -framerate 25 -f x11grab -i :1 output.mp4 (but no audio)
  • webcam live streaming to PeerTube instance ffmpeg -f v4l2 -i /dev/video0 -re -f lavfi -i anullsrc -f flv rtmp://video.benetou.fr:1935/live/APIKEY
  • timelapse screen capture to video -framerate 24 -i img%03d.png -vf scale=720:-2 -y output.mp4
  • -re -loop 1 -i video_test_mire.jpg -vcodec libx264 -f flv rtmp://live.twitch.tv/app/`cat ~/.twitch_key` to stream an image (or video, or playlist) to an RTMP platform, e.g. Twitch
  • -filter:v "[in] crop=450:500:0:0 [crop]; [crop] lenscorrection=k2=0.1:k1=-0.4" to chain filters
  • -f x11grab -s 2560x1440 -i :1 for screen capturing on specified resolution and screen
  • add text -vf drawtext="text='Complimenti':"
  • -b:v 2600k to change video bitrate
  • -hide_banner to remove configuration build options
  • -filter:v "setpts=0.5*PTS" to double speed (halving the presentation timestamp of a frame)
  • using pause (to bring to the background) then fg to bring the process back to life and continue encoding
  • resolution
    • fixed: -vf scale=2048:1024
    • relative e.g. half: -vf scale=iw*.5:ih*.5
  • crop: -filter:v "crop=720:420:0:450" following the format "crop=out_w:out_h:x:y"
  • start and duration: -ss 5 -t 25, especially important to test without wasting time
    • -to 1:25 to use the ending time
    • note the -ss 0:1:59 format (to avoid using bc to calculate starting time)
  • remove audio: -an
  • remove video: ffmpeg -i input-video.mkv -vn -acodec copy opus
  • -y to confirm e.g. to replace existing file

To explore


My notes on Tools gather what I know or want to know. Consequently they are not and will never be complete references. For this, official manuals and online communities provide much better answers.