Skip to content

FFMPEG Recipes

Video cut

ffmpeg -i "${INPUT_VIDEO}" -ss "${START_CUT}" -to "${END_CUT}" -c:v copy -c:a copy "${OUTPUT_VIDEO}"

Video transpose

# Adds a metadata that indicates the player to transpose the video
ffmpeg -i "${INPUT_VIDEO}" -metadata:s:v rotate="-90" -codec copy "${OUTPUT_VIDEO}"

Fast-forward

ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" -r 30 output.mp4 -t DURATION
  • PTS: Presentation Timestamps.
  • t: Duration in seconds of the output.

Video crop

ffmpeg -i INPUT -vf "crop=w:h:x:y" -c:v h264 -crf 20 OUTPUT