Jump to content

Wrong aspect ratio playing content with DAR 16:9, SAR 64:45 on Tizen


Recommended Posts

Posted

I've recently got a Samsung S95D and playing some old MPEG2 SD content it's playing 4:3 when it should be anamorphic widescreen.

On my mac it plays as 16:9 in safari, chrome and firefox. It plays fine in the Android app both on my phone and on my nVideo Shield. I've I download the source file and it plays fine in VLC on my mac too.

The original was MPEG2-TS but I've tried rewrapping as .mkv and .mp4 in all cases Tizen is streaming the original where for the desktop browsers Emby transcodes. That's not _the_ difference though since my android phone also streams the original but plays with the correct aspect ratio.

The Tizen app version is Emby for Samsung 1.9.0

The TV firmware says it's up-to-date on version 1201  @SamES

In all cases ffprobe shows sensible SAR and DAR:

/volume2/\@appstore/EmbyServer/bin/ffprobe /volume2/emby/recordings/TV/Richard\ Osman\'s\ House\ of\ Games\ \(2017\)/Season\ 1/Richard\ Osman\'s\ House\ of\ Games\ S01E06.ts
ffprobe version 5.1-emby_2023_06_25 Copyright (c) 2007-2022 the FFmpeg developers and softworkz for Emby LLC
  built with gcc 10.3.0 (crosstool-NG 1.25.0)
Input #0, mpegts, from '/volume2/emby/recordings/TV/Richard Osman's House of Games (2017)/Season 1/Richard Osman's House of Games S01E06.ts':
  Duration: 00:44:57.76, start: 1.400000, bitrate: 1759 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, progressive), 720x576 [SAR 64:45 DAR 16:9], Level 8, 25 fps, 25 tbr, 90k tbn, Start-Time 2.240s
    Side data:
      cpb: bitrate max/min/avg: 4876400/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1[0x101](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s, Start-Time 1.400s

mediainfo show the display aspect ratio should be 16:9.

I've attached a bad photo of the video I noticed the problem on. You can see it's displaying as pillar boxed 4:3 where it should be 16:9.

PXL_20241230_235029660_MP.thumb.jpg.9cea37a8dff5961ae4bb481357767e04.jpg

Posted

 Can you show me the media information from the bottom of the details page on the server for this item?  The section that shows the video/audio/subtitle stream info

Posted

Note, it looks new because I've rewrapped it, I think this is what you were requesting?

Screenshot2024-12-31at13_03_49.thumb.png.f0ddba32203dc2aa494f39ce67e8a4e0.png

Posted

Can you try and refresh the metadata on this item and retest? Please repost the media info again after refreshing metadata

Posted

Refreshing the metadata changed nothing. This should not be surprising as I was rescanning the files each time I changed the wrapper. I still have the matroska version on my mac so can get whatever metadata you want from it. Here's the mediainfo for the mkv

mediainfo /tmp/test.mkv
General
Unique ID                                : 2053405370335749269740978728730893364 (0x18B78B381F60070FB0CE0B3D5541C34)
Complete name                            : /tmp/test.mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 538 MiB
Duration                                 : 44 min 57 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 672 kb/s
Frame rate                               : 25.000 FPS
Writing application                      : Lavf59.27.100
Writing library                          : Lavf59.27.100
ErrorDetectionType                       : Per level 1

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
Codec ID                                 : V_MPEG2
Codec ID/Info                            : MPEG 1 or 2 Video
Duration                                 : 44 min 56 s
Bit rate mode                            : Variable
Bit rate                                 : 1 446 kb/s
Maximum bit rate                         : 4 876 kb/s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9
Active Format Description                : Full frame 16:9 image
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                                : Progressive
Scan order                               : Top Field First
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.140
Time code of first frame                 : 03:14:52:06
Time code source                         : Group of pictures header
GOP, Open/Closed                         : Closed
Stream size                              : 465 MiB (86%)
Default                                  : No
Forced                                   : No
Color range                              : Limited

Audio
ID                                       : 2
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Codec ID                                 : A_MPEG/L2
Codec ID/Hint                            : MP2
Duration                                 : 44 min 57 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 kHz
Compression mode                         : Lossy
Delay relative to video                  : -840 ms
Stream size                              : 61.7 MiB (11%)
Language                                 : English
Default                                  : No
Forced                                   : No

 

 

visproduction
Posted

So the TV sees the pixel dimensions and ignores the Display Aspect Ratio.  I don't find that surprising.  I would guess most TV's ignore the Aspect Ratio metadata inside a MKV encoded video.  You cannot teach a TV to do something it ignores. The fact that other 3rd party apps pay attention to the Aspect Ratio meta data is fine.  Those are different apps.

If you want this media to playback correctly use ffmpeg or other 3rd party encoder, use a filter to resize the Aspect Ratio to 1.77777  576 x 1024 and save the new video master.  You lose a generation, but if you make the encoding settings high, even a bitrate of 1400 kbps will look excellent.

Posted

On Samsung we have to set the player dimensions manually for the correct ratio, so are dependent on the correct metadata being loaded for the file. 
 

@finnaldocould you please send me a copy of that file to test?  A link to download from Google drive, Dropbox, OneDrive etc is fine if you send the link to me via PM. Thanks. 

Posted

Happy new year and thanks for the support.

I've just done a quick survey of some old TV content and every anamorphic file I could find played wrong so I don't think it's related to specific content (I already suspected this given rewrapping with ffmpeg made no difference).

I found a good test file I could share that's only 10MB. It's an extra I encoded from a DVD some years ago so h.264 and mp4 and I can confirm the `pasp` box in the mp4 is set to 64:45 as expected.

Emby shows:

Media Info
/volume2/Plex/media/TV/Octonauts/Series 1/Octonauts - 2x17 - The Lionfish.mp4
MP49.9 MBAdded 09/08/2013 07:13

Video
Title576p H264
CodecH264
Codec Tagavc1
ProfileHigh
Level30
Resolution720x576
Aspect Ratio16:9
InterlacedNo
Framerate25
Bitrate1 mbps
Colour Primariesbt470bg
Colour Spacesmpte170m
Colour Transferbt709
Bit Depth8 bit
Pixel Formatyuv420p
Reference Frames1

ffprobe shows the SAR and DAR

/volume2/\@appstore/EmbyServer/bin/ffprobe /volume2/Plex/media/TV/Octonauts/Series\ 1/Octonauts\ -\ 2x17\ -\ The\ Lionfish.mp4
ffprobe version 5.1-emby_2023_06_25 Copyright (c) 2007-2022 the FFmpeg developers and softworkz for Emby LLC
  built with gcc 10.3.0 (crosstool-NG 1.25.0)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/volume2/Plex/media/TV/Octonauts/Series 1/Octonauts - 2x17 - The Lionfish.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2013-08-08T22:32:05.000000Z
    encoder         : HandBrake 0.9.9 2013051800
  Duration: 00:01:01.00, start: 0.000000, bitrate: 1359 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709, progressive), 720x576 [SAR 64:45 DAR 16:9], 1193 kb/s, Level 30, 25 fps, 25 tbr, 90k tbn (default)
    Metadata:
      creation_time   : 2013-08-08T22:32:05.000000Z
      vendor_id       : [0][0][0][0]
      encoder         : JVT/AVC Coding
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 162 kb/s (default)
    Metadata:
      creation_time   : 2013-08-08T22:32:05.000000Z
      vendor_id       : [0][0][0][0]

Elsewhere I've found that some players require the `pasp` box to be set in mp4 and I've confirmed that we have one here:

moov -> trak -> mdia -> minf -> stbl -> stsd -> extensions -> pasp -> (h_spacing=64, v_spacing=45)

I'll PM you this file (after renaming to octo_test.mp4).

Posted

Thanks

Posted

I can't reproduce this on older models, so I can only guess that this an issue related to 2024 models.  Your sample plays fine on my 2017 and 2022 models.

Leave it with me to see if I can work something out

Posted

@finnaldoCan you please test something?  During playback, from the player settings, can you please try the different Aspect Ratio settings?  Do any of them change the output?

Posted

The only options are `auto` and `fill`. `auto` is the default and selecting `fill` makes no difference. I'm surprised selecting `fill` didn't make it look right.

Posted (edited)

I _could_ transcode and resize to 1024x576 square pixels and it would look right but this is not the correct technical solution. Non-square pixels were the standard for SD DVB in the UK and I think most other places and so TV's should handle it correctly. Clearly something is wrong with the player on Tizen and while that's likely the result of Tizen doing something strange I'm hoping this can be worked around in the player. I don't know how to troubleshoot this though and thought rewrapping would be enough :(

Maybe I should try setting up plex and see if that has the same problem, but I like the way emby let's me pull the guide data (the reason I selected emby in the first place).

Edited by finnaldo
Posted
6 hours ago, finnaldo said:

The only options are `auto` and `fill`. `auto` is the default and selecting `fill` makes no difference. I'm surprised selecting `fill` didn't make it look right.

Thanks for checking.  Fill should override any aspect ratio in video and force full screen, so something in the 2024 models is behaving differently.  I've got something I want to try, but it will need me to do a bit more testing first.

  • Thanks 1
  • 3 weeks later...
Posted

Any progress @SamES

I got as far as installing Plex and can confirm it plays the content with the correct aspect ratio so this problem is specific to the Emby player.

Posted
9 hours ago, finnaldo said:

Any progress @SamES

I got as far as installing Plex and can confirm it plays the content with the correct aspect ratio so this problem is specific to the Emby player.

Sorry, not yet.  I'll have to update to the latest emulators to see what's changed which is a bit of a pita, but I'll try and get to it later this week.

Posted
9 hours ago, finnaldo said:

I got as far as installing Plex and can confirm it plays the content with the correct aspect ratio so this problem is specific to the Emby player.

Can you confirm whether Plex is really DirectPlay it or are they doing some stream conversion?  They might also be using the html rather than the tizen avplayer

Posted

I have no idea how to tell whether it's a webapp is that something I can tell on tizen?

I think this screenshot shows it's not transcoding?

PXL_20250120_225635552.thumb.jpg.f731410fee4f58185516cd72f18c5463.jpg

I ticked "Force Direct Play" too and in playback options enabled playback information:

PXL_20250120_230338585_MP.thumb.jpg.9f4f85e233c8ef06d5f8d71a5aec8984.jpg

Posted (edited)

I'm pretty sure it's a native player based on the HTTP headers of an mp4 request I captured

Screenshot2025-01-20at23_19_49.thumb.png.089e0c446b834f2632991a3f508a3c03.png

Particularly notice the User-Agent string is `samsung-agent/1.1` that's not like the request for the episode details which had the browser looking `Mozilla/5.0 (SMART-TV; LINUX; Tizen 8.0) AppleWebKit/537.36 (KHTML, like Gecko) 108.0.5359.1/8.0 TV Safari/537.36`.

I also compared that to streaming to a browser where the mp4 request looks like a web request as we'd expect complete with cookie.

Edited by finnaldo
Posted (edited)

I've not come across AVPlay before but a quick look doesn't look like it gives much control? I only see this bit that's in any way related to aspect ratio?
https://developer.samsung.com/smarttv/develop/api-references/samsung-product-api-references/avplay-api.html#AVPlayManager-setDisplayMethod

Quote

setDisplayMethod

Sets the video screen mode in the specified display area.

void setDisplayMethod(AVPlayDisplayMode displayMode);

Product : TV, AV, B2B

Constraint :

  • Can be called in the following states: "IDLE", "READY", "PLAYING", "PAUSED"

Parameters :

  • displayMode : "PLAYER_DISPLAY_MODE_LETTER_BOX", "PLAYER_DISPLAY_MODE_FULL_SCREEN", or "PLAYER_DISPLAY_MODE_AUTO_ASPECT_RATIO"

https://developer.samsung.com/smarttv/develop/api-references/samsung-product-api-references/avplay-api.html#AVPlayDisplayMode

Quote
  • PLAYER_DISPLAY_MODE_LETTER_BOX : Letterbox mode
  • PLAYER_DISPLAY_MODE_FULL_SCREEN : Full-screen mode
  • PLAYER_DISPLAY_MODE_AUTO_ASPECT_RATIO : Screen mode based on video dar/par info

Clearly PLAYER_DISPLAY_MODE_AUTO_ASPECT_RATIO is supposed to be correct...

Edited by finnaldo
Posted

Thanks for the playback info.  It's still a bit unclear if they really direct play in the same way that we do.  I think I might still have a plex setup that works so I can try testing this.

avplay is the 'native' player and it gives enough control.  We actually force full screen by setting the player size with https://developer.samsung.com/smarttv/develop/api-references/samsung-product-api-references/avplay-api.html#AVPlayManager-setDisplayRect, so the fact that this is not working when you select 'fill' suggests that something is not working like it normally does.

Posted (edited)

I'm running Plex Server (and Emby for that matter) on my synology (that's where I took the tcpdump). I could have a look at `top` and see if there's anything using significant CPU when I stream but that's pretty indirect. Maybe if I request a downsampling and we see a spike in CPU but not when we use direct play that might be sufficient confirmation? Can you suggest any other way to confirm?

Edited by finnaldo
Posted
1 hour ago, finnaldo said:

I'm running Plex Server (and Emby for that matter) on my synology (that's where I took the tcpdump). I could have a look at `top` and see if there's anything using significant CPU when I stream but that's pretty indirect. Maybe if I request a downsampling and we see a spike in CPU but not when we use direct play that might be sufficient confirmation? Can you suggest any other way to confirm?

Not sure, don't worry too much about it.  Either way, we have to find a solution that works for us.  My first step is trying to replicate your issue with the latest emulators

  • Thanks 1
Posted

@finnaldoA quick update.

I was finally able to get the latest emulators installed, but they are incredibly slow to run, and even worse to try and debug in.

However, I can reproduce the error in the latest emulator, and my theory on a possible solution looks promising, but I'll just need to do a bit more testing to confirm that it doesn't impact older models before we can publish a change.  

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...