User Tools

Site Tools


Sidebar

tool:software:ffmpeg

FFmpeg

Use

Some examples I use.

Editing

Concatenation

The main thing I use FFmpeg for is just stitching videos together. I make a list of the files inside a text document, each line looks like this:—

file '[file location]'

—then point FFmpeg at that and give the command and it runs through them all. Nice and easy.

ffmpeg -f concat -safe 0 -i "inputfile.txt" -c copy "inputfile.ext"

※ Todo: use bash to generate the file list

Rotation

Rotate 90°.

ffmpeg -i inputfile.ext -vf "transpose=1" outputfile.ext

Trimming

You can pretty easily make a video file smaller. The only caveat is that if you don't want to re-encode you're limited by where keyframes are placed.

ffmpeg -i inputfile.ext -ss HH:MM:SS -to HH:MM:SS -c copy outputfile.ext
  • -ss is the point you want it to start
  • -to is the point you want it to end
  • -t is the length you want it to run from the start time
  • Instead of using the format HH:MM:SS you can just give a number of seconds.
    • You can also add milliseconds to either of those formats.
  • Leaving out the -ss or -to|t will use the file's existing start or end time.
  • If you leave out the -c copy it will re-encode the video

Lowering the file size

Slow, but compresses better:

-preset veryslow

Bitrate

Dimensions

Scales 50%

ffmpeg -i "inputfile.ext" -vf "scale=iw/2:ih/2" "outputfile.ext"

Scales to set pixel dimensions (replace 'width' and 'height'):

ffmpeg -i "inputfile.ext" -vf scale=width:height "outputfile".ext

See Also

tool/software/ffmpeg.txt · Last modified: 2020/04/12 11:01 by rjt