cs:ffmpeg
Return to Home page
If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it
You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/cs/ffmpeg
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:
-crf 36
for low quality video-crf 28
for medium quality video
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] skenz.it
You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/cs/ffmpeg
/web/htdocs/www.skenz.it/home/data/pages/cs/ffmpeg.txt · Last modified: 2024/06/12 22:31 by zioskenz