| | #1 (permalink) |
| Portal User Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
| While waiting for a video thumbnail/preview plugin you can use this Jscript to create thumbnails for your movies. You need Avisynth Open notepad, paste the code and save as ThumbnailCreator.js Edit the settings and doubleclick it EDIT orry code format is wrong, please download the zip file (next post)(Or break the lines js style...) Code: /*########## Dirty ThumbnailCreator Script by MonsterMagnet ################################################
############################################################################################################
### Best viewed >= 1024x768
### Requires Avisynth 2.5 (http://sourceforge.net/projects/avisynth2/)(tested with 2.56 and 2.57)
### and mplayer2 (included in WinXP C:\Programme\Windows Media Player\mplayer2.exe).
### This script creates thumbnail and preview images from your movies, for use with Mediaportal.
### Only missing thumbs or previews are created.(so you can run this script every time you add new movies !)
### 100 movie thumbs and 100 previews are created in 3:10 min (Athlon64 3500).
### TIP 1: Try this script with a test movie directory.
### TIP 2: You can use this script inside Mediaportal with the MyPrograms plugin.
### TIP 3: In directory: C:\Programme\Team MediaPortal\MediaPortal\Skin\BlueTwo\myvideo.xml change
### <import>common.facade.video.xml</import> to <import>common.facade.pictures.xml</import>
### TIP 4: Eventghost.org (open-source automation tool for MS Windows, supports infrared or wireless remotes)
#############################################################################################################
############ SETTINGS (Edit carefully !!!) ################################################################*/
/*----------- Path to AviSynth "DirectShowSource.dll" (double backslashes !) --------------------------------
-----------------------------------------------------------------------------------------------------------*/
var AviSynth = "C:\\Programme\\AviSynth 2.5\\plugins"
/*----------- VideoFrame to use as thumbnail (use lower value for small and higher for large files !) -------
-----------------------------------------------------------------------------------------------------------*/
var imageframe = 500
/*----------- MediaPortal video title thumbnail directory (double backslashes !) ----------------------------
-----------------------------------------------------------------------------------------------------------*/
var MPdir = "C:\\Programme\\Team MediaPortal\\MediaPortal\\Thumbs\\videos\\Title"
/*----------- Directories to scan (double backslashes !, remove leading double slashes for more directories!)
-----------------------------------------------------------------------------------------------------------*/
dirs = new Array();
dirs[0] = "F:\\Shared saved\\Movies"
//dirs[1] = "D:\\Test2"
//dirs[2] = "E:\\Test3"
//dirs[3] = "F:\\Test4"
/*---------- Mplayer exe path (Only edit if mplayer2 was not found or you want to use another player --------
------------ (no blanks !, double backslashes !) ------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------*/
var mplayer ="mplayer2.exe"
/*############# END SETTINGS ################################################################################
###########################################################################################################*/
var counterS = 0;
var counterL = 0;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var wshshell = new ActiveXObject("Wscript.shell");
function scan ()
{
for (i=0; i < dirs.length; i++)
{
scandir (dirs[i])
}
wshshell.Popup(counterS + " Thumbnails and " + counterL + " Preview images created", 1, "ThumbnailCreator", 0+64)
}
function scandir( dir )
{
if (fso.FolderExists( dir ) == true)
{
var srcFolder = fso.GetFolder( dir );
var files = new Enumerator( srcFolder.files );
do
{
var ext = fso.GetExtensionName (files.item());
ext = ext.toLowerCase();
if (ext == "avi" || ext == "mpg" || ext == "wmv" || ext == "rmvb" || ext == "mov")
{
var search = files.item().name.lastIndexOf(".");
var part = files.item().name.substring(0,search);
var thumbS = part + ".jpg";
var thumbL = part + "L.jpg";
if (fso.FileExists(dir + '\\' + thumbS) == false && fso.FileExists(MPdir + '\\' + thumbS) == false)
{
var tf = fso.CreateTextFile(AviSynth + "\\Tempscript.avs",true)
tf.WriteLine('LoadPlugin ("' +AviSynth+ '\\DirectShowSource.dll")')
tf.WriteLine('input=(DirectShowSource("'+files.item().path+ '", fps=25, seek=true, audio=false))')
tf.WriteLine("converttorgb24(input)")
tf.WriteLine("Crop(16, 16, -16, -16)")
tf.WriteLine("BilinearResize(128,96)")
tf.WriteLine('Trim(' + imageframe + ',' + imageframe + ')')
tf.WriteLine('ImageWriter("' +AviSynth+ '\\" ,0,0,"jpg")')
tf.Close()
wshshell.run (mplayer + " /play /close " +AviSynth+ "\\Tempscript.avs",7, true)
fso.CopyFile (AviSynth + '\\000000.jpg',dir + '\\' + thumbS)
counterS++;
}
if (fso.FileExists(dir + '\\' + thumbL) == false && fso.FileExists(MPdir + '\\' + thumbL) == false)
{
var tf = fso.CreateTextFile(AviSynth + "\\Tempscript.avs",true)
tf.WriteLine('LoadPlugin ("' +AviSynth+ '\\DirectShowSource.dll")')
tf.WriteLine('input=(DirectShowSource("'+files.item().path+ '", fps=25, seek=true, audio=false))')
tf.WriteLine("converttorgb24(input)")
tf.WriteLine("Crop(16, 16, -16, -16)")
tf.WriteLine("BilinearResize(512,384)")
tf.WriteLine('Trim(' + imageframe + ',' + imageframe + ')')
tf.WriteLine('ImageWriter("' +AviSynth+ '\\" ,0,0,"jpg")')
tf.Close()
wshshell.run (mplayer + " /play /close " +AviSynth+ "\\Tempscript.avs",7, true)
fso.CopyFile (AviSynth + '\\000000.jpg',dir + '\\' + thumbL)
counterL++;
}
}
files.moveNext();
}
while (!files.atEnd() );
}
}
scan()
Last edited by MonsterM; 2007-04-20 at 16:39. Reason: Code format |
| | |
| |
| | #3 (permalink) |
| Portal Member Join Date: Jul 2005 Location: Copenhagen Age: 36
Posts: 57
Thanks: 2
Thanked 1 Time in 1 Post
Country: | Hi, Thank you for a perfect script :-) ....do you know what kind of files it supports? ....do you know how to get it to support .m2t files? Best regards, Jesper |
| | |
| | #4 (permalink) |
| Portal User Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
| Hello, i don't have movies in m2t format, so i can't test it but you can give it a try, just change Code: if (ext == "avi" || ext == "mpg" || ext == "wmv" || ext == "rmvb" || ext == "mov") Code: if (ext == "avi" || ext == "mpg" || ext == "wmv" || ext == "rmvb" || ext == "mov" || ext == "m2t") http://avisynth.org/DirectShowSource |
| | |
![]() |
| Bookmarks |
| Tags |
| script, thumbnails, video |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Thumbnails, album & video cover art | frodo | Tips and Tricks | 29 | 2008-05-14 22:04 |
| Where are the My Video thumbnails stored at? | Jeomite | Support | 2 | 2007-03-04 22:30 |
| No Video thumbnails? | Lexen | Support | 9 | 2007-02-12 19:32 |
| Video thumbnails create multiple threads | gloomyandy | 0.2.0.0 Final and SVN Builds | 6 | 2006-12-31 18:02 |
| My Video Thumbnails | dman_lfc | Improvement Suggestions | 5 | 2004-10-20 17:46 |