Table of Contents

ffmpeg

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

Concatenation

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.

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

Compression

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

In general, I use:

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