Wrong aspect for some 4:3 live TV since Leia

Since the update to Leia I’ve found some 4:3 broadcasts are horizontally compressed, into a kind of portrait letterbox view or 3:4. It’s bad news for some proper retro tv shows on Forces TV (UK DVB)!

  1. I’m streaming from an RPi2 running TVHeadend.
  2. The problem reproduced if I play back a recording of the programme.
  3. Normal aspect display is restored if I disable “hardware acceleration - amcodec”.
  4. Screenshot captures display normally when opened on another computer.
  5. A clean Krypton install and upgrade to Leia did it again.

Debug logs are here.

Mediainfo taken from a short recording:

General
ID : 45056 (0xB000)
Complete name : UFO
Format : MPEG-TS
File size : 9.10 MiB
Duration : 45 s 150 ms
Overall bit rate mode : Variable
Overall bit rate : 1 682 kb/s

Video
ID : 2311 (0x907)
Menu ID : 45344 (0xB120)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : 27
Duration : 43 s 680 ms
Width : 544 pixels
Height : 576 pixels
Display aspect ratio : 1.85:1
Frame rate : 25.000 FPS
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : MBAFF
Scan type, store method : Interleaved fields
Scan order : Top Field First
Color range : Limited
Color primaries : BT.601 PAL
Transfer characteristics : BT.470 System B, BT.470 System G
Matrix coefficients : BT.601

Many thanks in advance,

This has been fixed. I think you can test it from the staging repo, not sure whether @sam_nazarko has built it though.

Should have posted sooner! That’ll teach me.
If the matter is in hand then I’ll wait and see what the next update brings.

Many thanks for the swift response.

Yep, fixes have been built.

Cosmic.
Good work team!

Were the fixes meant to be in the June update?

The problem persists post update/reboot. Other changes like my Hyperion fix are evident and uname -r is:

3.14.29-150-osmc

I’ve just come back to find various aspect ratio issues with whitelisting.

576p is whitelisted now.

A Touch Of Frost is 4:3 but displays stretched 16:9
Marple S6 is 16:9 but displays something like 2.35:1 in a 16:9 frame, so black bars above and below.

Something very wrong here :smiley:

All was fine in the previous beta with no whitelisting enabled.

A Touch Of Frost:

General
Unique ID                                : 82307715534158645344763400894747432970 (0x3DEBE3AFBA29B32002EC11189622D80A)
Complete name                            : U:\tv series\a touch of frost\season 01\a touch of frost s01e01.mkv
Format                                   : Matroska
Format version                           : Version 2
File size                                : 3.73 GiB
Duration                                 : 1 h 42 min
Overall bit rate mode                    : Variable
Overall bit rate                         : 5 240 kb/s
Encoded date                             : UTC 2015-02-10 16:23:43
Writing application                      : MakeMKV v1.9.1 win(x64-release)
Writing library                          : libmakemkv v1.9.1 (1.3.0/1.4.1) win(x64-release)

Video
ID                                       : 1
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : Main@Main
Format settings                          : CustomMatrix / BVOP
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Custom
Format settings, GOP                     : Variable
Format settings, picture structure       : Frame
Codec ID                                 : V_MPEG2
Codec ID/Info                            : MPEG 1 or 2 Video
Duration                                 : 1 h 42 min
Bit rate mode                            : Variable
Bit rate                                 : 4 912 kb/s
Maximum bit rate                         : 7 500 kb/s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.474
Time code of first frame                 : 09:59:59:00
Time code source                         : Group of pictures header
Stream size                              : 3.50 GiB (94%)
Language                                 : English
Default                                  : No
Forced                                   : No

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : A_AC3
Duration                                 : 1 h 42 min
Bit rate mode                            : Constant
Bit rate                                 : 224 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 163 MiB (4%)
Title                                    : Stereo
Language                                 : English
Service kind                             : Complete Main
Default                                  : Yes
Forced                                   : No

Text
ID                                       : 3
Format                                   : VobSub
Codec ID                                 : S_VOBSUB
Codec ID/Info                            : Picture based subtitle format used on DVDs
Language                                 : English
Default                                  : Yes
Forced                                   : No

Menu
00:00:00.000                             : en:Chapter 01
00:12:47.320                             : en:Chapter 02
00:24:47.800                             : en:Chapter 03
00:37:21.480                             : en:Chapter 04
00:49:03.600                             : en:Chapter 05
01:00:53.640                             : en:Chapter 06
01:15:25.560                             : en:Chapter 07
01:30:17.840                             : en:Chapter 08

Marple

General
Unique ID                                : 46008052232374889444663555518978941412 (0x229CD41BB42B8DACA6C41B13768D61E4)
Complete name                            : U:\tv series\agatha christie's marple\season 06\agatha christie's marple s06e01.mkv
Format                                   : Matroska
Format version                           : Version 2
File size                                : 3.41 GiB
Duration                                 : 1 h 27 min
Overall bit rate mode                    : Variable
Overall bit rate                         : 5 551 kb/s
Encoded date                             : UTC 2015-03-16 09:17:43
Writing application                      : MakeMKV v1.9.1 win(x64-release)
Writing library                          : libmakemkv v1.9.1 (1.3.0/1.4.1) win(x64-release)

Video
ID                                       : 1
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : Main@Main
Format settings                          : CustomMatrix / BVOP
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Custom
Format settings, GOP                     : Variable
Format settings, picture structure       : Frame
Codec ID                                 : V_MPEG2
Codec ID/Info                            : MPEG 1 or 2 Video
Duration                                 : 1 h 27 min
Bit rate mode                            : Variable
Bit rate                                 : 5 217 kb/s
Maximum bit rate                         : 7 500 kb/s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.503
Time code of first frame                 : 09:59:59:00
Time code source                         : Group of pictures header
GOP, Open/Closed                         : Open
GOP, Open/Closed of first frame          : Closed
Stream size                              : 3.20 GiB (94%)
Language                                 : English
Default                                  : No
Forced                                   : No

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : A_AC3
Duration                                 : 1 h 27 min
Bit rate mode                            : Constant
Bit rate                                 : 224 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 141 MiB (4%)
Title                                    : Stereo
Language                                 : English
Service kind                             : Complete Main
Default                                  : Yes
Forced                                   : No

Text
ID                                       : 3
Format                                   : VobSub
Codec ID                                 : S_VOBSUB
Codec ID/Info                            : Picture based subtitle format used on DVDs
Language                                 : English
Default                                  : Yes
Forced                                   : No

Menu
00:00:00.000                             : en:Chapter 01
00:13:26.440                             : en:Chapter 02
00:28:00.800                             : en:Chapter 03
00:42:22.800                             : en:Chapter 04
00:50:06.080                             : en:Chapter 05
01:02:00.840                             : en:Chapter 06
01:10:00.080                             : en:Chapter 07
01:20:02.080                             : en:Chapter 08

Basically it’s to do with the whole anamorphic thing. It’s treating always displaying a 16:9 picture in the 576p space which is actually 4:3. Is there anyway to fix this? I can’t seem to open the side menu when in this mode, only the info screen will open.

So Marple is 720x576 but a 16:9 image so it should be filling the full 720x576 area. Instead it’s shrinking it down to show a 16:9 aspect ratio inside a 4:3 box and then outputting at 16:9. It’s how DVDs have always worked so should just be a case of displaying and outputting 576p/480p the way they do.

It’s essentially when you used to sent the 16:9 flag down a SCART cable to put the TV into 16:9 mode for anamorphic DVDs :slight_smile: If the aspect ratio for this content is 4:3, set to 576p/480p with no widescreen flag, if it’s 16:9 then it should send the flag.

Is this the same issue? I’m describing a horizonatally compressed image, like with extra thick side bars, so the picture appears portrait and distorted.

That’s exactly what the latest tweaks are designed to avoid. Please check you are on the latest release. Do you have hw acceleration enabled? If not, does it work with?

Try cycling through the aspect ratio options on your TV. With my Panasonic, it works properly with 16:9 set on DVDs, broadcast and recorded TV.

It should still be OK with no whitelisting - it will play at your GUI resolution, though, and some people are asking for ‘passthrough’ of 576 and 480 modes. Did you ever try whitelisting with the May release?

I mis-read your OP. What you have there is Kodi making up the ‘postbox’ bars and sending a 16:9 picture but I’m guessing your TV is set to 4:3 so it’s re-compressing it. Try the TV on 16:9 or ‘Auto’ aspect ratio.

Hi,

My Samsung is on “Fit and Move” for Vero4k, as 16:9 yields a small amount of overscan. But regardless I should have mentioned I’d cycled through the different settings and they just have varying degrees of zoom effect. The bizarre ratio remains. Only disabling HW acceleration “fixes” it. Anything I can do/supply?

I assume you’ve upgraded to 2019.06-01, so please engage amcodec, make sure HW acceleration for MPEG2 is set to Always, play some 544x576 content and post logs.

Latest logs are here.

The logs in my first post were with the same default settings you wanted, but at 7 days old are prior to the update, whether that makes for any useful comparison.

Thanks for looking into this.

I see the problem now. There seems to be no aspect ratio information in the stream. MediaInfo is guessing 1.85:1, which I assume is wrong, while Kodi is defaulting to 1:1.

2019-06-25 05:32:56.715 T:3469066976   DEBUG: CAMLCodec::OpenDecoder hints.width(544), hints.height(576), hints.codec(27), hints.codec_tag(0)
2019-06-25 05:32:56.715 T:3469066976   DEBUG: CAMLCodec::OpenDecoder hints.fpsrate(1000000), hints.fpsscale(40000), video_rate(3840), hints.bitsperpixel(0)
2019-06-25 05:32:56.715 T:3469066976   DEBUG: CAMLCodec::OpenDecoder hints.aspect(0.000000), video_ratio.num(0), video_ratio.den(1)
2019-06-25 05:32:56.715 T:3469066976   DEBUG: CAMLCodec::OpenDecoder hints.orientation(0), hints.forced_aspect(0), hints.extrasize(116)

I can’t get Forces TV here but old re-runs on Yesterday (eg) work for me - auto-switching to 16:9 for the ads. Can you check that just so I know we are on the same page?

Yesterday works fine as you describe.

Forces TV clearly tries to go 16:9 on the ads, but with the distortion the result is closer to 4:3.

OK, we’ll make it default to 16:9. It looks to me like Forces TV is actually sending 16:9 with built-in postboxing, ie an effective horizontal resolution of only 408!!

Craaaazy. Well the theory makes sense to me. Happy to give it a spin.

I’m up-to-date, more testing shows the following…bear in mind all HD content is fine.

HW acceleration on, no whitelisting
PAL plays fine, deinterlacing looks good
NTSC plays fine, deinterlacing isn’t quite perfect, wish I had some test patterns to double check all thos.

HW acceleration off, whitelisted 576p, 480p
PAL/NTSC, content plays fine however aspect ratios are incorrect. It’s not the TV, it’s the way the content is being formatted within Kodi.

HW acceleration off, no whitelisting
PAL content is jerky, out of sync audio etc.

So I’m happy with HW on now, however the whitelisting stuff isn’t working correctly.