Compressing Video by Setting Bitrate

1
ffmpeg -i input.mp4 -c:v libx264 -b:v 1000k -b:a 192k output.mp4
  • -i: Input file
  • -c:v: Video codec
  • -b:v: Video bitrate
  • -b:a: Audio bitrate
  • output.mp4: Output file

Copy Audio Or Video Streams

1
ffmpeg -i input.mp4 -c:v copy -c:a copy output.mkv
  • -i: Input file
  • -c:v copy: Copy video codec
  • -c:a copy: Copy audio codec
  • output.mkv: Output file

Copy Audio out of a Video File

1
ffmpeg -i input.mp4 -vn -acodec copy output.aac
  • -i: Input file
  • -vn: Disable video
  • -acodec copy: Copy audio codec
  • output.aac: Output file

Merge Audio and Video Files

1
ffmpeg -i input.mp4 -i input.aac -c copy output.mkv
  • -i input.mp4: Input video file
  • -i input.aac: Input audio file
  • -c: Copy
  • output.mkv: Output file

Cut Video

1
ffmpeg -i input.mp4 -ss 00:00:00 -t 00:00:10 -c copy output.mp4
  • -i: Input file
  • -ss: Start time
  • -t: Duration
  • -c: Copy
  • output.mp4: Output file

Merge Files in Directory

1
ffmpeg -f concat -safe 0 -i <(for f in *.mp4; do echo "file '$f'"; done) -c copy output.mp4
  • -f: File format
  • -safe: Safe mode
  • -i: Input file
  • -c: Copy
  • output.mp4: Output file
  • *.mp4: Files in directory
  • -i <(for f in *.mp4; do echo "file '$f'"; done): Command to generate input file
  • -c copy: Command to copy
  • output.mp4: Output file