All,
Please find attached a "replacement" for the MTN.exe thumbnailer used by Mediaportal.
Due to MTN being a dead project with no updates in over a year, no response from the author and not being able to thumbnail all types of media, I decided to have a look at a "fix".
Ideally MediaPortal should be updated to stop using MTN and switch to something else (internal Windows thumbnailing, FFmpeg, etc - Pilehive did post some code previously), but my coding abilities are limited, so I wrote a new MTN.exe which is simply a wrapper to FFMpeg.
It takes the commandline options (most of them) that MTN was sent and runs them through FFMpeg.
To install simply copy the two files from the ZIP file (MTN.EXE and FFMpeg.exe) and place them into the Mediaportal/MovieThumbNailer directory (overwriting the MTN that is there) - thats it
If you want a more feature rich replacement for MTN (which will grab images from the internet, supports client/server, etc) then may I suggest you try Kiwijunglist's great version here:
https://forum.team-mediaportal.com/...tom-rec-tv-thumbs-better-h264-support.113415/
The updated "Source" zip contains the four modules used in this project (No project or solution file).
Change log:
-------------------------------------------------------------------------------------------------------------------------
Version 77:
Fixed a bug if no registry key values are set.
Now supports "overridebegin" and "overrideend" registry keys. These override the commandline "begin" and "end" skip values (-B and -E). This will allow you to use different values to those hardcoded by Mediaportal (eg 720 and 500 I think - Cant remember the end value off the top of my head).
To specify the begin skip period, create the following key "overridebegin" (REG_SZ) and set it to the required time in seconds.
To specify the end skip period, create the following key "overrideend" (REG_SZ) and set it to the required time in seconds.
-------------------------------------------------------------------------------------------------------------------------
Version 76:
Now supports "maxthumbnailwidth". This will prevent a thumbnail from exceeding this value. Handy if using "thumbwidth -1". If the thumbnail is wider than the maximum, it is rescaled to the maximum value (if the width is less than max, then nothing is done).
To specify the maximum width, create the following key "maxthumbnailwidth" (REG_SZ) and set it to the required width.
-------------------------------------------------------------------------------------------------------------------------
Version 74:
Incorrect reporting of thumbnail in the log file
New option of "-1" for thumbnail size, will now make the thumbnail width to be the total width of the source videos * columns. This may may mean the thumbnail could be massive!
-------------------------------------------------------------------------------------------------------------------------
Version 73:
Simplified maths/logic for calculating tile sizes
-------------------------------------------------------------------------------------------------------------------------
Version 72:
Customisable borders
Now supports customisable internal and external borders.
Create a new registry key called "externalborder" and set it to the number of pixels
Create a new registry key called "internalborder" and set it to the number of pixels
-------------------------------------------------------------------------------------------------------------------------
Version 71:
Black Frame Detection
Now supports black/blank frame detection. If a grabbed frame/tile is black, it will try and grab another one. It will try 3 times. If they are all black, it will give up and use the black grabbed frame. This option is on by default. To turn it off create the following registry key (REG_SZ): "disableblankframedetection" and set it to "1". Please let me know how you get on with detection rates and speed. This function does drastically slow the thumbnailing process down (it is not variable like the MTN version - might be something I look at going forward)
Borders
Now supports black borders between the tiles. This is off by default, to enable borders (and specify thickness in pixels), create the following registry key (REG_SZ): "border" and set it to the required thickness.
Image Quality
Change the default, such that image encoding is done by default (JPEG quality is 100%). This will now produce smaller thumbs at 100% quality. To disable the encoding, set the "thumbnailquality" regsitry key to "-1"
-------------------------------------------------------------------------------------------------------------------------
Version 70:
Code is now C# (instead of VB.Net) - Great fun converting data types!!
Fixed a logic/maths issue with tiling
Now includes a "thumbnailquality" option - set via the registry (value is 1 to 100 - Where 100 does no adjustment))
Now includes a "thumbnailwidth" option - set via the registry that sets the default size if one is
not set via the commandline (instead of using video size)
-------------------------------------------------------------------------------------------------------------------------
Version 61:
Exit level on failure is now -1 (instead of 1)
Can now specify debug mode via commandline ("-debug")
Now supports two modes of aspect ratio:
Thumbnail Aspect Ratio (default option)
In this mode, the final thumbnail aspect ratio will match the source/video aspect ratio. This will mean the individual tile images may be distorted to ensure the overal AR is maintained for the thumbnail. The final thumbnail size should be quite consistant as it will be based on video aspect ratios (16:9, 4:3, etc)
Tile Aspect Ratio (custom option)
In this mode the final thumbnail aspect ratio will not match the source/video aspect ratio. Instead the individual tile image(s) aspect ratios are maintained. This may mean the overall thumbnail AR (dimensions) will be way off. I'm not sure how well MePo will handle it. In this mode having a large differential between rows and columns will make the overall thumbnail size "interesting".
To change from the default mode, to the TileAR mode, create a reg key call "keeptilear" and set it to "1" (or specify "-keeptilear") as a commandline option.
-------------------------------------------------------------------------------------------------------------------------
Version 60:
Refactored the code a little
Dropped the minimum video length to 30 seconds (instead of 60)
Now supports process priority (use a reg key called "priority" and set it to: realtime, abovenormal, belownormal,high, normal,idle) - default is BELOWNORMAL
Has a commandline help feature (mtn.exe --h or -h or -help)
Temporary tile files are now saved into a MTN_Replacement sub directory in "Windows Temp"
Exit level set to 1 on a failure (0 on success)
-------------------------------------------------------------------------------------------------------------------------
Version 59:
Switched to using a more complex process based launching mechanism (instead of shell and external file)
If FFmpeg fails to extract movie details, the program will assume some defaults (duration 300, width 1270)
-------------------------------------------------------------------------------------------------------------------------
Version 56:
Fixed annoying issues with long filenames and spaces (which I thought I had fixed in v55)
-------------------------------------------------------------------------------------------------------------------------
Version 55:
Fixed issues of paths with spaces/long names
-------------------------------------------------------------------------------------------------------------------------
Version 53:
Reverted to FFMpeg for extracting movie details
Fixed stupid timeout mistake (wanted miliseconds I gave it secsonds)
-------------------------------------------------------------------------------------------------------------------------
Version 52:
Tried using MediaInfo to extract details but was taking 20 seconds to open/read a movie of the LAN
-------------------------------------------------------------------------------------------------------------------------
Version 51:
A large rewrite to address issues and performance (wife is not happy about how much time I've spent on it!!)
No longer uses FFmpeg to tile (internally done by code)
Frame grabs are now equally spaced between start and end points
Supports custom suffix
Supports custom output directory
Supports end skip value
If no custom size is specified for thumbnail, the size of the source is used
-------------------------------------------------------------------------------------------------------------------------
Version 50:
Major issue/bug - so not available anymore!!
Program rewritten using VB.Net
-------------------------------------------------------------------------------------------------------------------------
Version 49:
Fixed issue of rows and columns the wrong way around
-------------------------------------------------------------------------------------------------------------------------
Version 48:
Tweaked the "debug" setting - You can either use a "mtn.debug" flag file (in the same directory as the mtn.exe file), or you can create the following reg key: HKLM\Software\MTN\debug (create as a string and set to 1).
To make everyone's life easy, I have included two reg files within the Zip file - these will turn on/off debug (simply double click on either one).
With debug enabled, MTN will create a "mtn_replacement.log" log file in the mtn.exe directory.
---------------------------------------------------------------------------------------------------------------------------
Many thanks,
J.
Please find attached a "replacement" for the MTN.exe thumbnailer used by Mediaportal.
Due to MTN being a dead project with no updates in over a year, no response from the author and not being able to thumbnail all types of media, I decided to have a look at a "fix".
Ideally MediaPortal should be updated to stop using MTN and switch to something else (internal Windows thumbnailing, FFmpeg, etc - Pilehive did post some code previously), but my coding abilities are limited, so I wrote a new MTN.exe which is simply a wrapper to FFMpeg.
It takes the commandline options (most of them) that MTN was sent and runs them through FFMpeg.
To install simply copy the two files from the ZIP file (MTN.EXE and FFMpeg.exe) and place them into the Mediaportal/MovieThumbNailer directory (overwriting the MTN that is there) - thats it
If you want a more feature rich replacement for MTN (which will grab images from the internet, supports client/server, etc) then may I suggest you try Kiwijunglist's great version here:
https://forum.team-mediaportal.com/...tom-rec-tv-thumbs-better-h264-support.113415/
The updated "Source" zip contains the four modules used in this project (No project or solution file).
Change log:
-------------------------------------------------------------------------------------------------------------------------
Version 77:
Fixed a bug if no registry key values are set.
Now supports "overridebegin" and "overrideend" registry keys. These override the commandline "begin" and "end" skip values (-B and -E). This will allow you to use different values to those hardcoded by Mediaportal (eg 720 and 500 I think - Cant remember the end value off the top of my head).
To specify the begin skip period, create the following key "overridebegin" (REG_SZ) and set it to the required time in seconds.
To specify the end skip period, create the following key "overrideend" (REG_SZ) and set it to the required time in seconds.
-------------------------------------------------------------------------------------------------------------------------
Version 76:
Now supports "maxthumbnailwidth". This will prevent a thumbnail from exceeding this value. Handy if using "thumbwidth -1". If the thumbnail is wider than the maximum, it is rescaled to the maximum value (if the width is less than max, then nothing is done).
To specify the maximum width, create the following key "maxthumbnailwidth" (REG_SZ) and set it to the required width.
-------------------------------------------------------------------------------------------------------------------------
Version 74:
Incorrect reporting of thumbnail in the log file
New option of "-1" for thumbnail size, will now make the thumbnail width to be the total width of the source videos * columns. This may may mean the thumbnail could be massive!
-------------------------------------------------------------------------------------------------------------------------
Version 73:
Simplified maths/logic for calculating tile sizes
-------------------------------------------------------------------------------------------------------------------------
Version 72:
Customisable borders
Now supports customisable internal and external borders.
Create a new registry key called "externalborder" and set it to the number of pixels
Create a new registry key called "internalborder" and set it to the number of pixels
-------------------------------------------------------------------------------------------------------------------------
Version 71:
Black Frame Detection
Now supports black/blank frame detection. If a grabbed frame/tile is black, it will try and grab another one. It will try 3 times. If they are all black, it will give up and use the black grabbed frame. This option is on by default. To turn it off create the following registry key (REG_SZ): "disableblankframedetection" and set it to "1". Please let me know how you get on with detection rates and speed. This function does drastically slow the thumbnailing process down (it is not variable like the MTN version - might be something I look at going forward)
Borders
Now supports black borders between the tiles. This is off by default, to enable borders (and specify thickness in pixels), create the following registry key (REG_SZ): "border" and set it to the required thickness.
Image Quality
Change the default, such that image encoding is done by default (JPEG quality is 100%). This will now produce smaller thumbs at 100% quality. To disable the encoding, set the "thumbnailquality" regsitry key to "-1"
-------------------------------------------------------------------------------------------------------------------------
Version 70:
Code is now C# (instead of VB.Net) - Great fun converting data types!!
Fixed a logic/maths issue with tiling
Now includes a "thumbnailquality" option - set via the registry (value is 1 to 100 - Where 100 does no adjustment))
Now includes a "thumbnailwidth" option - set via the registry that sets the default size if one is
not set via the commandline (instead of using video size)
-------------------------------------------------------------------------------------------------------------------------
Version 61:
Exit level on failure is now -1 (instead of 1)
Can now specify debug mode via commandline ("-debug")
Now supports two modes of aspect ratio:
Thumbnail Aspect Ratio (default option)
In this mode, the final thumbnail aspect ratio will match the source/video aspect ratio. This will mean the individual tile images may be distorted to ensure the overal AR is maintained for the thumbnail. The final thumbnail size should be quite consistant as it will be based on video aspect ratios (16:9, 4:3, etc)
Tile Aspect Ratio (custom option)
In this mode the final thumbnail aspect ratio will not match the source/video aspect ratio. Instead the individual tile image(s) aspect ratios are maintained. This may mean the overall thumbnail AR (dimensions) will be way off. I'm not sure how well MePo will handle it. In this mode having a large differential between rows and columns will make the overall thumbnail size "interesting".
To change from the default mode, to the TileAR mode, create a reg key call "keeptilear" and set it to "1" (or specify "-keeptilear") as a commandline option.
-------------------------------------------------------------------------------------------------------------------------
Version 60:
Refactored the code a little
Dropped the minimum video length to 30 seconds (instead of 60)
Now supports process priority (use a reg key called "priority" and set it to: realtime, abovenormal, belownormal,high, normal,idle) - default is BELOWNORMAL
Has a commandline help feature (mtn.exe --h or -h or -help)
Temporary tile files are now saved into a MTN_Replacement sub directory in "Windows Temp"
Exit level set to 1 on a failure (0 on success)
-------------------------------------------------------------------------------------------------------------------------
Version 59:
Switched to using a more complex process based launching mechanism (instead of shell and external file)
If FFmpeg fails to extract movie details, the program will assume some defaults (duration 300, width 1270)
-------------------------------------------------------------------------------------------------------------------------
Version 56:
Fixed annoying issues with long filenames and spaces (which I thought I had fixed in v55)
-------------------------------------------------------------------------------------------------------------------------
Version 55:
Fixed issues of paths with spaces/long names
-------------------------------------------------------------------------------------------------------------------------
Version 53:
Reverted to FFMpeg for extracting movie details
Fixed stupid timeout mistake (wanted miliseconds I gave it secsonds)
-------------------------------------------------------------------------------------------------------------------------
Version 52:
Tried using MediaInfo to extract details but was taking 20 seconds to open/read a movie of the LAN
-------------------------------------------------------------------------------------------------------------------------
Version 51:
A large rewrite to address issues and performance (wife is not happy about how much time I've spent on it!!)
No longer uses FFmpeg to tile (internally done by code)
Frame grabs are now equally spaced between start and end points
Supports custom suffix
Supports custom output directory
Supports end skip value
If no custom size is specified for thumbnail, the size of the source is used
-------------------------------------------------------------------------------------------------------------------------
Version 50:
Major issue/bug - so not available anymore!!
Program rewritten using VB.Net
-------------------------------------------------------------------------------------------------------------------------
Version 49:
Fixed issue of rows and columns the wrong way around
-------------------------------------------------------------------------------------------------------------------------
Version 48:
Tweaked the "debug" setting - You can either use a "mtn.debug" flag file (in the same directory as the mtn.exe file), or you can create the following reg key: HKLM\Software\MTN\debug (create as a string and set to 1).
To make everyone's life easy, I have included two reg files within the Zip file - these will turn on/off debug (simply double click on either one).
With debug enabled, MTN will create a "mtn_replacement.log" log file in the mtn.exe directory.
---------------------------------------------------------------------------------------------------------------------------
Many thanks,
J.
Attachments
Last edited: