ViewModeSwitcher plugin (Version 0.3) (1 Viewer)

lkuech

Retired Team Member
  • Premium Supporter
  • February 16, 2007
    576
    83
    50
    Hamburg
    Home Country
    Germany Germany
    Hi all.

    Users of the "old" TV engine should read the hint about the rule configuration!

    Short description:
    The idea of ViewModeSwitcher was to help MediaPortal (connected to a wide screen) to handle all kind of signals (4:3, fake 16:9 (letterbox) and 16:9) without change the zoom mode via remote all the time.

    Longer description:
    First I want to send big thanks to the development team of MediaPortal and of course to everyone else who helps to improve this project every day. A special thanks goes to ziphnor, the author of the autocropper plugin. ViewModeSwitcher is based on his idea of implementation. I am currently in the planning phase of a HTPC came to the conclusion, that MediaPortal is the most flexible and interesting way to go.

    I developed the ViewModeSwitcher plugin to create a higher WAF (Woman Acceptance Factor), because my flat screen as an Option to predefine a zoom mode for 4:3 broadcasts. That means that you can choose which zoom mode (14:9, Smartzoom, wide or just plain 4:3) is used per default if a 4:3 signal is detected. My wife (and my self as well) loved this function because we don’t like to watch television with black bars on the left and right side. Of course the flat screen itself does not see any changes from 4:3 to 16:9 if it is connected to a HTPC... So I have to build this functionality inside of MediaPortal.

    Maybe someone else will find this plugin useful as well.

    ViewModeSwitcher offers:
    • switching to a defined viewmode (Stretch,14:9 etc.) depending on parameters like the video aspect ratio and the video width and height. This is a feature that maybe more interesting to uses of a wide screen, like my self.
    • switching automatically to the"zoom" mode if a letterbox (fake 16:9) broadcast is detected. Most useful for wide screen users as well.
    • set an overscan value (crop the picture) depending on parameters like the video aspect ratio and the video width and height. That makes it possible to define an overscan for SD broadcast and records, but leave HDTV untouched.

    The detection of aspect ratio changes requires a codec that supports it (i.e. DScaler, PureVideo, Cyberlink PowerDVD).


    The behaviour of ViewModeSwitcher is based on a ruleset, that can be defined in the configuration.

    vms_rules.png


    The configuration for my “4:3 PAL” rule that switches automatically to “Stretch” for example looks like this: (notice the new letterbox option!)
    vms_v2_4_3.png


    If you are not sure which values you have to use, you can look in the MediaPortal.log. If the logging is set at “Information” level, you should find something like this (after the playback as started).

    [Info.][5]: PlaneScene: video WxH : 768x576
    [Info.][5]: PlaneScene: video AR : 768:576

    The Aspect Ratio is calculated by using the AR values and divide the width through the height. 768/576 = 1.3333333333333333333333333333333

    This is how a normal PAL 4:3 broadcast should look like.


    A 16:9 PAL broadcast may look like this:
    PlaneScene: video WxH : 1024x576
    PlaneScene: video AR : 1024:576

    1024/576 = 1.7777777777777777777777777777778

    Attention! With RC2 of MediaPortal these values are now a bit different! Now they are 4:3 or 16:9. But under the line these values lead to the same results... 4/3 = 1.3333333333333333333333333333333 and 16/9 = 1.7777777777777777777777777777778...

    This is how my 16:9 PAL rule looks like:
    vms_v2_16_9.png


    These two rules together are doing a decent job for me. But leave HDTV untouched.

    Users of the old TV engine have to do some changes to the rule mentioned above.
    If you switch MediaPortal into the "Debug" log mode, you will see something like:


    [Debug][ViewModeSwitcherThread]: VideoAspectRatioX 768
    [Debug][ViewModeSwitcherThread]: VideoAspectRatioY 576
    [Debug][ViewModeSwitcherThread]: VideoWidth 0
    [Debug][ViewModeSwitcherThread]: VideoHeight 0

    That means that the old TV engine does not provide the values of width and height the same way like the normal media player does (the one that the new engine uses). Because of this you have to change your rules to tolerate this by settings the values of min and max width and height to 0. You still need the original rules if the plugin should help you under myVideo.

    Letterbox detection
    Letterbox detection requires analysing of the content of a broadcast. With other words... the plug grapps a frame from the stream and analyses if it contains black bars in the upper and/or lower part. Of course this is a process which requires processing power (CPU) and should only be activated if your system has enough idle time left during the playback of TV streams.

    If you have designed a rule with enabled letterbox detection (normally a 4:3 rule) you can configure the following options.

    vms_v2_lb1.png

    vms_v2_lb2.png


    • Disable letterbox detection globally: If this value is enabled letterbox detection is disabled even if it its set in a rule.
    • Check interval: Sets the frequency how often the plugin is checking for letterbox broadcasts. Because the detection is CPU demanding, this value should not chosen to low.
    • The zoom is changes after x ....: This value defines how often the plugin has to analyse a signal with same letterbox result. Before its is allowed to changed the zoom mode. This option makes the detection much more reliable, but increases the time that is required to detect a letterbox signal. If you want to change the mode directly after the first detection set this value to 1.
    • Black level tolerance: Black is not always black. Here you can define how black the "black bars" have to be. 0 is absolutely dark, 1 is absolutely bright. the default is 0.1
    • Upper and Lower box checkboxes: Allow you to choose which area of the picture is analysed by the plugin. The most reliable setting is enable both, but that requires more CPU power.
    • The 8 percent values let you choose the position of the rectangles to analyse.

    This version is tested under MyVideo and the MyTVPlugin (TV engine 0.3) with the lastest SVN.
    It is also tested width the old TV engine. Read the hint above!

    New in version 0.3:
    • Some bug fixes.
    • Fallback rule added (ViewModeSwitcher can now fallback to a predefined zoom mode if no rule fits)
    • New option to rescan the rules after channel change. (This also resets the letterbox detection)
    • Import/Export functions for the complete plugin settings. Makes it easier to exchange settings via the forum.
    • MPI setup routine.
    • configuration icon.

    Known problems:
    • No known issues at the moment

    The plugin can be found in the plugin repository.
    Here is the link: MEDIAPORTAL - free media center - ViewModeSwitcher 0.3.1

    Attached to this thread you can find a 1.1.0Alpha and up compatible version (TVE2 reference removed)


    I hope you like it.

    Bye
    Lars
     

    Attachments

    • ViewModeSwitcher-0.3.2.mpe1.zip
      30.7 KB

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Looks interesting. Have you check the auto cropper functionality? Maybe these two could be merged together?
     

    lkuech

    Retired Team Member
  • Premium Supporter
  • February 16, 2007
    576
    83
    50
    Hamburg
    Home Country
    Germany Germany
    Hi tourettes.

    yes I know the auto cropper. It was the plugin that had "inspired" me to build the ViewModeSwitcher. Of course, merging this two plugins is possible. But these plugins are developed with different "goals". Auto cropper main task is to zoom as best as possible into the picture without loosing subtitles. And ViewModeSwitcher adds mainly the possibility to have a default zoom mode for every kind of signal. (You can still choose the zoom mode yourself by using the s key)

    Here in Germany we have normally 4 kinds of signals.
    • HDTV - is always 16:9 with pretty good borders, so no overscan necessary.
    • PAL 4:3 - as I mentioned before, I don't want to watch such programs with black bars left and right. Borders maybe cr.... so a little overscan comes handy.
    • PAL 16:9 - Also not always clean borders so overscan is also mandatory.
    • PAL Letterbox - Is not really a "signal kind" but different to handle as the other ones. This signal is a 16:9 picture in a 4:3 broadcast. There are normally no necessary information in the black bars (no subtitles etc.)

    The idea of ViewModeSwitcher was to help MediaPortal (connected to a wide screen) handle all these kind of signals without change the zoom mode via remote all the time.

    Letterbox is the only signal type where the plugin can't help so far. Those signals are best viewed in the mode "zoom", but you have to switch to it via remote.
    An automatically detection of letterbox signals is already included in the auto cropper, but unfortunately it seems to leave the bottom black bar visible pretty often and generates small black borders around the whole picture frequently.

    So we have two options. Merge these two plugins and make auto cropper also useful for the "German" letterbox broadcasts, or let these plugins coexist ... but I guess sooner or later I will have to implement a letterbox detection function that simply switches to the already implemented "zoom" mode... that is pretty near to what auto cropper is trying to do, but still with a little bit different focus.

    Did you test the plugin?
    I would like to have some feedback before I make it "more" public by uploading it on the main site.

    CU
    Lars
     

    quenthal

    Portal Member
    March 26, 2007
    16
    0
    Intresting plug-in - this automatic zoom for "letterboxed" transmissions sounds good too, so keep up the good work. I'll test this during weekend.
     

    lkuech

    Retired Team Member
  • Premium Supporter
  • February 16, 2007
    576
    83
    50
    Hamburg
    Home Country
    Germany Germany
    I have updated the first thread a little bit. Download is now possible via the plugin repository.

    Bye
    Lars
     

    Stone

    Portal Pro
    March 11, 2007
    82
    4
    I have a 120 x 768 resolution. How should i setup the plugin to get a automatic strech for a 4:3 signal?
     

    lkuech

    Retired Team Member
  • Premium Supporter
  • February 16, 2007
    576
    83
    50
    Hamburg
    Home Country
    Germany Germany
    Stone: really 120 x 768? Or 1280 x 768...?

    Under the line it makes no different, all you have to do is change the parameters a little bit.
    So in case the video is really 120 x 768 and you what MediaPortal automatically switch to "Stretch" if a playback of such a video is started, just create a rule with the following parameters:

    • Rule name: what ever makes sense to you (it only used in the log file and the switch message)
    • Minimal Width: 120
    • Maximal Width: 120
    • Minimal Height: 768
    • Maximal Height: 768
    • Enable the checkbox "this rule switches to the following viewmode" and select "Stretch"
    • the checkbox "this rule uses following overscan" can stay disabled if the borders of such videos are "clean". Otherwise enable it and set the value (in pixel) how much MediaPortal should "zoom into" your video to let this borders disappear.

    CU
    Lars
     

    lkuech

    Retired Team Member
  • Premium Supporter
  • February 16, 2007
    576
    83
    50
    Hamburg
    Home Country
    Germany Germany
    Ok, that's what I've thought. :)

    Then just change the 120 values in the rule above to 1280.

    CU
    Lars
     

    Users who are viewing this thread

    Top Bottom