Carny_Priest Posted November 29, 2014 Author Posted November 29, 2014 Thanks. Great idea about batch processing of all tables in a folder. For me, it would be cool to be able to process only tables that I just added to the folder.Next step, though, is figuring out a solution for Future Pinball. I'll look at that over the next couple of weeks. Quote
allknowing2012 Posted December 4, 2014 Posted December 4, 2014 Thanks .. I too used the original script with some small tweaks to go thru all my vp tables. For me it was a simple case of dir *.vpt > files.bat, then editing the files.bat to contain entries like:myscript.ahk sometable.vptmyscript.ahk othertable.vptetc etcWith this I can refresh periodically to capture new tables and new high scores and such in the dmd and backglasses .. Quote
Carny_Priest Posted December 17, 2014 Author Posted December 17, 2014 I haven't had a lot of time to spend on FP capture. I did try NVidia ShadowPlay with FP without luck. As FP uses OpenGl it doesn't appear that any DirectShow devices will pick it up. I have a line on another solution, but I've got a lot on my plate at the moment. I may not be able to test it out until after the holidays. Quote
gamefixer Posted December 27, 2014 Posted December 27, 2014 Hey guys. Am I reading this right? I can use the script in the OP to capture video for use in PinballX previews, right? What if I have a real DMD? Will I need to attach a third monitor to the system temporarily to capture the DMD? Been trying to figure out how to make some video for some tables I have that are missing them. Thanks all! Quote
gamefixer Posted December 27, 2014 Posted December 27, 2014 Well I clearly have no idea what I'm doing. After reading this thread a bit I'm supposed to compile an exe that will execute VP and record the images for me. Problem is I have no idea how to compile the script to an exe.Looking for help or other options. I'd love to be able to contribute to the VP community by making play field, back glass and DMD videos. Quote
chernandez Posted December 27, 2014 Posted December 27, 2014 Download autohotkey http://www.autohotkey.com/ and installIt will have a recorder Copy and paste carny priest script into it change .exe in script if different and any thing else Save it Then go to ahk that saved right click and compile And then you will have you exe also right click and set as administrator Also make sure you install ffmpeg Quote
allknowing2012 Posted December 27, 2014 Posted December 27, 2014 Just a note to say u don't have to compile to an exe you can run the .ahk files just fine if u have windows setup to always run them with autohotkey. While debugging I found it easier to run the ffmpeg commands by hand first to test.When I was ready I ran a batch file that containedGrabscreen.ahk "table1.vpt"Grabscreen.ahk "table2.vpt"EtcI can run the above command each time I add a new table.I created Similar akh scripts for pm5.exe and futurepinball.exe Quote
Carny_Priest Posted December 27, 2014 Author Posted December 27, 2014 Just a note to say u don't have to compile to an exe you can run the .ahk files just fine if u have windows setup to always run them with autohotkey. While debugging I found it easier to run the ffmpeg commands by hand first to test.When I was ready I ran a batch file that containedGrabscreen.ahk "table1.vpt"Grabscreen.ahk "table2.vpt"EtcI can run the above command each time I add a new table.I created Similar akh scripts for pm5.exe and futurepinball.exeYes, this is true if you install autohotkey on your cabinet. I tend to prefer to keep my cabinet clear of any installers, run-time environments, applications that I don't absolutely need. I compile on my test machine and transfer the executable over to the cabinet for use.Now, futurepinball.exe. You are actually able to capture table videos with the script? Quote
Carny_Priest Posted December 28, 2014 Author Posted December 28, 2014 Here's an interim script for FP. It is a concept that will work Ok for plain vanilla Future Pinball set-ups. Adjust the script to your executable accordingly. This also assumes that you are using FutureDMD. If you are not then comment out the line that runs FutureDMD. Although I am calling the table through BAM/fploader, I am not capturing any BAM post-processing, just unprocessed Future Pinball. So, this is not a solution for me and I will have to take a different tack. I always use BAM. There is not a pressing need for me to generate media right now, but I'll get back to this at some point. Might be easier to simply shell out for FRAPS, Camtasia, or dxtory.The tool I am using here is apitracehttps://github.com/apitrace/apitraceI simply extract it to C:\This still uses ffmpeg for generating the final videos.This is a bit kludgy. I use apitrace to capture OpenGl instructions to a file called playfield.trace. I then use apitrace to playback the capture and pipe the output directly to ffmpeg. It is a super long command and it seems like Windows does not properly recognize it as a valid command. I don't see any problems coming from Autohotkey (as in an interpreter issue). I got around this by inserting the command into a separate bat file. #NoEnv #SingleInstance force#WinActivateForceSetTitleMatchMode 2DetectHiddenWindows OnFileReadLine, PF_width, c:\Program Files (x86)\Visual Pinball\Tables\ScreenRes.txt, 1;FileReadLine, PF_height, c:\Program Files (x86)\Visual Pinball\Tables\ScreenRes.txt, 2FileReadLine, BG_width, c:\Program Files (x86)\Visual Pinball\Tables\ScreenRes.txt, 3FileReadLine, BG_height, c:\Program Files (x86)\Visual Pinball\Tables\ScreenRes.txt, 4FileReadLine, DMD_width, c:\Program Files (x86)\Visual Pinball\Tables\ScreenRes.txt, 8FileReadLine, DMD_height, c:\Program Files (x86)\Visual Pinball\Tables\ScreenRes.txt, 9FileReadLine, DMD_X, c:\Program Files (x86)\Visual Pinball\Tables\ScreenRes.txt, 10FileReadLine, DMD_Y, c:\Program Files (x86)\Visual Pinball\Tables\ScreenRes.txt, 11XDMD_X:=BG_width+DMD_X ;Reference to Top Left of Playfield screenTable = %1% ;Variable from FPStringTrimRight, XTable, Table, 4 ;Trim ".fpt" for output file name ;Disable Aero if EnabledRegRead, DWMComp, HKCU, Software\Microsoft\Windows\DWM, CompositionAero = %DWMComp%If Aero = 1Run, sc stop uxsms,,UseErrorLevel Run, "c:\apitrace-msvc\x86\bin\apitrace.exe" trace --output="%A_ScriptDir%\playfield.trace" "c:\Games\Future Pinball\BAM\FPloader.exe" /STAYINRAM /open "c:\Games\Future Pinball\Tables\%Table%" /play /exit /arcaderender,,UseErrorLevelProcess, wait, Future Pinball.exeRun, "c:\Games\Future Pinball\FutureDMD.exe" table=%Table% close=1,,UseErrorLevel; Fastest CaptureRun, ffmpeg -t 100 -rtbufsize 1500M -f gdigrab -framerate 30 -offset_x %PF_width% -offset_y 0 -video_size %BG_width%x%BG_Height% -i desktop -pix_fmt yuv420p -vcodec libx264 -preset ultrafast -threads 8 "%A_ScriptDir%\bg.mkv",,Hide UseErrorLevelIf DMD_width > 0 Run, ffmpeg -t 100 -rtbufsize 1500M -f gdigrab -framerate 30 -offset_x %XDMD_X% -offset_y %DMD_Y% -video_size %DMD_width%x%DMD_Height% -i desktop -pix_fmt yuv420p -vcodec libx264 -preset ultrafast -threads 8 "%A_ScriptDir%\dmd.mkv",,Hide UseErrorLevel WinActivate, Future PinballWinWaitActive, Future Pinball Process, WaitClose, ffmpeg.exe, 100Sleep 5000; CloseFP from FPLaunchWinHide, ahk_class FuturePinballWinMinimize, ahk_class FuturePinball;Future Pinball must be closed this way instead of killing process;or it wil not save your last game information.i.e score/credtisWinActivate, ahk_class FuturePinballOpenGLWinWaitActive, ahk_class FuturePinballOpenGLSend {Esc}WinWaitClose, ahk_class FuturePinballOpenGL;saving fp table position, black screen hides fp window; if (saveFPTables = "true") and (saveFPNeeded = "true") {; ;WinRestore, ahk_class FuturePinball; WinActivate, ahk_class FuturePinball; WinWaitActive, ahk_class FuturePinball; WinMenuSelectItem, ahk_class FuturePinball,,File,Save; Sleep, 1000; }; IfExist %emupath%\FutureDMD.exeProcess, close, FutureDMD.exeWinClose, ahk_class FuturePinballWinWaitClose, ahk_class FuturePinball Sleep 2000; Post Capture Trim and TranscodeRun, %comspec% /c playfield.bat "%A_ScriptDir%\playfield.trace" "C:\PinballX\Media\Future Pinball\Table Videos\%XTable%.f4v",,UseErrorLevelRun, ffmpeg -y -i "%A_ScriptDir%\bg.mkv" -ss 35 -to 95 -c:v libx264 -crf 26 "C:\PinballX\Media\Future Pinball\Backglass Videos\%XTable%.f4v",,UseErrorLevelIf DMD_width > 0 Run, ffmpeg -y -i "%A_ScriptDir%\dmd.mkv" -ss 35 -to 95 -c:v libx264 -crf 26 "C:\PinballX\Media\Future Pinball\DMD Videos\%XTable%.f4v",,UseErrorLevel Process, WaitClose, ffmpeg.exe ; Clean upFileDelete, %A_ScriptDir%\playfield.traceFileDelete, %A_ScriptDir%\bg.mkvIf DMD_width > 0 FileDelete, %A_ScriptDir%\dmd.mkv ;Enable Aero if Enabled at the start of script executionIf Aero = 1Run, sc start uxsms,,UseErrorLevel ExitApp Here are the contents of playfield.bat (all on line 1) "c:\apitrace-msvc\x86\bin\apitrace.exe" dump-images -o - %1 | ffmpeg -r 30 -f image2pipe -vcodec ppm -i pipe: -ss 35 -to 95 -pix_fmt yuv420p -vf "rotate=PI:bilinear=0" -c:v libx264 -crf 26 -y %2 Think of playfield.trace as uncompressed video. The program cleans up after itself but you will need some space on your drive for the capture. Also, playback and pipe to ffmpeg looks like slo-mo when it is happening. The output file will be at normal speed, but it will take four or five minutes to complete the conversion to video. So, not as fast as the VP script. Good luck. The search continues for a BAM-friendlier solution. Quote
allknowing2012 Posted December 29, 2014 Posted December 29, 2014 Yes, this is true if you install autohotkey on your cabinet. I tend to prefer to keep my cabinet clear of any installers, run-time environments, applications that I don't absolutely need. I compile on my test machine and transfer the executable over to the cabinet for use.Now, futurepinball.exe. You are actually able to capture table videos with the script?You are right! I forgot .. it wasnt working for futurepinball. The screen sizes were bigger but the real problem seemed to be that future pinball would take control of the ahk stuff and just stop it or something. Quote
Carny_Priest Posted December 29, 2014 Author Posted December 29, 2014 You are right! I forgot .. it wasnt working for futurepinball. The screen sizes were bigger but the real problem seemed to be that future pinball would take control of the ahk stuff and just stop it or something.Ok, just making sure I wasn't missing something re: future pinball. You might try the newest script I posted. It might even work very well for you if you are not a BAM user. At least it shuts down FP cleanly which might have been one of the problems before this latest version. Quote
Carny_Priest Posted January 29, 2015 Author Posted January 29, 2015 Update:1.Thanks to horseyhorsey/Chepas for the idea of unifying multiple VP executables under one system, I now have a single script that can capture VP media for multiple executables. No need to create different versions of essentially the same script. Sometimes you simply have to capture the table media with the same executable for which it was designed to run. Stern Indiana Jones is a good example.It just requires adding an extra argument if you want to capture using an executable other than the default. For me, I have VPinball991.exe as the default. And I also have Physmod2 and Physmod5.The lines that require editing are the path to the PinballX installation and the ini headers under which the other executables are set up.Ex. PinballX_Path = C:\PinballX; For system use the ini header where you have defined your other Visual Pinball setupssystem2 = System_9 ;PhysMod2system3 = System_4 ;PhysMod5 I have PhysMod2 set up under Other Systems 9 and PhysMod5 set up under Other Systems 4 in the Settings Wizard, Other Systems screen. The command would be capscreensvp.exe "table" arg2 where arg2 is 2 if you want to capture using PhysMod2 or 5 if you want to capture using PhysMod5. Anything else or leaving it blank will run the default. Don't forget that the "table" filename must include the entire file name including the vpt extension. 2.The output file will now save with the same name as the description tag in the xml. For most people that is Table Name (Manufacturer Year). Before, the output file was the same as the file name used as the input. This means that when you capture an update to the table, you no longer have to go back in your media folders and delete out the old versions. If the media file name is the same as the description tag in the xml then it will simply be overwritten.Compiling this requires the script xpath.ahk. A link is in the script. The file must be compiled with xpath.ahk in the same folder as the script, but after that the executable is portable.3.Changed the ffmpeg capture pix_fmt color space parameter from yuv420p to the default which is yuv444p. Just about every media player can play output encoded with yuv420p (most of the media files that I have seen distributed have this format) but the colors produced by the previous ffmpeg command were a bit washed out. This is especially evident with DMD videos in the standard orange color. The Shark codecs don't appear to have a problem playing back the output encoded in yuv444p and the colors are no longer washed out. There's an insignificant increase in file size. I call it a win!#NoEnv #SingleInstance force#WinActivateForce;http://www.autohotkey.net/~Titan/dl/xpath.zip#Include, %A_ScriptDir%\xpath.ahkSetTitleMatchMode 2DetectHiddenWindows On PinballX_Path = C:\PinballX; For system use the ini header where you have defined your other Visual Pinball setupssystem2 = System_9 ;PhysMod2system3 = System_4 ;PhysMod5 Table = %1% ;Variable from VPExeType = %2% If ExeType = 2system = %system2%Else If ExeType = 5system = %system3%Else system = VisualPinball ; Read PinballX config for pathsIf system = VisualPinballName = Visual PinballElse IniRead, Name, %PinballX_Path%\Config\PinballX.ini, %system%, NameIniRead, WorkingPath, %PinballX_Path%\Config\PinballX.ini, %system%, WorkingPathIniRead, TablePath, %PinballX_Path%\Config\PinballX.ini, %system%, TablePathIniRead, Exe, %PinballX_Path%\Config\PinballX.ini, %system%, Executable SplitPath, Table,,,,XTable, ; Read description tag from xml - Thanks horseyhorsey - http://www.gameex.info/forums/topic/14632-multiple-exe-for-vp/#entry129111databaseFile = %PinballX_Path%\Databases\%Name%\%Name%.xmlxpath_load(dbXML, databaseFile ) ; need to read the existing xml otherwise xpath deletes all existing nodesdescription := XPath(dbXML, "/menu/game[@name= . XTable . ]/description/text()") FileReadLine, PF_width, %TablePath%\ScreenRes.txt, 1FileReadLine, PF_height, %TablePath%\ScreenRes.txt, 2FileReadLine, BG_width, %TablePath%\ScreenRes.txt, 3FileReadLine, BG_height, %TablePath%\ScreenRes.txt, 4FileReadLine, DMD_width, %TablePath%\ScreenRes.txt, 8FileReadLine, DMD_height, %TablePath%\ScreenRes.txt, 9FileReadLine, DMD_X, %TablePath%\ScreenRes.txt, 10FileReadLine, DMD_Y, %TablePath%\ScreenRes.txt, 11XDMD_X:=BG_width+DMD_X ;Reference to Top Left of Playfield screen ; Disable Aero if EnabledRegRead, DWMComp, HKCU, Software\Microsoft\Windows\DWM, CompositionAero = %DWMComp%If Aero = 1Run, sc stop uxsms,,UseErrorLevel ;run dc2.exe -configure="%PinballX_Path%\Scripts\dc2config\VPMSettings.xml" Run, %WorkingPath%\%Exe% -play "%TablePath%\%Table%",,UseErrorLevelProcess, wait, %Exe% Sleep, 30000 ; Allow time for table score display to get well beyond loading and boot images ; Fastest CaptureRun, ffmpeg -t 70 -rtbufsize 1500M -f gdigrab -framerate 30 -offset_x 0 -offset_y 0 -video_size %PF_width%x%PF_Height% -i desktop -vcodec libx264 -preset ultrafast -threads 8 "%A_ScriptDir%\playfield.mkv",,Hide UseErrorLevelRun, ffmpeg -t 70 -rtbufsize 1500M -f gdigrab -framerate 30 -offset_x %PF_width% -offset_y 0 -video_size %BG_width%x%BG_Height% -i desktop -vcodec libx264 -preset ultrafast -threads 8 "%A_ScriptDir%\bg.mkv",,Hide UseErrorLevelIf DMD_width > 0 Run, ffmpeg -t 70 -rtbufsize 1500M -f gdigrab -framerate 30 -offset_x %XDMD_X% -offset_y %DMD_Y% -video_size %DMD_width%x%DMD_Height% -i desktop -vcodec libx264 -preset ultrafast -threads 8 "%A_ScriptDir%\dmd.mkv",,Hide UseErrorLevel WinActivate, Visual Pinball PlayerWinWaitActive, Visual Pinball Player Process, WaitClose, ffmpeg.exe, 70Sleep 5000Run, taskkill /IM %Exe% /F,,UseErrorLevel ;run dc2.exe -configure="%PinballX_Path%\Scripts\dc2config\StandardSettings.xml" ; Post Capture Trim and TranscodeRun, ffmpeg -y -i "%A_ScriptDir%\playfield.mkv" -ss 5 -to 65 -vf "rotate=PI:bilinear=0" -c:v libx264 -crf 26 "%PinballX_Path%\Media\Visual Pinball\Table Videos\%description%.f4v",,UseErrorLevelRun, ffmpeg -y -i "%A_ScriptDir%\bg.mkv" -ss 5 -to 65 -c:v libx264 -crf 26 "%PinballX_Path%\Media\Visual Pinball\Backglass Videos\%description%.f4v",,UseErrorLevelIf DMD_width > 0 Run, ffmpeg -y -i "%A_ScriptDir%\dmd.mkv" -ss 5 -to 65 -c:v libx264 -crf 26 "%PinballX_Path%\Media\Visual Pinball\DMD Videos\%description%.f4v",,UseErrorLevel Process, WaitClose, ffmpeg.exe ; Clean upFileDelete, %A_ScriptDir%\playfield.mkvFileDelete, %A_ScriptDir%\bg.mkvIf DMD_width > 0 FileDelete, %A_ScriptDir%\dmd.mkv ; Enable Aero if Enabled at the start of script executionIf Aero = 1Run, sc start uxsms,,UseErrorLevel ExitApp The dc2 lines are there because I run a custom resolution for VPM. Most people don't do that, so I've commented them out here. 1 Quote
chernandez Posted January 30, 2015 Posted January 30, 2015 Carny can you help me Ive been struggling on my dmd to recordI cant not get to record my DMD Ive tried a couple things like changing the XDMD_X to XDMD_X:=3845 to show location of top left of dmd. Ive also deleted the "If DMD_width > 0" in script to see if that works and i cant get dmd to record the BG and PF record fine. Ive tried your new script and same thingAny suggestions would be helpful Thanks again for time put into this because it is nice to record BG and PF so easyChrisHeres My screenres.txt 192010801920108030010244333845690 Quote
Carny_Priest Posted January 30, 2015 Author Posted January 30, 2015 I'm reading in the values of screenres.txt under the assumption that you place the VPM DMD in the same location. For whatever reason I'm thinking that's not the case for your setup.In your screenres.txt I always understood that the third screen LED X offset was in reference to the left corner of the backglass, not the playfield. In other words, to see the LED display on your third screen the value should be 1965. Do you ever use the third screen to display the alpha numeric LED for games like Jokerz and Funhouse or do you always set up so that those are displayed on the backglass?http://www.vpforums.org/index.php?showtopic=18020#entry163516 What are the x and y positions and width and height for the default set up For Visual PinMAME in the registry?I probably should just read these values in from the registry but I do capture the directB2S third screen for my media collection. These just typically don't get published... anywhere. In any case if I'm right just fix your screenres.txt even if you never use the third screen for LED tables. Quote
chernandez Posted January 30, 2015 Posted January 30, 2015 Vpm dmd? Is that vpinmame if so I have that in c:\vpinmameI did try 1965 in X but still nothingI didn't get a Chance to look in registry yetBut all my led table show up on my 3rd screen Quote
chernandez Posted January 30, 2015 Posted January 30, 2015 Heres a shot of my vpinmame registry Quote
chernandez Posted January 30, 2015 Posted January 30, 2015 got it just changed some of the script and now its recordingPF_width:=1920PF_height:=1080BG_width:=1920BG_height:=1080DMD_width:=1022DMD_height:=430DMD_X:=3841DMD_Y:=71XDMD_X:=3841 ;Reference to Top Left of Playfield screen Quote
Carny_Priest Posted January 30, 2015 Author Posted January 30, 2015 Ok, I subtracted wrong somewhere. It shouldn't have been 1965Recall that Visual PinMAME DMD and directB2S are two different and independent systems. What values you assign in screenres.txt does not somehow carry over into the registry or vice-versa.If you are happy with the way your DMD looks, I'd suggest setting up your B2S settings to match. Then, going by your registry values, screenres.txt would be:19201080192010800010224301921710Here, the value for X Position of the LED screen is 1921 instead of 3841 because directB2S is looking for a value in reference to the top corner of the backglass screen and not the playfield screenGive it a try then you will be able to properly record media for your alphanumeric games and for other directB2S backglasses that make use of the third screen (displaying a logo, etc.)Looking at the screenres values, it reminds me that there may be users that use the backglass offsets either because they need to work around a bezel or they have set up multiple screenres.txt to retain correct aspect ratios for translites from different eras. I don't do that. I make use of as much screen real estate as I can. But if there is a need I'll work with anyone who wants to run this script. Quote
Carny_Priest Posted January 30, 2015 Author Posted January 30, 2015 Update:Added some file name handling. Fixed - Xpath code was reading in commas as special characters, , So, A description like "Addams Family, The (Bally 1992)" would have incorrect file names and would not get played by PinballX without having to go in and rename manually.Added - script looks for invalid Windows file name characters. If it finds one then the file name reverts to the input file name (i.e., the value of the game name field). A description like "AC/DC (Stern 2012)" can't be used as the forward slash is an invalid file name character.#NoEnv #SingleInstance force#WinActivateForce;http://www.gameex.info/forums/topic/14632-multiple-exe-for-vp/#entry137471 - Thanks horseyhorsey#Include, %A_ScriptDir%\xpath.ahkSetTitleMatchMode 2DetectHiddenWindows On PinballX_Path = C:\PinballX; For system use the ini header where you have defined your other Visual Pinball setupssystem2 = System_9 ;PhysMod2system3 = System_4 ;PhysMod5 Table = %1% ;Variable from VPExeType = %2% If ExeType = 2system = %system2%Else If ExeType = 5system = %system3%Else system = VisualPinball ; Read PinballX config for pathsIf system = VisualPinballName = Visual PinballElse IniRead, Name, %PinballX_Path%\Config\PinballX.ini, %system%, NameIniRead, WorkingPath, %PinballX_Path%\Config\PinballX.ini, %system%, WorkingPathIniRead, TablePath, %PinballX_Path%\Config\PinballX.ini, %system%, TablePathIniRead, Exe, %PinballX_Path%\Config\PinballX.ini, %system%, Executable SplitPath, Table,,,,XTable, ; Read description tag from xml - Thanks horseyhorsey - http://www.gameex.info/forums/topic/14632-multiple-exe-for-vp/#entry129111databaseFile = %PinballX_Path%\Databases\%Name%\%Name%.xmlxpath_load(dbXML, databaseFile ) ; need to read the existing xml otherwise xpath deletes all existing nodesdescription := XPath(dbXML, "/menu/game[@name= . XTable . ]/description/text()")StringReplace, description, description,,,`,,StringGetPos, pos, description,\If ErrorLevel=1StringGetPos, pos, description,/If ErrorLevel=1StringGetPos, pos, description,:If ErrorLevel=1StringGetPos, pos, description,*If ErrorLevel=1StringGetPos, pos, description,?If ErrorLevel=1StringGetPos, pos, description,"If ErrorLevel=1StringGetPos, pos, description,>If ErrorLevel=1StringGetPos, pos, description,|If ErrorLevel=0description=%XTable% FileReadLine, PF_width, %TablePath%\ScreenRes.txt, 1FileReadLine, PF_height, %TablePath%\ScreenRes.txt, 2FileReadLine, BG_width, %TablePath%\ScreenRes.txt, 3FileReadLine, BG_height, %TablePath%\ScreenRes.txt, 4FileReadLine, DMD_width, %TablePath%\ScreenRes.txt, 8FileReadLine, DMD_height, %TablePath%\ScreenRes.txt, 9FileReadLine, DMD_X, %TablePath%\ScreenRes.txt, 10FileReadLine, DMD_Y, %TablePath%\ScreenRes.txt, 11XDMD_X:=BG_width+DMD_X ;Reference to Top Left of Playfield screen ; Disable Aero if EnabledRegRead, DWMComp, HKCU, Software\Microsoft\Windows\DWM, CompositionAero = %DWMComp%If Aero = 1Run, sc stop uxsms,,UseErrorLevel ;run dc2.exe -configure="%PinballX_Path%\Scripts\dc2config\VPMSettings.xml" Run, %WorkingPath%\%Exe% -play "%TablePath%\%Table%",,UseErrorLevelProcess, wait, %Exe% Sleep, 30000 ; Allow time for table score display to get well beyond loading and boot images ; Fastest CaptureRun, ffmpeg -t 70 -rtbufsize 1500M -f gdigrab -framerate 30 -offset_x 0 -offset_y 0 -video_size %PF_width%x%PF_Height% -i desktop -vcodec libx264 -preset ultrafast -threads 8 "%A_ScriptDir%\playfield.mkv",,Hide UseErrorLevelRun, ffmpeg -t 70 -rtbufsize 1500M -f gdigrab -framerate 30 -offset_x %PF_width% -offset_y 0 -video_size %BG_width%x%BG_Height% -i desktop -vcodec libx264 -preset ultrafast -threads 8 "%A_ScriptDir%\bg.mkv",,Hide UseErrorLevelIf DMD_width > 0 Run, ffmpeg -t 70 -rtbufsize 1500M -f gdigrab -framerate 30 -offset_x %XDMD_X% -offset_y %DMD_Y% -video_size %DMD_width%x%DMD_Height% -i desktop -vcodec libx264 -preset ultrafast -threads 8 "%A_ScriptDir%\dmd.mkv",,Hide UseErrorLevel WinActivate, Visual Pinball PlayerWinWaitActive, Visual Pinball Player Process, WaitClose, ffmpeg.exe, 70Sleep 5000Run, taskkill /IM %Exe% /F,,UseErrorLevel ;run dc2.exe -configure="%PinballX_Path%\Scripts\dc2config\StandardSettings.xml" ; Post Capture Trim and TranscodeRun, ffmpeg -y -i "%A_ScriptDir%\playfield.mkv" -ss 5 -to 65 -vf "rotate=PI:bilinear=0" -c:v libx264 -crf 26 "%PinballX_Path%\Media\Visual Pinball\Table Videos\%description%.f4v",,UseErrorLevelRun, ffmpeg -y -i "%A_ScriptDir%\bg.mkv" -ss 5 -to 65 -c:v libx264 -crf 26 "%PinballX_Path%\Media\Visual Pinball\Backglass Videos\%description%.f4v",,UseErrorLevelIf DMD_width > 0 Run, ffmpeg -y -i "%A_ScriptDir%\dmd.mkv" -ss 5 -to 65 -c:v libx264 -crf 26 "%PinballX_Path%\Media\Visual Pinball\DMD Videos\%description%.f4v",,UseErrorLevel Process, WaitClose, ffmpeg.exe ; Clean upFileDelete, %A_ScriptDir%\playfield.mkvFileDelete, %A_ScriptDir%\bg.mkvIf DMD_width > 0 FileDelete, %A_ScriptDir%\dmd.mkv ; Enable Aero if Enabled at the start of script executionIf Aero = 1Run, sc start uxsms,,UseErrorLevel ExitApp I expect that once there is support in PinballX that the script will work just fine for VP10. It is agnostic as far as file extensions go. Just add a new system at the top of the script. 1 Quote
Jas-o-n Posted January 31, 2015 Posted January 31, 2015 Hi Carny_Priest, your script is cool ! The new feature of different VP Versions is fine...but in PX I have different \media Folders, eg. \media\Visual Pinball and \Media\Physmod (depends on the name given to system_x in the setup. So the Output should go to ..\media \%SystemName%\...and not to .\media\Visual Pinball\... for all systems as it is at the moment. I tried myself, but I did'nt manage to do :-((See Ya... Jas Quote
Carny_Priest Posted January 31, 2015 Author Posted January 31, 2015 I use symbolic links to tie the media folders for the alternate executables to the default. Makes files easier to manage for those times when you update a table to physmod5.If you'd rather keep the media attached to their respective systems, try %Name% instead of %SystemName% 1 Quote
Jas-o-n Posted January 31, 2015 Posted January 31, 2015 I use symbolic links to tie the media folders for the alternate executables to the default. Makes files easier to manage for those times when you update a table to physmod5.If you'd rather keep the media attached to their respective systems, try %Name% instead of %SystemName%Hmm..never userd symlinks in Windows..but like the idea to have only one place for die Media.....i think i'll try it out ...Tnx, Jas.... Quote
Carny_Priest Posted January 31, 2015 Author Posted January 31, 2015 http://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html Quote
Carny_Priest Posted February 1, 2015 Author Posted February 1, 2015 I found that the xpath doesn't appear to match the xml if the input table name has an ampersand, such as "Twilight Zone Night Mod Toys & TV.vpt". I can't think what to do about that. After all, that was the file name given by the author. Just rename the file and game name without the "&". Should work from there. 1 Quote
Carny_Priest Posted February 11, 2015 Author Posted February 11, 2015 Update:1. Now with support for Future Pinball! I'm using Open Broadcaster Software v0.64 beta.https://obsproject.com/You will also need the file in the attachment.Download OBS and copy the contents of the file somewhere. Choose the 32bit or 64bit version. In the folder with the OBS executable, create a folder named 'profiles'. Create a second folder named 'sceneCollection'.Extract the two files in the attachment. Copy FuturePinball.ini to the profiles folder. Copy FuturePinball.xconfig to the sceneCollection folder. Then define in the top of the script the path to the OBS executable. That's it. Anything else needed by the program will be read from the registry and FutureDMD.ini.Capturing in YUV 4:4:4 Planar is disabled in this version of OBS, so the program is setup to capture in full range Planar YUV 4:2:0. In other words, no clipping of blacks or whites and reduced contrast versus what you experience in-game.The profile and config files are set up to produce reference files that have lossless video and the highest quality available audio. I don't use audio myself, but I can't disable audio capture. So, in that spirit...2. ... I've added lossless audio capture for Visual Pinball. This may come free with your audio driver. See this tutorial:http://www.howtogeek.com/howto/39532/how-to-enable-stereo-mix-in-windows-7-to-record-audio/alternately you can see what DirectShow devices are already available. The command is:ffmpeg -list_devices true -f dshow -i dummySelect a device and type it in quotes in the Audio_Device line at the top of the scriptIf your audio driver doesn't support Stereo Mix output, you can use this capturer:https://github.com/rdp/virtual-audio-capture-grabber-deviceIf you don't want to capture audio at all there is an alternate command that is commented out in the script that captures without audio.3. Tweaked the ffmpeg VP captures to ensure that they are lossless4. Fixed the link to the xpath library at the top of the script5. Tweaked to be a little more portable. Add your path to ffmpeg at the top of the script. Now you don't have to keep ffmpeg in your cabinet or change your environment path.As in the earlier script, there is a second pass that transcodes the reference files to final output and saves them in the correct media folders. Then it deletes the reference files. The idea is that you can always comment out the lines that delete these files if you want to use them in your own editing software.The quality levels I selected produce table files somewhere around 10Mb for 1920x1080 resolution. The audio streams are stripped back out. File sizes can get a bit larger if you are running Future Pinball at higher resolutions and downsampling.One other note: I don't know whether it is a feature or a bug with OBS (seeing how it was not really designed for recording video but for streaming video), but I'm running the script off of a portable drive that also has OBS. That's how I transfer files over to my cabinet. I don't use OBS for anything else, so I don't need a permanent installation on my cabinet. I found that I have to unplug and plug back in my drive in between FP captures. Otherwise, OBS will only capture audio and not video. So batching up runs is out for me. Not a huge deal for me as I don't have many FP tables. It's not really working for me to try to do everything off of my local SSD. So, fair warning. I have absolutely no issues with VP captures.If worse comes to worse, it is possible to cycle a USB port programmatically. But I'll just see if this improves in the future with updates to OBS.#NoEnv #SingleInstance force#WinActivateForce;http://www.gameex.info/forums/topic/14632-multiple-exe-for-vp/#entry137471- Thanks horseyhorsey #Include, %A_ScriptDir%\xpath.ahkSetTitleMatchMode 2DetectHiddenWindows On PinballX_Path = c:\PinballX; For system use the ini header where you have defined your other Visual Pinball setupssystem2 = System_9 ;PhysMod2system3 = System_4 ;PhysMod5 FFMPEG_Path = c:\FFMPEG\binOBS_Path = c:\OBS\64bitAudio_Device = "Stereo Mix (Realtek High Defini" Table = %1% ;Table filenameExeType = %2% SplitPath, Table,,,ext,XTable, If ExeType = 2system = %system2%Else If ExeType = 5system = %system3%Else If ext = fptsystem = FuturePinballElse system = VisualPinball ; Read PinballX config for pathsIf system = VisualPinballName = Visual PinballElse If system = FuturePinballName = Future PinballElse IniRead, Name, %PinballX_Path%\Config\PinballX.ini, %system%, NameIniRead, WorkingPath, %PinballX_Path%\Config\PinballX.ini, %system%, WorkingPathIniRead, TablePath, %PinballX_Path%\Config\PinballX.ini, %system%, TablePathIniRead, Exe, %PinballX_Path%\Config\PinballX.ini, %system%, Executable If ext = fpt{RegRead, PF_width, HKCU, Software\Future Pinball\GamePlayer, WidthRegRead, PF_height, HKCU, Software\Future Pinball\GamePlayer, HeightRegRead, BG_width, HKCU, Software\Future Pinball\GamePlayer, SecondMonitorWidthRegRead, BG_height, HKCU, Software\Future Pinball\GamePlayer, SecondMonitorHeight IniRead, DMD_width, %WorkingPath%\FutureDMD.ini, default, SizeWIniRead, DMD_height, %WorkingPath%\FutureDMD.ini, default, SizeHIniRead, DMD_X, %WorkingPath%\FutureDMD.ini, default, PosXIniRead, DMD_Y, %WorkingPath%\FutureDMD.ini, default, PosY IniWrite, %PF_width%, %OBS_Path%\profiles\FuturePinball.ini, Video, BaseWidth IniWrite, %PF_height%, %OBS_Path%\profiles\FuturePinball.ini, Video, BaseHeight IniWrite, %A_ScriptDir%\playfield.mp4, %OBS_Path%\profiles\FuturePinball.ini, Publish, SavePath IniWrite, %A_ScriptDir%\Replay-$T.flv, %OBS_Path%\profiles\FuturePinball.ini, Publish, ReplayBufferSavePath FileRead, Text, %OBS_Path%\sceneCollection\FuturePinball.xconfig ; Read file and return as var TextIfNotInString, Text, %PF_width%IfNotInString, Text, %PF_height%{IfInString, Text, 1280IfInString, Text, 1024 {StringReplace, Text, Text, 1280, %PF_width%, AllStringReplace, Text, Text, 1024, %PF_height%, AllFileDelete, %OBS_Path%\sceneCollection\FuturePinball.xconfigFileAppend, %Text%, %OBS_Path%\sceneCollection\FuturePinball.xconfiginit=1}If init != 1{MsgBox Warning playfield width/height do not match FuturePinball.xconfigExitApp}}}Else{FileReadLine, PF_width, %TablePath%\ScreenRes.txt, 1FileReadLine, PF_height, %TablePath%\ScreenRes.txt, 2FileReadLine, BG_width, %TablePath%\ScreenRes.txt, 3FileReadLine, BG_height, %TablePath%\ScreenRes.txt, 4FileReadLine, DMD_width, %TablePath%\ScreenRes.txt, 8FileReadLine, DMD_height, %TablePath%\ScreenRes.txt, 9FileReadLine, XDMD_X, %TablePath%\ScreenRes.txt, 10FileReadLine, DMD_Y, %TablePath%\ScreenRes.txt, 11DMD_X:=BG_width+XDMD_X ;Reference to Top Left of Playfield screen} ; Read description tag from xml - Thanks horseyhorsey - http://www.gameex.info/forums/topic/14632-multiple-exe-for-vp/#entry129111databaseFile = %PinballX_Path%\Databases\%Name%\%Name%.xmlxpath_load(dbXML, databaseFile ) ; need to read the existing xml otherwise xpath deletes all existing nodesdescription := XPath(dbXML, "/menu/game[@name= . XTable . ]/description/text()")StringReplace, description, description,,,`,,StringGetPos, pos, description,\If ErrorLevel=1StringGetPos, pos, description,/If ErrorLevel=1StringGetPos, pos, description,:If ErrorLevel=1StringGetPos, pos, description,*If ErrorLevel=1StringGetPos, pos, description,?If ErrorLevel=1StringGetPos, pos, description,"If ErrorLevel=1StringGetPos, pos, description,>If ErrorLevel=1StringGetPos, pos, description,|If ErrorLevel=0description=%XTable% ;Disable Aero if EnabledRegRead, DWMComp, HKCU, Software\Microsoft\Windows\DWM, CompositionAero = %DWMComp%If Aero = 1Run, sc stop uxsms,,UseErrorLevel ;If ext = fpt; Run, "%PinballX_Path%\Scripts\dc2.exe" -configure="%PinballX_Path%\Scripts\dc2config\FPSettings.xml";Else ; Run, "%PinballX_Path%\Scripts\dc2.exe" -configure="%PinballX_Path%\Scripts\dc2config\VPMSettings.xml" If ext = fpt{Run, %WorkingPath%\%Exe% /STAYINRAM /open "%TablePath%\%Table%" /play /exit,,UseErrorLevelProcess, wait, Future Pinball.exeIf DMD_width>0Run, %WorkingPath%\FutureDMD.exe table="%Table%" close=1,,UseErrorLevel}Else{Run, %WorkingPath%\%Exe% -play "%TablePath%\%Table%",,UseErrorLevelProcess, wait, %Exe%} Sleep, 30000 ; Allow time for table score display to get well beyond loading and boot images ; Fastest CaptureIf ext = fptRun, %OBS_Path%\OBS.exe -portable -profiles "FuturePinball" -start,,Hide UseErrorLevel ElseRun, ffmpeg -t 70 -rtbufsize 1500M -f dshow -i audio=%Audio_Device% -f gdigrab -framerate 30 -offset_x 0 -offset_y 0 -video_size %PF_width%x%PF_height% -i desktop -vcodec libx264 -preset ultrafast -qp 0 -acodec copy -threads 8 "%A_ScriptDir%\playfield.mkv",,Hide UseErrorLevel; Run, ffmpeg -t 70 -rtbufsize 1500M -f gdigrab -framerate 30 -offset_x 0 -offset_y 0 -video_size %PF_width%x%PF_height% -i desktop -vcodec libx264 -preset ultrafast -qp 0 -threads 8 "%A_ScriptDir%\playfield.mkv",,Hide UseErrorLevelRun, ffmpeg -t 70 -rtbufsize 1500M -f gdigrab -framerate 30 -offset_x %PF_width% -offset_y 0 -video_size %BG_width%x%BG_height% -i desktop -vcodec libx264 -preset ultrafast -qp 0 -threads 8 "%A_ScriptDir%\bg.mkv",,Hide UseErrorLevelIf DMD_width > 0 Run, ffmpeg -t 70 -rtbufsize 1500M -f gdigrab -framerate 30 -offset_x %DMD_X% -offset_y %DMD_Y% -video_size %DMD_width%x%DMD_height% -i desktop -vcodec libx264 -preset ultrafast -qp 0 -threads 8 "%A_ScriptDir%\dmd.mkv",,Hide UseErrorLevel If ext = fpt{WinHide, ahk_class FuturePinballWinMinimize, ahk_class FuturePinballWinActivate, ahk_class FuturePinballOpenGLWinWaitActive, ahk_class FuturePinballOpenGLWinHide, ahk_class ButtonWinHide, ahk_class Shell_TrayWnd}Else {WinActivate, Visual Pinball PlayerWinWaitActive, Visual Pinball Player} Process, WaitClose, ffmpeg.exe, 80Process, Close, %ErrorLevel%WinClose, ahk_class OBSWindowClass If ext = fpt{Sleep 15000Run, taskkill /IM OBS.exe /F,,UseErrorLevel ; CloseFP from FPLaunchWinHide, ahk_class FuturePinballWinMinimize, ahk_class FuturePinball;Future Pinball must be closed this way instead of killing process;or it wil not save your last game information.i.e score/credtisWinActivate, ahk_class FuturePinballOpenGLWinWaitActive, ahk_class FuturePinballOpenGLSend {Esc}WinWaitClose, ahk_class FuturePinballOpenGL;saving fp table position, black screen hides fp window; if (saveFPTables = "true") and (saveFPNeeded = "true") {; ;WinRestore, ahk_class FuturePinball; WinActivate, ahk_class FuturePinball; WinWaitActive, ahk_class FuturePinball; WinMenuSelectItem, ahk_class FuturePinball,,File,Save; Sleep, 1000; }; IfExist %emupath%\FutureDMD.exeProcess, close, FutureDMD.exeWinClose, ahk_class FuturePinballWinWaitClose, ahk_class FuturePinball WinShow, ahk_class ButtonWinShow, ahk_class Shell_TrayWnd}Else Run, taskkill /IM %Exe% /F,,UseErrorLevel ;Run, "%PinballX_Path%\Scripts\dc2.exe" -configure="%PinballX_Path%\Scripts\dc2config\StandardSettings.xml" ;Enable Aero if Enabled at the start of script executionIf Aero = 1Run, sc start uxsms,,UseErrorLevel ; Post Capture Trim and TranscodeIf ext = fpt{Run, ffmpeg -y -i "%A_ScriptDir%\playfield.mp4" -ss 5 -to 65 -vf "rotate=PI:bilinear=0" -map 0:1 -c:v libx264 -crf 26 "%PinballX_Path%\Media\Future Pinball\Table Videos\%description%.f4v",,UseErrorLevelRun, ffmpeg -y -i "%A_ScriptDir%\bg.mkv" -ss 5 -to 65 -c:v libx264 -crf 26 "%PinballX_Path%\Media\Future Pinball\Backglass Videos\%description%.f4v",,UseErrorLevelIf DMD_width > 0 Run, ffmpeg -y -i "%A_ScriptDir%\dmd.mkv" -ss 5 -to 65 -c:v libx264 -crf 26 "%PinballX_Path%\Media\Future Pinball\DMD Videos\%description%.f4v",,UseErrorLevel}Else{Run, ffmpeg -y -i "%A_ScriptDir%\playfield.mkv" -ss 5 -to 65 -vf "rotate=PI:bilinear=0" -map 0:0 -c:v libx264 -crf 26 "%PinballX_Path%\Media\Visual Pinball\Table Videos\%description%.f4v",,UseErrorLevelRun, ffmpeg -y -i "%A_ScriptDir%\bg.mkv" -ss 5 -to 65 -c:v libx264 -crf 26 "%PinballX_Path%\Media\Visual Pinball\Backglass Videos\%description%.f4v",,UseErrorLevelIf DMD_width > 0 Run, ffmpeg -y -i "%A_ScriptDir%\dmd.mkv" -ss 5 -to 65 -c:v libx264 -crf 26 "%PinballX_Path%\Media\Visual Pinball\DMD Videos\%description%.f4v",,UseErrorLevel} Process, WaitClose, ffmpeg.exe ; Clean upFileDelete, %A_ScriptDir%\playfield.mp4FileDelete, %A_ScriptDir%\playfield.mkvFileDelete, %A_ScriptDir%\bg.mkvIf DMD_width > 0 FileDelete, %A_ScriptDir%\dmd.mkv ExitApp FuturePinballOBS.zip 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.