ffmpeg's encoder options for codec and quality (see start_recording).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in), | optional | :: | codec |
an ffmpeg encoder (default libx264) |
|
| integer, | intent(in), | optional | :: | quality |
the CRF (default 18; limited to 0 to 63) |
function encoder_options(codec, quality) result(args) character(len=*), intent(in), optional :: codec !! an ffmpeg encoder (default libx264) integer, intent(in), optional :: quality !! the CRF (default 18; limited to 0 to 63) character(len=:), allocatable :: args, c character(len=32) :: q c = 'libx264' if (present(codec)) c = trim(codec) write(q, '(i0)') 18 if (present(quality)) write(q, '(i0)') max(0, min(63, quality)) args = '-c:v '//c select case (c) case ('libx264') args = args//' -preset medium -crf '//trim(q)//' -pix_fmt yuv420p' case ('libx265') args = args//' -preset medium -crf '//trim(q)//' -pix_fmt yuv420p -tag:v hvc1' ! (hvc1: QuickTime) case ('libvpx-vp9') args = args//' -crf '//trim(q)//' -b:v 0 -pix_fmt yuv420p' end select end function encoder_options