| Both sides previous revision Previous revision Next revision | Previous revision |
| en:tools:linux:ffmpeg [2023/09/30 13:43] – crunchyslime | en:tools:linux:ffmpeg [2024/01/26 14:28] (current) – [Conversion to x.265] crunchyslime |
|---|
| ===== ffmpeg toolbox ===== | ===== ffmpeg toolbox ===== |
| //⚠ This page probably uses CLI tools referenced [[en:tools:linux:misc-tools|here]]// | //⚠ This page probably uses CLI tools referenced [[en:tools:linux:misc-tools|here]]// |
| | * [[man>ffmpeg]] |
| | * [[man>parallel]] |
| |
| ==== Davinci Resolve ==== | ==== Davinci Resolve ==== |
| In order to gain space on warez, the ideal is to convert the ''x264'' encoded movies to the ''x265'' allowing for size reduction up to a factor of 10! | In order to gain space on warez, the ideal is to convert the ''x264'' encoded movies to the ''x265'' allowing for size reduction up to a factor of 10! |
| The ''-crf 26'' option defines the compression, with a value of ''0'' it is lossless, up to ''51'' the worst. The value ''26'' corresponds to the usual compression level of x264 media and allows therefore a good gain of space with minimal loss of quality. | The ''-crf 26'' option defines the compression, with a value of ''0'' it is lossless, up to ''51'' the worst. The value ''26'' corresponds to the usual compression level of x264 media and allows therefore a good gain of space with minimal loss of quality. |
| the pixel format defined by ''format=yuv420p'' (8bits) can be replaced by ''format=yuv420p10le'' (10bits) for compatible media at the cost of space advantage. (to find the pixel format of the original media: ''ffmpeg -i myfile.mkv'' | the pixel format defined by ''format=yuv420p'' (8bits) can be replaced by ''format=yuv420p10le'' (10bits) for compatible media at the cost of space advantage. (to find the pixel format of the original media: ''ffprobe -i myfile.mkv'' |
| [[https://trac.ffmpeg.org/wiki/Encode/H.264|ffmpeg documentation]] | [[https://trac.ffmpeg.org/wiki/Encode/H.264|ffmpeg documentation]] |
| <code>for i in *.mcv; do time ffmpeg -i "$i" -map 0 -c:v libx265 -crf 26 -vf format=yuv420p -c:a copy "$i_265.mkv"; done</code> | <code>find . -type f -name "*mkv" -print0 | parallel -0 --eta ffmpeg -loglevel 0 -i {} -map 0 -c:v libx265 -crf 26 -vf format=yuv420p -c:a copy {.}-x265.mkv</code> |
| ==== Reduce the size of MP3s ==== | ==== Reduce the size of MP3s ==== |
| Command to reduce the size of a whole tree of ''.mp3'' files to use an ancestral mp3 player with only 256MB of internal memory: | Command to reduce the size of a whole tree of ''.mp3'' files to use an ancestral mp3 player with only 256MB of internal memory: |
| <code>find -type f -name "*.mp3" -o -name "*.wav" -print0 | parallel -0 --eta ffmpeg -loglevel 0 -i {} -vn -ac 2 -b:a 96k {.}-smol.mp3</code> | <code>find -type f -name "*.mp3" -o -name "*.wav" -print0 | parallel -0 --eta ffmpeg -loglevel 0 -i {} -vn -ac 2 -b:a 96k {.}-smol.mp3</code> |