User Tools

Site Tools

Return to Home page


ffmpeg is a shell tool that is useful to perform many operations on video files like concatenation, conversion or compression


You must edit a file with the list of video you want to concatenate like the following for the concatenation of video 1.mp4, 2.mp4, and 3.mp4.

file '1.mp4'
file '2.mp4'
file '3.mp4'
ffmpeg -f concat -safe 0 -i list.txt -c copy out.mp4


Method 1

Convert the video with the new libx265 codec. Lower values of crf increase the bitrate:

ffmpeg -i in.mp4 -vcodec libx265 -crf 28 out.mp4

For instance, starting with a video in.mp4 with dimension 92 MB, in a home made experiment it was reduced to:

  • 23MB with -crf 32
  • 15MB with -crf 28
  • 11MB with -crf 24
  • 9.4MB with -crf 20

Method 2

To have a fixed bitrate for streaming, for instance 0.5 Mbps for video and 128 kbps for audio:

ffmpeg -i in.mp4 -c:v libx265 -b:v 0.5M -c:a aac -b:a 128k out.mp4

Sample rate

Change the sample rate of the audio track of an mp4 file, for instance from an input video sampled at 44100 Hz (in.mp4) to an output video sampled at 48000 Hz (out.mp4)

ffmpeg -f concat -safe 0 -i list.txt -c copy out.mp4

If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at]

You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url:
/web/htdocs/ · Last modified: 2021/01/05 23:13 by zioskenz