📖
Internal Wiki
  • My Knowledge Wiki 🌿
  • ai
    • Prompts
  • beautiful
    • Beautiful websites
  • blog
    • best blog times
    • Good Blog Posts
  • career
    • First 90 Days
    • income streams
    • interview questions
    • Misc
    • Negotiation
    • On Call
  • coding
    • AWS
    • Bash
    • Browser Extensions
    • Cloudflare
    • CopyQ
    • Docker
    • Express
    • Filebase
    • Firebase
    • Git Commit Message Standards
    • GIT
    • Github Actions
    • html
    • TypeScript / JavaScript
    • JavaScript / TypeScript
    • NodeJS
    • npm
    • npx
    • Service Workers
    • Tunnel
    • Vite
    • Wrangler
    • New Angular Project
    • snippets
      • angular
        • Performance Tracking
        • Web3 in Angular Projects
      • nodejs
        • Dynamically load classes
  • communities
    • Communities
  • devex
    • Browser Experience
  • github
    • CI/CD
  • infra
    • Kubernetes
    • Windows
  • links
    • AI
    • Awesome lists
    • Beautify Code
    • cli
    • Code Snippet Images
    • Coding
    • Courses
    • Creators
    • Crypto
    • CSS
    • Design
    • Diagrams
    • Domains
    • events
    • Fonts
    • Funding
    • gifs
    • Github
    • I18N
    • Icons
    • Identity
    • Image (drawing, manipulation, ...)
    • All around infra (hosting, serverless, ...)
    • JSON utils
    • Libraries and Tools
    • Markdown
    • Machine Learning
    • Monetization
    • Music
    • No Code Tools
    • Node and NPM (and other package managers)
    • nostr
    • Other
    • Pitch
    • react
    • Resources
    • Resumes
    • SaaS
    • scraping
    • Screenshots
    • Search
    • SEO
    • Services
    • Social Media Engagement
    • Popular Stacks
    • Storage
    • Terms
    • Text to speech
    • Text Effects
    • Tutorials
    • video
    • Nice wasm libs
    • Writing
    • YouTube
  • linux-commands
    • convert
    • ffmpeg
    • General
    • Screen
  • Quotes
    • Twitter Quotes
  • reddit
    • Side projects
  • shops
    • Dog Stuff
    • wir-machen-druck
  • watch
    • Youtube Videos
  • wine
    • Wine
  • learning
    • house
      • Heating Energy Act
    • sbf
      • SBF Navi
      • SBF Praxis
      • SBF
Powered by GitBook
On this page
  • Image Manipulation
  • Video Manipulation
  • Video to Gif conversion
  • webm to mp4 and speed up
  • script
  1. linux-commands

ffmpeg

PreviousconvertNextGeneral

Last updated 2 years ago

Nice guides:

Image Manipulation

# resize
convert *.jpg -resize 600x600 converted.jpg # resize

# jpg to webp
convert *.jpg -define webp:lossless=false converted.webp # convert to webp

Video Manipulation

# webm to mp4
ffmpeg -i ${in.webm} -crf 10 ${out.mp4}

# webm to mov
ffmpeg -i ${in.webm} -c copy -f mov ${out.mov}

# webm to gif
ffmpeg -i ${in.webm} -pix_fmt rgb8 ${out.gif}

Video to Gif conversion

Script:

#!/bin/sh

# example:
# ./gifenc.sh input.mov output.gif 720 10
# https://superuser.com/a/939527

palette="/tmp/palette.png"

filters="fps=$4,scale=$3:-1:flags=lanczos"

ffmpeg -v warning -i "$1" -vf "$filters,palettegen" -y "$palette"
ffmpeg -v warning -i "$1" -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y "$2"

webm to mp4 and speed up

# convert to mp4
ffmpeg -i complete-process-send-presentation-content.webm -preset ultrafast complete-process-send-presentation-content.mp4
ffmpeg -i complete-process-send-presentation-content.webm -movflags faststart complete-process-send-presentation-content.mp4

# speed up
ffmpeg -i complete-process-send-presentation-content.mp4 -preset ultrafast -filter:v "setpts=0.1*PTS" complete-process-send-presentation-content-x10.mp4
ffmpeg -i complete-process-send-presentation-content.mp4 -preset ultrafast -filter:v "setpts=0.05*PTS" complete-process-send-presentation-content-x20.mp4

script

#!/bin/sh

echo "converting to mp4"
ffmpeg -i $1.webm -preset ultrafast $1.mp4

echo "increase speed"
ffmpeg -i $1.mp4 -preset ultrafast -filter:v "setpts=PTS/$2" $1-x$2.mp4
https://ffmpeg.guide/