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
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:
-crf 36
for low quality video-crf 28
for medium quality videoTo 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
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