FFmpeg: Difference between revisions

677 bytes added ,  15 July 2020
Line 289: Line 289:
==My Preferences==
==My Preferences==
My preferences for encoding video
My preferences for encoding video
;H264
I mostly use H264 when working on projects for compatibility purposes. Here I typically don't need the smallest file size or best quality, prioritizing encoding speed.
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
!#/bin/bash
!#/bin/bash


ffmpeg -i $1 -c:v libx265 -crf 28 -preset medium -c:a libopus -b:a 128K $2
ffmpeg -i $1 -c:v libx264 -crf 28 -preset medium -pix_fmt yuv420p -c:a libfdk_aac -b:a 128K $2
</syntaxhighlight>
 
;Notes
* MP4 is ok
 
; H265/HEVC
H264/HEVC is used for archival purposes to minimize the file size and maximize the quality.
<syntaxhighlight lang="bash">
!#/bin/bash
 
ffmpeg -i $1 -c:v libx265 -crf 28 -preset slower -pix_fmt yuv444p10le -c:a libopus -b:a 128K $2
</syntaxhighlight>
</syntaxhighlight>


;Notes
;Notes
* You need to output to a MKV file
* You need to output to a MKV file
* The pixel format <code>yuv444p10le</code> is 10 bit color without chroma subsampling. If your source is lower, you can use <code>yuv420p</code> instead for 8-bit color and 4:2:0 chroma subsampling.