ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

batch create image contact sheet from videofiles?

<< < (2/6) > >>

Nod5:
Nighted,
Thanks a lot! Media Player Classic suits my needs.

Media Player Classic
http://sourceforge.net/projects/guliverkli/
has the image grabbing features I requested (handles many video formats, interval screencaps of the sort "X number of frameshots", timestamps, specification of output file width) and it generates a contact sheet.

Its command line parameters doesn't include commmands for contact sheet creation. But I wrote an AutoHotkey script that allows batch usage.

edit: old code hidden
Spoiler
--- ---; AutoHotkey script to generate image contact sheets from a batch of video files


; --- INSTRUCTIONS ----
; 1. get Media Player Classic (MPC).
;    Load a video in MPC, then do File > Save Thumbnails...
;    Then set parameters in the save dialog (row/line, width, file format) and save the file.
;    The entered parameters now become default.
; 2. Put full paths to all target video files in flist.txt (one path on each line)
; 3. Set script parameters
; 4. Run script
;    note: don't use the computer for other purposes while running the script
;    since the script sends keyboard input to the active window



; --- SCRIPT PARAMETERS ----
xmpcpath =
xflistpath =
xoutputfolder =
xoutput_to_same_folder_as_source = 0
xsave_thumb_dialog_win_title =
xoutputfileprefix =
xoutputfilesuffix =

;examples:
; xmpcpath = C:\program\MPC\mplayerc.exe
;xflistpath = C:\some folder\flist.txt
;xoutputfolder = C:\some folder\
;xoutput_to_same_folder_as_source = 1   --> yes
;xoutput_to_same_folder_as_source = 0   --> no
; xsave_thumb_dialog_win_title = Spara som   
; needed since save thumbnail dialog window title varies with install language
;xoutputfileprefix = some_prefix_
;outputfilesuffix = some suffix
;----------------------------


; --- ACTUAL SCRIPT START ----
FileRead, xflist_contents, %xflistpath%

;--------------------------------------------
Loop, parse, xflist_contents,`n
{
If A_LoopField =
 continue   ;skip empty line at end

xfpath = %A_LoopField%
SplitPath, xfpath, xfname ,xffolder,,xfnameNoExt
run %xmpcpath% "%xfpath%"

WinWait,ahk_class MediaPlayerClassicW
Sleep, 1000
SendInput {Space}
SendInput !F
SendInput {Up 7}
SendInput {Enter}
WinWaitActive, %xsave_thumb_dialog_win_title%

If xoutput_to_same_folder_as_source = 1
 xoutputfolder = %xffolder%

SendInput %xoutputfolder%\%xoutputfileprefix%%xfnameNoExt%%xoutputfilesuffix%
SendInput {Enter}

Loop
{
IfExist, %xoutputfolder%\%xoutputfileprefix%%xfnameNoExt%%xoutputfilesuffix%.jpg
break
IfExist, %xoutputfolder%\%xoutputfileprefix%%xfnameNoExt%%xoutputfilesuffix%.bmp
break
sleep 1000
}
WinClose, ahk_class MediaPlayerClassicW
WinWaitClose, ahk_class MediaPlayerClassicW
}
;--------------------------------------------
I did a testrun on a couple of video files without problems. Will try to run it on all my videos later tonight.

edit:
I just ran the script on 30+ video files and all seems to work fine. I also updated the script a bit. I edited this post so that the old script is hidden (above). Here's the new script:


--- ---; AutoHotkey script to generate image contact sheets from a batch of video files in Media Player Classic

xinstructions =
(
--- INSTRUCTIONS ----
1. Get Media Player Classic, http://sourceforge.net/projects/guliverkli/
   mpplayerc.exe path: C:\program\MPC (or) Scriptfolder (or) specify in script parameters
2. Make flist.txt with list of video file paths (one path per line)
   flist.txt path: Scriptfolder (or) specify in script parameters
3. Set other script parameters (or use defaults)
4. Run script
)

; --- SCRIPT PARAMETERS --------------------------------
IfExist, C:\program\MPC\mplayerc.exe
 xmpcpath = C:\program\MPC\mplayerc.exe
IfExist, %A_ScriptDir%\mplayerc.exe
 xmpcpath = %A_ScriptDir%\mplayerc.exe

; ------------------------ path to media player classic
; xmpcpath =
; ------------------------

If xmpcpath =
{
msgbox, error: mpplayerc.exe not found.
exitapp
}
IfExist, %A_ScriptDir%\flist.txt
 xflistpath = %A_ScriptDir%\flist.txt

; ------------------------ path to flist.txt
; xflistpath =
; ------------------------

If xflistpath =
{
FileSelectFile, xflistpath,3,,Select textfile that contains list of video file paths
if xflistpath =
exitapp
}
; ------------------------ other script parameters
xoutputfolder = %A_Desktop%
xoutput_to_same_folder_as_source = 1
xcreate_even_if_contactsheet_exists = 0
xoutputfileprefix =
xoutputfilesuffix =_cs
xrows = 7
xcols = 3
xwidth = 1000
; ------------------------
;examples:
;xoutputfolder = C:\some folder\
;xoutput_to_same_folder_as_source = 1   --> yes --> no need to set xoutputfolder
;xoutput_to_same_folder_as_source = 0   --> no
;xcreate_even_if_contactsheet_exists = 0 --> don't create if already exists (= file with matching file name exists)
;xcreate_even_if_contactsheet_exists = 1 --> create new (overwrites outputfolder)
;xoutputfileprefix = some_prefix_
;outputfilesuffix = some suffix
;xrows = 7
;xcols = 3
;xwidth = 1000
;----------------------------


; --- ACTUAL SCRIPT START ----
msgbox, 1,,
(
%xinstructions%

current parameters:
xmpcpath = %xmpcpath%
xflistpath = %xflistpath%
xoutputfolder = %xoutputfolder%
xoutput_to_same_folder_as_source = %xoutput_to_same_folder_as_source%
xcreate_even_if_contactsheet_exists = %xcreate_even_if_contactsheet_exists%
xoutputfileprefix = %xoutputfileprefix%
xoutputfilesuffix = %xoutputfilesuffix%

Click OK to run script
)
IfMsgBox, Cancel
exitapp

FileRead, xflist_contents, %xflistpath%

;--------------------------------------------
Loop, parse, xflist_contents,`n
{
If A_LoopField =
 continue   ;skip empty line at end

xfpath = %A_LoopField%
SplitPath, xfpath, xfname ,xffolder,,xfnameNoExt

If xoutput_to_same_folder_as_source = 1
 xoutputfolder = %xffolder%

If xcreate_even_if_contactsheet_exists = 0
{
IfExist, %xoutputfolder%\%xoutputfileprefix%%xfnameNoExt%%xoutputfilesuffix%.jpg
continue
IfExist, %xoutputfolder%\%xoutputfileprefix%%xfnameNoExt%%xoutputfilesuffix%.bmp
continue
}

run %xmpcpath% /open "%xfpath%"
WinWait,ahk_class MediaPlayerClassicW
#WinActivateForce
WinActivate, ahk_class MediaPlayerClassicW
WinWaitActive, ahk_class MediaPlayerClassicW
Sleep, 1000

;0x111=command   wparam 888 lparam 0 = open save thumbs...
SendMessage, 0x111, 808, 0, , ahk_class MediaPlayerClassicW

WinWait, ahk_class #32770,Image width:,4
IfWinNotExist, ahk_class #32770,Image width:
{
SendMessage, 0x111, 808, 0, , ahk_class MediaPlayerClassicW   ;2nd try
WinWait, ahk_class #32770,Image width:
}

ControlSetText, Edit1,%xoutputfolder%\%xoutputfileprefix%%xfnameNoExt%%xoutputfilesuffix%, ahk_class #32770,Image width:
ControlSetText, Edit2, %xrows%, ahk_class #32770,Image width:
ControlSetText, Edit3, %xcols%, ahk_class #32770,Image width:
ControlSetText, Edit4, %xwidth%, ahk_class #32770,Image width:
ControlClick, Button2, ahk_class #32770,Image width:

Loop
{
IfExist, %xoutputfolder%\%xoutputfileprefix%%xfnameNoExt%%xoutputfilesuffix%.jpg
break
IfExist, %xoutputfolder%\%xoutputfileprefix%%xfnameNoExt%%xoutputfilesuffix%.bmp
break
sleep 1000
}

WinClose, ahk_class MediaPlayerClassicW
WinWaitClose, ahk_class MediaPlayerClassicW
}
;--------------------------------------------

Nighted:
Yeah, MPC really kicks ass, no other words can emphasize it more. It's amazing how much they packed into that player.  Hopefully you'll use it to watch videos too because it really is it's best feature! ;)

Nod5:
Nah, I don't have time to watch the videos. I'm busy archiving them properly  ;D
More seriously, I've used VLC for a long time and I think I'll stick to that. But Media Player Classic has many of the same qualities it seems (no fancy, bloated GUI, works with almost all files and so on). Thanks again for bringing it up. :Thmbsup:

Nod5:
After updating this script a lot and making a GUI I now present:
VideoContactSheet
 
Read more and download here http://nod5.dcmembers.com/videocontactsheet.html

Can someone with Vista tell me if VideoContactSheet works as it should there?

nixx_nl:
Yo Nod5 amazing scripting, I needed it badly.
am using it now to catalog my inspiration footage :)

Can you make it to accept any extention?

Have to rename my quicktimes to wmv for it to work (mpc can play QT)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version