[FFmpeg-devel] [PATCH 2/4] avdevice/decklink_enc: add support to specify field order

Matthias Hunstock atze at fem.tu-ilmenau.de
Fri Feb 24 11:42:36 EET 2017

Am 24.02.2017 um 00:32 schrieb Marton Balint:
> On Thu, 23 Feb 2017, Matthias Hunstock wrote:
>> Am 23.02.2017 um 17:24 schrieb Marton Balint:
>>>> The "@mode" syntax does not work for output devices. Let me add a
>>>> patch,
>>>> I will send it tonight.
>>> Please don't. The @mode syntax is insane. You need a different @mode for
>>> different hardware to get the same output format. @mode may even be
>>> different across driver versions.
>> I know... the numbers are really a mess.
>> What about supporting the mode strings? They are constant:
>> bmdModeHD1080i50 = /* 'Hi50' */ 0x48693530
>> At least for capture this is IMO a benefit:
>> ffmpeg -f decklink -i 'DeckLink Duo at Hi50'
>> For playout... well if the automatic detection works and interlaced flag
>> is always correct, fps is always correct (30 vs 29.97)... to be honest:
>> if I'd do a setup, I'd sleep better with an explicit mode. But yeah, not
>> those numbers.
> Specifying the mode based on the decklink fourcc makes more sense.
> On the other hand, for output, you'd still have to check if the stream
> parameters are correct and if they are corresponding to the wanted mode.
> So if the user specify the mode with a decklink mode fourcc, you could
> only do a check like this (with &&):
>         if ((bmd_width == width &&
>              bmd_height == height &&
>              !av_cmp_q(mode_tb, target_tb) &&
>              field_order_eq(field_order, bmd_field_dominance) &&
>              mode == bmd_mode) || i == num) {

This disallows "hacks" like doing interlaced playout of progressive
content or playout 30 fps with 29.97fps.

Maybe it should just check widht and height for a given mode? Like:

         if ((bmd_width == width &&
              bmd_height == height &&
              mode == bmd_mode)
              (!mode &&
              !av_cmp_q(mode_tb, target_tb) &&
              bmd_width == width &&
              bmd_height == height &&
              field_order_eq(field_order, bmd_field_dominance))
              i == num /* deprecated */) {

(ORs seperated for readability)

Or would you suggest that a user forces such situation e.g. with -vf
setfields or -r ?

> For input, using a decklink fourcc to specify a mode would be definitely
> useful.
> However, I don't like the @anything part in the device name. If you add
> this feature, I'd very much prefer a separate option of the device,
> 'format' maybe. I'd even deprecate @mode in the device name later.


For the time being, I'd like to see your patches pushed since they
improve the situation and the patchset does lots of other things.


More information about the ffmpeg-devel mailing list