Skip to content

Instantly share code, notes, and snippets.

@psyburr
Last active June 30, 2024 04:56
Show Gist options
  • Save psyburr/10fa63d954f774103be26584fd8c7cfd to your computer and use it in GitHub Desktop.
Save psyburr/10fa63d954f774103be26584fd8c7cfd to your computer and use it in GitHub Desktop.
ffmpeg options/examples difficult to remember
  • Increase/decrease audio tempo/speed this is represented as a percentage. ie: 1.5=1½× normal speed

atempo={0.5-100}

  • Remove logo in bottom right-hand corner coordinates are measuring from top left corner of delogo region set

delogo=x=620:y=495:w=330:h=40

  • Fade in/out video (fade out is dependent on number of frames)

fade=in:0:500,fade=out:21500:400

  • Loop a stream N number of times (or infinitely if '-1')

-stream_loop -1 -i INPUT.EXT this must go BEFORE the stream you want to loop

  • Clip a video into segments quickly (bsf can be applied, but results are unreliable)

-i INPUT.EXT -segment_time <UNIX time, 00:00:00.00 or 00s> -f segment -reset_timestamps 1 OUTPUT_%03d.EXT

  • Fade in/out audio (these durations are in seconds, not in frames like video)

-af afade=t=in:ss=<start-time>:d=<duration>,afade=t=out:st=<fade-start>:d=<fade-duration>

  • Record monitor source audio in lossless format

-f pulse -i default OUTPUT.WAV -i pulse -i default OUTPUT.OPUS for compressed

  • Flip a video horizontally

-i INPUT.EXT -vf "hflip" OUTPUT.EXT

the following adds the complexity of only flipping from 10s-20s at beginning of video; can be useful for avoiding contentid scans

-i INPUT.EXT -vf "trim=start=10:end=20,hflip[flipped];[0:v][flipped]concat" -c:a copy OUTPUT.EXT


Honorable Mentions

  • count the number of video frames in a file quickly

mediainfo --Output="Video;%FrameCount%" INPUT.EXT

  • Wipe all metadata from a media file. Use as an option to other ffmpeg command or by itself. the following works unreliably to wipe all metadata, however; you may handle each field with its its own -metadata FIELD='' option on the command line for a surefire wipe

-map_metadata 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment