Skip to contentSkip to conversation

Grabbing 4:3 and 16:9

DISCUSSION Michel Bardiaux 4 participants 12 messages Feb 26, 2008 – Feb 28, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Our current systems use Hauppauge WinTV, dmesg as follows:

bttv1: Bt878 (rev 17) at 01:08.0, irq: 17, latency: 64, mmio: 0xf8001000
bttv1: detected: Hauppauge WinTV [card=10], PCI subsystem ID is 0070:13eb
bttv1: using: Hauppauge (bt878) [card=10,autodetected]
bttv1: Hauppauge/Voodoo msp34xx: reset line init [5]
tuner: chip found @ 0xc2
i2c-core.o: client [(tuner unset)] registered to adapter [bt848 #1](pos. 0). i2c-core.o: adapter bt848 #1 registered as adapter 1.
bttv1: Hauppauge eeprom: model=44806, tuner=Temic 4046FM5 (22), radio=no
bttv1: using tuner=22
tuner: type set to 22 (Temic PAL/SECAM multi (4046 FM5))
bttv1: i2c: checking for MSP34xx @ 0x80... not found
bttv1: i2c: checking for TDA9875 @ 0xb0... not found
bttv1: i2c: checking for TDA7432 @ 0x8a... not found
bttv1: PLL: 28636363 => 35468950 .. ok
bttv1: registered device video1
bttv1: registered device vbi1

Here in Belgium the broadcasts is sometimes 4:3, sometimes 16:9. Currently, the card goes automatically in letterbox mode when it receives 16:9, and our software captures the 4:3 frames at size 704x576. What I would like to do is to capture the 16:9 broadcast without letterboxing (and the 4:3 without horizontal padding!) simply by changing the pixel aspect ratio stated in our MPEG files. And since we do 24/7 captures, this has to be done on-the-fly, no reinitialization of the cards or the software allowed. Which leads to 2 questions:

1. How do I sense from the software that the mode is currently 16:9 or 4:3?

2. How do I setup the bttv so that it does variable anamorphosis instead of letterboxing? If that is at all possible of course...

I *am* googling for all that, but "16/9" is one of those queries on which search engines are really really bad, like "date" or "thread" :-(

TIA,

Signature · 15 lines
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:[email protected]

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
#1 lore raw
Quoted 3 lines · Michel Bardiaux

Here in Belgium the broadcasts is sometimes 4:3, sometimes 16:9. Currently, the card goes automatically in letterbox mode when it receives 16:9, and our software captures the 4:3 frames at size 704x576.

The card does not go into letterbox mode. It's the broadcaster who squeezes the 16:9 picture into 432 lines surrounded by 144 black lines. Some fill the chroma part of the black lines with a PALPlus helper signal. Although the algorithms to decode PALPlus are well documented in ETS 300 731, I have never seen a software implementation.

Quoted 1 line

1. How do I sense from the software that the mode is currently 16:9 or 4:3?

Some broadcasters use WSS to signal 16:9.
In Germany some signal 4:3 even on 16:9 shows.
Read ETSI EN 300 294.

Quoted 2 lines

2. How do I setup the bttv so that it does variable anamorphosis instead of letterboxing? If that is at all possible of course...

You can't. Bttv can't stretch vertically.

Daniel

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#2 lore raw
Quoted 4 lines · Daniel Glöckner
Quoted 2 lines

2. How do I setup the bttv so that it does variable anamorphosis instead of letterboxing? If that is at all possible of course...

You can't. Bttv can't stretch vertically.

Use an OpenGL texture is probably the easiest for that kind of effect.

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#3 lore raw
Quoted 5 lines · Alan Cox
Quoted 2 lines · Daniel Glöckner
Quoted 1 line

2. How do I setup the bttv so that it does variable anamorphosis instead of letterboxing? If that is at all possible of course...

You can't. Bttv can't stretch vertically.

Use an OpenGL texture is probably the easiest for that kind of effect.

I didnt want the stretch per se, but to avoid losing info because of the letterboxing (the final project involves reading small print from film credits on the captured MPEGs). But Daniel wrote that the 16:9 analog broadcasts have only 432 lines, so the info is not there in the first place. So that effect isnt an option for me. But thanks anyway.

Signature · 15 lines
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:[email protected]

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
#4 lore raw
Quoted 3 lines · Michel Bardiaux

credits on the captured MPEGs). But Daniel wrote that the 16:9 analog broadcasts have only 432 lines, so the info is not there in the first place. So that effect isnt an option for me. But thanks anyway.

Per frame.... if you sample as it scrolls and line up the title tops I suspect most of the time you can get more samples as the title moves.

Just a crazy idea

Alan

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#5 lore raw
Quoted 6 lines · Alan Cox
Quoted 1 line · Michel Bardiaux

credits on the captured MPEGs). But Daniel wrote that the 16:9 analog broadcasts have only 432 lines, so the info is not there in the first place. So that effect isnt an option for me. But thanks anyway.

Per frame.... if you sample as it scrolls and line up the title tops I suspect most of the time you can get more samples as the title moves.

Not crazy, I am *also* considering various image enhancement techniques, I just want to start from the best possible capture in the first place. That means capturing at 768(or more?) wide instead of 704; in YUV422P instead of YUV420P; avoiding reizing, and use better resizing algorithms. And capturing at 576 instead of 432 vertically would help too.

As I find more relevant pages, my question has now become: given a 768x576 capture (by a BT878) can I check whether the PALPLUS is there? No use trying to implement the decoder in software if the signal simply isnt there!

Signature · 15 lines
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:[email protected]

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
#6 lore raw
Quoted 11 lines · Michel Bardiaux
Quoted 6 lines · Alan Cox
Quoted 1 line · Michel Bardiaux

credits on the captured MPEGs). But Daniel wrote that the 16:9 analog broadcasts have only 432 lines, so the info is not there in the first place. So that effect isnt an option for me. But thanks anyway.

Per frame.... if you sample as it scrolls and line up the title tops I suspect most of the time you can get more samples as the title moves.

Not crazy, I am *also* considering various image enhancement techniques, I just want to start from the best possible capture in the first place. That means capturing at 768(or more?) wide instead of 704; in YUV422P instead of YUV420P; avoiding reizing, and use better resizing algorithms. And capturing at 576 instead of 432 vertically would help too.

As I find more relevant pages, my question has now become: given a 768x576 capture (by a BT878) can I check whether the PALPLUS is there? No use trying to implement the decoder in software if the signal simply isnt there!

Explained here:

http://en.wikipedia.org/wiki/Widescreen_signaling

Now how to get at that info? zvbi/libzvbi?

Signature · 15 lines
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:[email protected]

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
#7 lore raw
In reply to Michel Bardiaux
Quoted 2 lines · Michel Bardiaux

As I find more relevant pages, my question has now become: given a 768x576 capture (by a BT878) can I check whether the PALPLUS is there?

I don't know and the manual doesn't seem to answer that. You can certainly fish out stuff like teletext info in software that way (and US closed caption/analog ip over tv)

Quoted 2 lines

No use trying to implement the decoder in software if the signal simply isnt there!

Agreed

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#8 lore raw
In reply to Michel Bardiaux
Quoted 2 lines · Michel Bardiaux

As I find more relevant pages, my question has now become: given a 768x576 capture (by a BT878) can I check whether the PALPLUS is there?

WSS is in the first line of the 576 line picture.
One of the bits says if there is PALplus.

WSS standard:
http://webapp.etsi.org/WorkProgram/Report_WorkItem.asp?WKI_ID=16170

PALplus standard:
http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=3850

You can use libzvbi to decode the information:

vbi_raw_decoder_init(&vbi_rd);
vbi_rd.scanning = 625;
vbi_rd.sampling_format = VBI_PIXFMT_YUYV; vbi_rd.sampling_rate = 13500000.0*width/702; vbi_rd.offset = 186*width/924; vbi_rd.bytes_per_line = width*2;
vbi_rd.start[0] = 23;
vbi_rd.count[0] = 1;
vbi_rd.start[1] = 0;
vbi_rd.count[1] = 0;
vbi_rd.interlaced = 0;
vbi_rd.synchronous = 1; vbi_raw_decoder_add_services(&vbi_rd,VBI_SLICED_WSS_625,0); while(framebuf=grabpicture()) {
vbi_sliced sliced;
if(vbi_raw_decode (&vbi_rd, framebuf, &sliced)

     && sliced.id==VBI_SLICED_WSS_625)
  {
    wss=(sliced.data[1]<<8)+sliced.data[0];
    if(wss&64) {
      /* There is PALplus
      
         I have seen the decoder generate false positives.
	 Check aspect ratio bits for >=16:9 and their odd parity bit
	 to be shure. */
    }

}
}

Daniel

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#9 lore raw
In reply to Daniel Glöckner
Quoted 5 lines · Daniel Glöckner
Quoted 1 line · Michel Bardiaux

Here in Belgium the broadcasts is sometimes 4:3, sometimes 16:9. Currently, the card goes automatically in letterbox mode when it receives 16:9, and our software captures the 4:3 frames at size 704x576.

The card does not go into letterbox mode. It's the broadcaster who squeezes the 16:9 picture into 432 lines surrounded by 144 black lines.

Let me rephrase to check I understood correctly. In analog TV, there are no anamorphic broadcasts. When the WSS (accessible via /dev/vbi, right?) states 16:9, then a 16:9 (sic) TV switches to a mode where it crops 2x72 lines, then stretches the image both horizontally and vertically to fill the whole 16:9 screen. Am I correct?

I must admit I have difficulty believing that. Could you give me the URLs of sites explaining all that?

Quoted 15 lines

Some fill the chroma part of the black lines with a PALPlus helper signal. Although the algorithms to decode PALPlus are well documented in ETS 300 731, I have never seen a software implementation.

Quoted 1 line

1. How do I sense from the software that the mode is currently 16:9 or 4:3?

Some broadcasters use WSS to signal 16:9.
In Germany some signal 4:3 even on 16:9 shows.
Read ETSI EN 300 294.

Quoted 1 line

2. How do I setup the bttv so that it does variable anamorphosis instead of letterboxing? If that is at all possible of course...

You can't. Bttv can't stretch vertically.

Daniel

Signature · 15 lines
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:[email protected]

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
#10 lore raw
Quoted 11 lines · On Tuesday 26 February 2008 17:55:53 Michel Bardiaux wrote:
Quoted 9 lines · Daniel Glöckner
Quoted 4 lines · Michel Bardiaux

Here in Belgium the broadcasts is sometimes 4:3, sometimes 16:9. Currently, the card goes automatically in letterbox mode when it receives 16:9, and our software captures the 4:3 frames at size 704x576.

The card does not go into letterbox mode. It's the broadcaster who squeezes the 16:9 picture into 432 lines surrounded by 144 black lines.

Quoted 5 lines

Let me rephrase to check I understood correctly. In analog TV, there are no anamorphic broadcasts. When the WSS (accessible via /dev/vbi, right?) states 16:9, then a 16:9 (sic) TV switches to a mode where it crops 2x72 lines, then stretches the image both horizontally and vertically to fill the whole 16:9 screen. Am I correct?

Yes, this is really true. Remember that the broadcast should still work when received by an old 4:3 TV. The only way to ensure that it still looks OK is to letterbox it. As mentioned before PALPlus allows the broadcaster to encode additional information encoded in the black bars to improve the image quality (never looked into that, though).

BTW, WSS does allow anamorphic broadcasts, although it is very rare. I saw it once, but I've always suspected that someone made a configuration error because anamorphic broadcasts look squashed on normal 4:3 TVs.

Quoted 2 lines

I must admit I have difficulty believing that. Could you give me the URLs of sites explaining all that?

http://en.wikipedia.org/wiki/Widescreen_signaling

http://en.wikipedia.org/wiki/PALPlus

Regards,

Hans

Quoted 13 lines
Quoted 13 lines

Some fill the chroma part of the black lines with a PALPlus helper signal. Although the algorithms to decode PALPlus are well documented in ETS 300 731, I have never seen a software implementation.

Quoted 2 lines

1. How do I sense from the software that the mode is currently 16:9 or 4:3?

Some broadcasters use WSS to signal 16:9.
In Germany some signal 4:3 even on 16:9 shows.
Read ETSI EN 300 294.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

2. How do I setup the bttv so that it does variable anamorphosis instead of letterboxing? If that is at all possible of course...

You can't. Bttv can't stretch vertically.

Daniel

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#11 lore raw
Quoted 18 lines · Hans Verkuil
Quoted 6 lines · On Tuesday 26 February 2008 17:55:53 Michel Bardiaux wrote:
Quoted 5 lines · Daniel Glöckner
Quoted 4 lines · Michel Bardiaux

Here in Belgium the broadcasts is sometimes 4:3, sometimes 16:9. Currently, the card goes automatically in letterbox mode when it receives 16:9, and our software captures the 4:3 frames at size 704x576.

Quoted 8 lines
Quoted 3 lines

The card does not go into letterbox mode. It's the broadcaster who squeezes the 16:9 picture into 432 lines surrounded by 144 black lines.

Let me rephrase to check I understood correctly. In analog TV, there are no anamorphic broadcasts. When the WSS (accessible via /dev/vbi, right?) states 16:9, then a 16:9 (sic) TV switches to a mode where it crops 2x72 lines, then stretches the image both horizontally and vertically to fill the whole 16:9 screen. Am I correct?

Yes, this is really true. Remember that the broadcast should still work when received by an old 4:3 TV. The only way to ensure that it still looks OK is to letterbox it. As mentioned before PALPlus allows the broadcaster to encode additional information encoded in the black bars to improve the image quality (never looked into that, though).

Quoted 8 lines

BTW, WSS does allow anamorphic broadcasts, although it is very rare. I saw it once, but I've always suspected that someone made a configuration error because anamorphic broadcasts look squashed on normal 4:3 TVs.

Quoted 2 lines

I must admit I have difficulty believing that. Could you give me the URLs of sites explaining all that?

http://en.wikipedia.org/wiki/Widescreen_signaling

http://en.wikipedia.org/wiki/PALPlus

To summarize: I know now that PALPLUS is indeed widely used in Belgium for analog TV (via cable usually); that I can detect it from WSS using libzvbi.

But PALPLUS seems to be being deprecated; e.g. the wikipedia pages explain it was, but no longer is, used in the Netherlands. Just like analog-TV itself. So, unless I can find (any suggestions?) a ready-made open-source software decoder for PALPLUS, it is unlikely we will attempt to extract that info. Much better to work on digital-TV!

Thanks again to all who helped.

Quoted 21 lines

Regards,

Hans

Quoted 16 lines
Quoted 16 lines

Some fill the chroma part of the black lines with a PALPlus helper signal. Although the algorithms to decode PALPlus are well documented in ETS 300 731, I have never seen a software implementation.

Quoted 2 lines

1. How do I sense from the software that the mode is currently 16:9 or 4:3?

Some broadcasters use WSS to signal 16:9.
In Germany some signal 4:3 even on 16:9 shows.
Read ETSI EN 300 294.

Quoted 2 lines

2. How do I setup the bttv so that it does variable anamorphosis instead of letterboxing? If that is at all possible of course...

You can't. Bttv can't stretch vertically.

Daniel

Signature · 15 lines
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:[email protected]

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list