2010-03-01, 01:43 AM 
(This post was last modified: 2010-03-01, 02:15 AM by luttrell1962.)
	
	
	
		I wrote some xbasic code and batch files to process mulitple ffmpeg 2 pass conversions.  3 uses 75-100 cpu time depending on the type of conversion.
xbasic code I had some printing going on but I commented that out you may want to use it to debug this if you choose.
Batch file to be called by GB-PVR it has code that waits untils projectx preprocesses the file. At the third instance it waits for it or one of the other 3 process's to complete before returning to GBPVR
Multipass ffmpeg batch file. I do preprocessing of the file with projectx. I pass a log file prefix one,two,three so that log files are kept separate.
	
	
	
xbasic code I had some printing going on but I commented that out you may want to use it to debug this if you choose.
Code:
' ####################
' #####  PROLOG  #####
' ####################
'
PROGRAM    "multiconv"
VERSION    "0.0001"
'
IMPORT    "xst"
'
DECLARE FUNCTION  Entry ()
'
'
' ######################
' #####  Entry ()  #####
' ######################
'
FUNCTION  Entry ()
'
    XstGetCommandLine (@command$)
    XstGetCommandLineArguments (@argc, @argv$[])
'
'########################################################
' Fix input file names from GB-PVR So they can be passed
' to a batch file
'########################################################
'
    DIM file1$[1]
    DIM file2$[1]
    DIM ffmpeg1$[1]
    DIM ffmpeg2$[1]
    DIM ffmpeg3$[1]
    file1$=""
    file2$=""
    iptr=1
XstHideConsole()
'
'***********************************************************
    DO
        IF LEN(file1$) > 0 THEN file1$=file1$+" "
        file1$=file1$+argv$[iptr]
        iptr=iptr+1
    LOOP UNTIL RIGHT$(file1$,1) == CHR$(34) 'Quote mark
    DO
        IF LEN(file2$) > 0 THEN file2$=file2$+" "
        file2$=file2$+argv$[iptr]
        iptr=iptr+1
    LOOP UNTIL RIGHT$(file2$,1) == CHR$(34) 'Quote mark
'************************************************************
'
' Check for first log file then second 2 pass log file if
' If first or second log file does not exist then spawn
' divx2pass.bat else do not spawn third instance. But execute
' and wait for completion of it and all log files then start
' over.
'
'************************************************************
ffmpeg1$=":divx2pass.bat "+file1$+" "+file2$+" one"
ffmpeg2$=":divx2pass.bat "+file1$+" "+file2$+" two"
ffmpeg3$=":divx2pass.bat "+file1$+" "+file2$+" three"
XstChangeDirectory("third party")
    XstGetFileAttributes("one-0.log",@attributes)
    IFZ attributes THEN            'file does not exist
        SHELL(ffmpeg1$)
'            PRINT ffmpeg1$
'            PRINT "Wait Until ProjectX finshes processing file"
    ELSE
        XstGetFileAttributes("two-0.log",@attributes)
            IFZ attributes THEN            'file does not exist
                SHELL(ffmpeg2$)
'                PRINT ffmpeg2$
'                PRINT "Wait Until ProjectX finshes processing file"
            ELSE
                SHELL(ffmpeg3$)                'Wait for third pass to complete
'                PRINT ffmpeg3$
'                PRINT "Wait Until ProjectX finshes processing file"
            END IF
    ENDIF
END FUNCTION
END PROGRAMBatch file to be called by GB-PVR it has code that waits untils projectx preprocesses the file. At the third instance it waits for it or one of the other 3 process's to complete before returning to GBPVR
Code:
cd "\program files (x86)\Devnz\GBPVR\Third Party"
REM *****************************************************
REM Determine current run instance by created log file
REM******************************************************
IF NOT EXIST one-0.log SET logfile=one-0.log
IF NOT EXIST one-0.log GOTO logfiledone
IF NOT EXIST two-0.log SET logfile=two-0.log
IF NOT EXIST two-0.log GOTO logfiledone
IF NOT EXIST three-0.log SET logfile=three-0.log
IF NOT EXIST three-0.log GOTO logfiledone
:logfiledone
multiconv.exe %1 %2
REM *****************************************************
REM Wait for Project.x to process file
REM******************************************************
:wlogfile
IF NOT EXIST "%logfile%" GOTO wlogfile
rem wait 500 seconds x 3 for projectx to complete
REM *****************************************************
REM Exit if any of the three process's complete
REM******************************************************
:loop
IF NOT EXIST "one-0.log" exit
IF NOT EXIST "two-0.log" exit
IF EXIST "three-0.log" GOTO loop
exitMultipass ffmpeg batch file. I do preprocessing of the file with projectx. I pass a log file prefix one,two,three so that log files are kept separate.
Code:
javaw -jar d:\projectX.old\projectX.jar %1
echo %date% %time% %1 >> d:\projectx.old\runinst.txt
"D:\Program Files (x86)\Devnz\GBPVR\Third Party\ffmpeg\ffmpeg.exe" -y -i "%~dp1%~n1.m2v" -an -r 30 -f avi -qmax 4 -qmin 1 -threads 8 -s 800x450 -b 2500k -pass 1 -passlogfile %3 -minrate 0k -maxrate 10000k -vcodec mpeg4 -bufsize 3500k -vtag divx nul
"D:\Program Files (x86)\Devnz\GBPVR\Third Party\ffmpeg\ffmpeg.exe" -y -i "%~dp1%~n1.m2v" -i "%~dp1%~n1.ac3" -ab 128k -acodec libmp3lame -ac 2 -r 30 -async 1 -ar 44100 -f avi -qmax 4 -qmin 1 -threads 8 -s 800x450 -b 2500k -pass 2 -passlogfile %3 -minrate 0k -maxrate 10000k -vcodec mpeg4 -bufsize 3500k -vtag divx %2
del "%~dp1%~n1.m2v"
del "%~dp1%~n1.ac3"
del "%~dp1%~n1[1].ac3"
del %3-0.log
IF EXIST "%~dp1%~n1.avi" DEL %1
EXIT
Computer AMD 550 X4 unlocked @ 3.6ghz.  4 gigs ddr2 1066.  3 Samsung F3 500gb drives raid 0.  HD 4870 Video.  2 ATI HD 650 PCie video capture cards. Scythe automatic temp/fan controller.  28" Hanns-G Monitor. Windows 7 x64
	
![[Image: ffmpegerr.jpg]](http://img26.imageshack.us/img26/8455/ffmpegerr.jpg)
![[Image: statusalpha.jpg]](http://img24.imageshack.us/img24/613/statusalpha.jpg)
![[Image: statusgui.jpg]](http://img11.imageshack.us/img11/9886/statusgui.jpg)