MediaPortal Forums HTPC/MediaCenter

Go Back   MediaPortal Forum » MediaPortal 1 » Community Skins and Plugins » Plugins


Plugins Plugins developed and maintained by users. Want to create your own plugin? Start a thread in here.

Reply
 
LinkBack Thread Tools Display Modes
Old 2007-03-29, 13:55   #1 (permalink)
Portal Developer
 
lkuech's Avatar
 
Join Date: Feb 2007
Location: Hamburg
Age: 34
Posts: 513
Thanks: 26
Thanked 41 Times in 15 Posts

Country:

My System

Default ViewModeSwitcher plugin (Version 0.3)

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.
MediaPortal currently lacks a zoom mode that is a compromise between stretch and zoom, but there is a patch that helps a lot here: Implemented Non-Linear (Smart) Stretching of 4:3->16:9

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.



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


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:


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.



  • 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:
  • The letterbox detection is not working with EVR. Unfortunately this bug can not be fixed by the plugin, because it is on the MP side.

The plugin can be found in the plugin repository. Currently as version 0.3.
Here is the link: MEDIAPORTAL - free MediaCenter HTPC Software - ViewModeSwitcher 0.3

I hope you like it.

Bye
Lars

Last edited by lkuech; 2008-08-15 at 09:56. Reason: New version
lkuech is offline   Reply With Quote
4 Users Say Thank You:
Old 2007-03-29, 17:20   #2 (permalink)
Portal Developer
 
Join Date: Jan 2005
Age: 30
Posts: 2,597
Thanks: 68
Thanked 66 Times in 55 Posts


Default

Looks interesting. Have you check the auto cropper functionality? Maybe these two could be merged together?
__________________
http://day2.no-ip.org/

"Commy64 - The problem there is that Oprah was on. MP tried to save you by blanking the screen"
tourettes is online now   Reply With Quote
Old 2007-03-30, 06:51   #3 (permalink)
Portal Developer
 
lkuech's Avatar
 
Join Date: Feb 2007
Location: Hamburg
Age: 34
Posts: 513
Thanks: 26
Thanked 41 Times in 15 Posts

Country:

My System

Default

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
lkuech is offline   Reply With Quote
Old 2007-03-30, 21:10   #4 (permalink)
Portal Member
 
Join Date: Mar 2007
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts


Default

Intresting plug-in - this automatic zoom for "letterboxed" transmissions sounds good too, so keep up the good work. I'll test this during weekend.
quenthal is online now   Reply With Quote
Old 2007-03-31, 15:47   #5 (permalink)
Portal Developer
 
lkuech's Avatar
 
Join Date: Feb 2007
Location: Hamburg
Age: 34
Posts: 513
Thanks: 26
Thanked 41 Times in 15 Posts

Country:

My System

Default

I have updated the first thread a little bit. Download is now possible via the plugin repository.

Bye
Lars
lkuech is offline   Reply With Quote
Old 2007-04-01, 09:13   #6 (permalink)
Portal Member
 
Join Date: Mar 2007
Age: 38
Posts: 57
Thanks: 0
Thanked 1 Time in 1 Post


Default

I have a 120 x 768 resolution. How should i setup the plugin to get a automatic strech for a 4:3 signal?
Stone is offline   Reply With Quote
Old 2007-04-01, 12:13   #7 (permalink)
Portal Developer
 
lkuech's Avatar
 
Join Date: Feb 2007
Location: Hamburg
Age: 34
Posts: 513
Thanks: 26
Thanked 41 Times in 15 Posts

Country:

My System

Default

@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 is offline   Reply With Quote
Old 2007-04-01, 20:08   #8 (permalink)
Portal Member
 
Join Date: Mar 2007
Age: 38
Posts: 57
Thanks: 0
Thanked 1 Time in 1 Post


Default

Sorry of course 1280...
Stone is offline   Reply With Quote
Old 2007-04-02, 05:53   #9 (permalink)
Portal Developer
 
lkuech's Avatar
 
Join Date: Feb 2007
Location: Hamburg
Age: 34
Posts: 513
Thanks: 26
Thanked 41 Times in 15 Posts

Country:

My System

Default

Ok, that's what I've thought.

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

CU
Lars
lkuech is offline   Reply With Quote
Old 2007-04-02, 12:38   #10 (permalink)
Portal User
 
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

Country:


Default Download link is broken

Hi, could you please fix the download link?
win_termute is offline   Reply With Quote
Reply

Bookmarks

Tags
plugin, version, viewmodeswitcher

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ein neues Plugin von einem bestehenden Plugin programmiertechnisch ableiten? bartmanson Plugins/Erweiterungen 10 2008-05-19 23:07
MCE Plugin Plugin sambuddy Plugins 1 2006-06-23 08:00
memory plugin-newbie plugin dev. questions newbie23 Plugins 13 2005-09-08 20:19
plugin : GetHome / my plugin ? Boris General Development (no feature request here!) 0 2005-08-07 12:28
Plugin Request - Cinema Preview Plugin Schrauber Plugins 0 2004-08-17 15:34


All times are GMT +1. The time now is 16:49.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 Protected by Akismet Blog with WordPress