It is currently 25 Jun 2017, 01:15



Correctly handling PsF Decklink input

Help to specific problems with your setup, or discussing CasparCG bugs

Moderators: Macey, Jonas Hummelstrand, didikunz

Correctly handling PsF Decklink input

Postby FlyOntheWall » 28 Nov 2016, 14:25

We work with a production company who hands video content over to us as HD-SDI 1080PsF25. We have set our Channel output to 1080p25 as this is what's required downstream.

It seems you cannot explicitly tell Caspar that the content is PsF. If you select 1080p as the input, no content appears. If you set the input to 1080i50, content does appear but it gets deinterlacing filters applied.

In lieu of a 'PsF input' option (I assume this is a limitation of the Decklink SDK rather than CCG), what would be the best way to achieve PsF input with Progressive output without automatic deinterlacing?

I believe the key may lie in ffmpeg filters and custom commands but I'm a bit stumped at this point.

Thanks
FlyOntheWall
 
Posts: 27
Joined: 16 Feb 2011, 17:28

Re: Correctly handling PsF Decklink input

Postby mcdikki » 28 Nov 2016, 14:51

Hi,

I think you'd have to set this in the blackmagic control panel and not in ccg. At least with outputs, I'm pretty sure it is like this.

For input, a ffmpeg filter may do the job too.

Cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

Re: Correctly handling PsF Decklink input

Postby FlyOntheWall » 01 Jan 2017, 21:24

Thanks mcdikki. You're quite right, with a progressive output you can indeed use the blackmagic control panel to manually select whether the SDI signal is P or PsF. If the output is PsF there is no option to make it progressive. Unfortunately there is no option at all to change the input signal before handing it over to the application.

Any other thoughts on this?

Just to recap:
    SDI signal is PsF
    Required output from CCG is Progressive SDI
    Blackmagic control panel correctly recognises input signal as PsF
    When setting up Decklink input in CCG, the only available options are Progressive or Interlaced
    Selecting Progressive results in no input signal
    Selecting Interlaced causes CCG to automatically apply deinterlacing filters (channel is Progressive)

It seems at this stage the best option is to tell CCG that the Decklink input is interlaced and then to disable the deinterlacing filters. If this is indeed the best option, I would really appreciate some help with the correct filter settings/custom commands.

Many thanks
FlyOntheWall
 
Posts: 27
Joined: 16 Feb 2011, 17:28

Re: Correctly handling PsF Decklink input

Postby didikunz » 01 Jan 2017, 22:09

PsF is a progressive video encoded as interlace. That means, that each progressive frame is encoded as two fields of an interlaced video. That's what you do, when you play a movie, where you play each frame of the movie into two fields of the interlaced video. So technically your signals are all interlaced. So you should process them as interlaced. I think if you set Caspars channel to 1080i no deinterlacing should take place and everything should work.
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests
User avatar
didikunz
 
Posts: 3477
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: Correctly handling PsF Decklink input

Postby FlyOntheWall » 11 Jan 2017, 15:24

Thanks Didi.

Technically what you are saying is correct except for one situation: what if I were to use some transitions within Caspar? If the channel is configured as 1080i and, for example, I were to swipe in an image from left to right, there could (should) be temporal difference between upper and lower fields of the interlaced signal. This would mean that my SDI input has gone in as PsF but what gets output is true interlaced, which would require deinterlacing further down the line.

As stated above, I need Caspar's output to be Progressive. The reason for this is I have no option to deinterlace it further downstream. And nor should I need to: if the 2 fields of a PsF frame are put together in a progressive frame, there is no temporal movement and therefore no need to deinterlace. What I need to do is make sure that Caspar isn't deinterlacing the '1080i' signal (which is actually PsF) unnecessarily when the Channel is set to Progressive.
FlyOntheWall
 
Posts: 27
Joined: 16 Feb 2011, 17:28

Re: Correctly handling PsF Decklink input

Postby didikunz » 11 Jan 2017, 16:59

That probably does not work. For Caspar a PsF signal is an interlaced signal. If you want to use it as progressive, you need to convert it to progressive first (or use a progreassive source).
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests
User avatar
didikunz
 
Posts: 3477
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: Correctly handling PsF Decklink input

Postby FlyOntheWall » 13 Jan 2017, 04:40

Setting the channel as Progressive and bringing in an interlaced SDI signal does work. The problem, when the 'i' is actually PsF, is that Caspar automatically applies deinterlacing filters (ffmpeg yadif filters, I believe). Is there really no way to turn those off? Not even through a custom commands or anything?

At the moment I have only attempted configuring SDI inputs through the official client. Is it possible/likely that the deinterlacing filter is coded into the client's command or is this deinterlacing logic hard-coded into Caspar itself?
FlyOntheWall
 
Posts: 27
Joined: 16 Feb 2011, 17:28

Re: Correctly handling PsF Decklink input

Postby hreinnbeck » 14 Jan 2017, 10:15

You could test:
Code: Select all
ADD 1-1 DECKLINK DEVICE 1 FORMAT 1080p2500 FILTER yadif=0:-1:1
hreinnbeck
 
Posts: 295
Joined: 04 Aug 2009, 06:31

Re: Correctly handling PsF Decklink input

Postby FlyOntheWall » 30 Jan 2017, 11:51

Brilliant, thanks for this. I will have some time today to give it a go.

I'm just wondering if there is any need to involve the yadif filter at all. If I were to tell caspar that the format of the incoming SDI signal was 1080i and the channel is set to Progressive, wouldn't Caspar simply 'flatten' the two fields into one frame? For an interlaced signal, this would have interlacing artefacts but for PsF, this is exactly what we want
FlyOntheWall
 
Posts: 27
Joined: 16 Feb 2011, 17:28

Re: Correctly handling PsF Decklink input

Postby didikunz » 30 Jan 2017, 19:14

FlyOntheWall wrote:Brilliant, thanks for this. I will have some time today to give it a go.

I'm just wondering if there is any need to involve the yadif filter at all. If I were to tell caspar that the format of the incoming SDI signal was 1080i and the channel is set to Progressive, wouldn't Caspar simply 'flatten' the two fields into one frame? For an interlaced signal, this would have interlacing artefacts but for PsF, this is exactly what we want


I think that's probably exactly what this yadif comand does.
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests
User avatar
didikunz
 
Posts: 3477
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: Correctly handling PsF Decklink input

Postby FlyOntheWall » 03 Feb 2017, 15:41

Thanks again for the help. I have done a huge amount of research on this and it seems that no amount of fiddling with yadif commands will help.

Here are the steps so far:

I created a 1080i50 sync test video. The vertical markers each represent 1 frame. There is a travelling bar between these markers which moves across the screen every 1 second. Here is a screen shot which shows the upper and lower fields merged into one frame. You can see there are two travelling bars. The first one, which lines up with the frame markers is on the odd number (upper) fields. The second one, between the frame markers, only appears on even number (lower) fields.
both-fields.jpg
test file
both-fields.jpg (70.18 KiB) Viewed 941 times

I rendered out the 1080i test video as 25p, which flattened the two fields onto one frame. I then played this file out using an playback device which can take a 25p file and output it on SDI as PsF. Here is a photo of the output on a SDI monitor:
IMG_20170202_155901.jpg
Progressive > PsF
IMG_20170202_155901.jpg (54.65 KiB) Viewed 941 times

The slow shutter speed of the camera captured 80ms of movement (4 fields / 2 frames).

I put this SDI source into a 25p Caspar channel (using the "Decklink Input" tool in the official client) and then output the channel as Decklink SDI:
IMG_20170202_162001.jpg
upper fields
IMG_20170202_162001.jpg (52.59 KiB) Viewed 941 times

As you can see, only the upper fields are showing.

I tried hreinnbeck's suggestion but the output was the same.

I had to make 2 tweaks to hreinnbeck's code:
1) ADD was replaced with PLAY. You can only put filters on a Decklink Producer (created with PLAY), not a consumer (created with ADD)
2) Format has to be 1080i in order to get any video content. PsF is technically much closer to interlaced than progressive

Here is the corrected code
Code: Select all
PLAY 1 DECKLINK 1 FORMAT 1080I5000 FILTER yadif=0:-1:1


I then tried every conceivable combination of settings in yadif. The only thing which made a visual difference was changing the field order, in which case Caspar would output the the even fields instead


In short, no yadif setting enables output of both fields into a progressive frame. And you can't turn off yadif; if you leave out the FILTER option, Caspar has logic hard-coded in to automatically deinterlace.

There are only 3 options I can see:
1) Ask BMD to explicitly support PsF formats in their SDK's (long shot). I assume this change in SDK would also then require some implementation in Caspar to handle the new format
2) Try to find an existing ffmpeg filter which will remove the interlaced flag from the incoming source and therefore, hopefully, stop Caspar from applying yadif automatically (I searched extensively and failed completely to find an appropriate filter)
3) Ask a kind Caspar dev to code a yadif command keyword to optionally remove yadif altogether. Such filter keywords already exist for deinterlace and deinterlace_bob. I would like to see one for no_deinterlace.

I have created a new thread in the Development section to request this.
FlyOntheWall
 
Posts: 27
Joined: 16 Feb 2011, 17:28

Re: Correctly handling PsF Decklink input

Postby FlyOntheWall » 19 Feb 2017, 09:29

Copied from this GitHub issue.

After further research I have realised that Caspar does support PsF but only if the SDI signal is correctly flagged. Unfortunately this is very rarely the case.

A true 1080PsF25 signal, flagged correctly, is detected by Decklink as PsF. This input can be added to a Progressive channel in Caspar.

PsF which is carried in a 1080i50 signal is detected by Decklink as 1080i50 and, when added to a Progressive channel, get's automatically deinterlaced.

The whole point of PsF is that Progressive content be put into an interleaved scan format and passed through (older) broadcast equipment which will handle it in the same way it would handle an interlaced signal. The resulting content though is still Progressive. In Europe, 1080i50 is still the broadcast standard and so there is a lot of 1080i50 kit out there. Unfortunately the large majority of this kit is reflagging the SDI signal as 1080i50. Even some modern, standard broadcast kit which is able to generate a PsF signal (such as the AJA Ki Pro) is flagging the signal as 1080i50, not 1080PsF25. Caspar has no ability to correctly handle this.

My feature request is either:

1. optionally remove the yadif filter when you know the input signal is not interlaced
2. respect the user's choice of FORMAT when provisioning a Decklink input. i.e. even if Decklink is seeing the signal as 1080i50, so that
Code: Select all
ADD 1 DECKLINK DEVICE 1 FORMAT 1080p2500
will instruct Caspar that the signal is not interlaced. Currently this scenario will result in no picture at all.


Thanks
FlyOntheWall
 
Posts: 27
Joined: 16 Feb 2011, 17:28


Return to Help & Support

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests