|
|
| MJ Peg |
| Posted: Sep 30 2009, 02:02 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 38
Member No.: 26241
Joined: 29-September 09

|
If only I could get the following single line command to work
| CODE | | vdub.exe /c /s deshake1.vcf /p 00667.MTS.avs 00667.MTS.avi /r /x |
- but it doesn't actually apply the filter - because the filter has to run through in some way that isn't happening (in manual mode this requires playing with the O play button)... so no log file is being created.
But if I manually run Pass 1, the log file is created, then this line works and the deshaken AVI is created
| CODE | | vdub.exe /c /s deshake2.vcf /p 00667.MTS.avs 00667.MTS.avi /r /x |
|
 |
| stephanV |
| Posted: Sep 30 2009, 02:16 PM |
 |
|
Spam killer ;)
  
Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04

|
It works here. A logfile is being created.
I'd check your vcf files. Make sure deshake1 is actually set to the first pass in the deshaker filter.
-------------------- useful links: VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ |
 |
| MJ Peg |
| Posted: Sep 30 2009, 03:04 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 38
Member No.: 26241
Joined: 29-September 09

|
I may have cracked it! The last line in deshake1.vcf was as follows - so I removed it! VirtualDub.audio.filters.Clear();
The two vdub.exe lines seem to do what's required now... but I'm still having trouble with my batch |
 |
| MJ Peg |
| Posted: Sep 30 2009, 04:18 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 38
Member No.: 26241
Joined: 29-September 09

|
This simple batch only works for the first two clips... 673 and 674 are not successful with Pass 1 and they get deshaken with the log file left over from the prior 672!
| CODE | vdub.exe /c /s deshake1.vcf /p 00667.MTS.avs 00667.MTS.avi /r /x vdub.exe /c /s deshake2.vcf /p 00667.MTS.avs 00667.MTS.avi /r /x
vdub.exe /c /s deshake1.vcf /p 00672.MTS.avs 00672.MTS.avi /r /x vdub.exe /c /s deshake2.vcf /p 00672.MTS.avs 00672.MTS.avi /r /x
vdub.exe /c /s deshake1.vcf /p 00673.MTS.avs 00673.MTS.avi /r /x vdub.exe /c /s deshake2.vcf /p 00673.MTS.avs 00673.MTS.avi /r /x
vdub.exe /c /s deshake1.vcf /p 00674.MTS.avs 00674.MTS.avi /r /x vdub.exe /c /s deshake2.vcf /p 00674.MTS.avs 00674.MTS.avi /r /x pause
|
So without doing anything, without deleting a thing, I ran this modified copy of the batch (for the 3rd and 4th clips above) and this time it all worked!
| CODE | vdub.exe /c /s deshake1.vcf /p 00673.MTS.avs 00673.MTS.avi /r /x vdub.exe /c /s deshake2.vcf /p 00673.MTS.avs 00673.MTS.avi /r /x
vdub.exe /c /s deshake1.vcf /p 00674.MTS.avs 00674.MTS.avi /r /x vdub.exe /c /s deshake2.vcf /p 00674.MTS.avs 00674.MTS.avi /r /x pause
|
If it can only do 2 in one batch before getting flakey... should I give up?!
Maybe I'll just have to just drag-n-drop one clip at a time instead |
 |
| MJ Peg |
| Posted: Oct 1 2009, 09:26 AM |
 |
|
Advanced Member
  
Group: Members
Posts: 38
Member No.: 26241
Joined: 29-September 09

|
It seems reliable enough doing one at a time, but with several in a row it's unhappy... maybe there's a memory leak or some setting hanging around, a file handle unreleased or something - but it can't be achieved dependably in one simple batch file.
But, I ran the batch 3 times in a row for the same mts file and that worked, so I rigged up the Complicated Solution, with multiple batch files and a vbs script file to automate new instances of command windows, hopefully untainted by previous runs...
.. and even that didn't work! A run with 3 mts files worked... so I set one off with 10, and 6 of them failed!
I suppose I'll have to wait a few days for doom9's daft newbie-hating policy to pass by, and then ask Gunnar and the other experts there...
Grr.... |
 |
| stephanV |
| Posted: Oct 1 2009, 10:13 AM |
 |
|
Spam killer ;)
  
Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04

|
This works fine with me for drag and dropping multiple files at once:
| CODE | @echo off
set VDUBPATH=c:\program files\VirtualDub set TARGETPATH=e:\target
md %TARGETPATH% 2> NUL
if %VDUBPATH:~-1% == \ set VDUBPATH=%VDUBPATH:~0,-1% if %TARGETPATH:~-1% == \ set TARGETPATH=%TARGETPATH:~0,-1%
"%VDUBPATH%\vdub.exe" /c
:add_to_job
if [%1]==[] goto :start_job
set SOURCEFILE="%~1" set TARGETFILE=%~n1
echo FFMPEGSource2(%SOURCEFILE%, atrack=-1)++\ > "%TARGETPATH%\%TARGETFILE%.avs" echo FFMPEGSource2("e:\path\to\buffer.mts", atrack=-1) >> "%TARGETPATH%\%TARGETFILE%.avs" echo Delayaudio(1.2) >> "%TARGETPATH%\%TARGETFILE%.avs"
"%VDUBPATH%\vdub.exe" /s e:\test1.vcf /p "%TARGETPATH%\%TARGETFILE%.avs" "%TARGETPATH%\%TARGETFILE%.avi" "%VDUBPATH%\vdub.exe" /s e:\test2.vcf /p "%TARGETPATH%\%TARGETFILE%.avs" "%TARGETPATH%\%TARGETFILE%.avi"
shift
goto :add_to_job
:start_job
"%VDUBPATH%\vdub.exe" /r
del "%TARGETPATH%\*.avs"
pause exit |
This post has been edited by stephanV on Oct 1 2009, 12:12 PM
-------------------- useful links: VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ |
 |
| MJ Peg |
| Posted: Oct 1 2009, 10:16 AM |
 |
|
Advanced Member
  
Group: Members
Posts: 38
Member No.: 26241
Joined: 29-September 09

|
... so now I've done what any sane programmer would do with random failures... try, try, try again
I now check for the log file after pass 1, and if it's not there I don't bother with pass 2, but immediately abandon the attempt without deleting the avs file like I would if it had worked... and on the next run around my scheduler batch file it will try the same one again.
It could get caught in an endless loop, but it doesn't seem to. I've watched it give up on a file, then try again with more success
Mental... but I think I may have a working contraption of batch files and vbs scripts all fighting the flakey process |
 |
| MJ Peg |
| Posted: Oct 1 2009, 10:28 AM |
 |
|
Advanced Member
  
Group: Members
Posts: 38
Member No.: 26241
Joined: 29-September 09

|
Thanks sV, but the whole flakey problem is probably to do with how I'm opening each MTS file. My first batch creates an avs file for each clip...
| CODE | FFMpegSource2("C:\ - (path) - \00632.MTS",atrack=-1)++\ FFMpegSource2("buffer.mts",atrack=-1) DelayAudio(1.2) |
(buffer.mts is a small clip glued on so I can be sure I get all of the required video+audio with all the sync shifting going on)
If you try it with AVCHD Lite MTS files via AviSynth scripts with the FFMpegSource2 plugin, it will probably be randomly dodgy for you, too... |
 |
| stephanV |
| Posted: Oct 1 2009, 10:32 AM |
 |
|
Spam killer ;)
  
Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04

|
It really doesn't matter. Creating the avs file is simply an extra part in the loop and easy to do. I have no experience with ffmpeg source, but I could surely make one with AviSource or DirectShowSource.
If you're interested let me know.
-------------------- useful links: VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ |
 |
| MJ Peg |
| Posted: Oct 1 2009, 10:51 AM |
 |
|
Advanced Member
  
Group: Members
Posts: 38
Member No.: 26241
Joined: 29-September 09

|
Thank you very much, very kind of you to help... but... (and I hardly dare say this as I've seen Pass 2 fail before after a successful Pass 1) ...
... it seems to be working, with the retry method I've put in now. Fingers crossed...
I'm working my way through 49 clips in groups of a handful... and so far so good (with a few retries).
Yay! If anyone wants my batch & script files... just say the word |
 |
| MJ Peg |
| Posted: Oct 1 2009, 12:05 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 38
Member No.: 26241
Joined: 29-September 09

|
FWIW, I tried using the NUL: device as the output filename for pass 1, because it didn't really seem to need to create an AVI file on that first pass...
| CODE | vdub.exe /c /s deshake1.vcf /p 00673.MTS.avs NUL: /r /x vdub.exe /c /s deshake2.vcf /p 00673.MTS.avs 00673.MTS.avi /r /x
|
- and it was quicker.. but it didn't work The pass 2 AVI got created, with an error message in it.
Nothing ventured, nothing gained... |
 |
| stephanV |
| Posted: Oct 1 2009, 12:11 PM |
 |
|
Spam killer ;)
  
Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04

|
I updated the script I posted above to include the creation of AVS files as you desired. You only need to fix the paths to your .vcf files and buffer.mts.
It should do everything you want in one go now.
-------------------- useful links: VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ |
 |
| MJ Peg |
| Posted: Oct 1 2009, 12:31 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 38
Member No.: 26241
Joined: 29-September 09

|
Thanks, hopefully that will work for people... but I'll stick with my retrying version that appears to be working! Cheers |
 |
| MJ Peg |
| Posted: Oct 1 2009, 04:50 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 38
Member No.: 26241
Joined: 29-September 09

|
49 clips successfully deshaken!
I shall post the details in case anyone is searching for the same thing, and as a backup in case my harddisk fails before I get to back this up...
The following files are in C:\Data\Progs\Deshake - so they may need editing if you place them elsewhere.
deshake1.vcf - saved from within VirtualDub, deshaker filter set to run Pass 1
deshake2.vcf - saved from within VirtualDub, deshaker filter set to run Pass 2
deshake.bat - main batch file, place a shortcut on the desktop and drag MTS files onto it
deshake1.bat - called from picker.bat, deshakes one clip
NewSesh.vbs - a VB script file (may require Windows Scripting Host?) which launches a fresh call to picker.bat
picker.bat - created by deshake.bat - don't worry about this one
This currently requires a 2 sec MTS file named buffer.mts copied into the folder where the mts files are - not hard to make one!
deshake.bat
| CODE | @echo off
rem MJ Peg's Deshake Batch Echo Scheduling Deshaker for files ...
rem Check for no files specified, exit if so if [%1]==[] goto :exit
rem Initialse batch scheduler picker.bat echo @echo off > C:\Data\Progs\Deshake\Picker.bat echo echo Picking next file... >> C:\Data\Progs\Deshake\Picker.bat
rem --- Loop --- Process selected files :do_another call :do_clip %1 shift if not [%1]==[] goto do_another rem --- End Loop ---
rem Create final stage of Picker scheduler echo echo All files processed >> C:\Data\Progs\Deshake\Picker.bat echo pause >> C:\Data\Progs\Deshake\Picker.bat
rem All done, finish up goto :New_Session
rem ------- "sub routine" called once per clip :do_clip echo %1
rem Make AVS script file for the clip if exist %1.avs del %1.avs echo FFMpegSource2("%1",atrack=-1)++\ > %1.avs echo FFMpegSource2("buffer.mts",atrack=-1) >> %1.avs echo DelayAudio(1.2) >> %1.avs
if exist %1.ffindex del %1.ffindex
rem Add to scheduler batch echo If exist %1.avs C:\Data\Progs\Deshake\Deshake1.bat %1 >> C:\Data\Progs\Deshake\Picker.bat
GOTO:EOF rem ------- End Sub
:New_Session rem Now call NewSesh for new session to launch picker start NewSesh.vbs
:exit rem All done
|
deshake1.bat - SET THE DESHAKE LOG FILE PATH+NAME (mine is like C:\Users\me\AppData\Local\Deshaker\Deshaker.log) to how it's set in VirtualDub and also change the C:\Data\Progs\virtdub196\vdub.exe to where it lives on your PC.
| CODE | @echo off rem MJ Peg's Deshake1 Batch (thanks to stephanV for vdub help) rem called from Picker.bat (written by Deshake.bat) for each avs file that exists
rem Check for no files specified, exit if so if [%1]==[] goto :exit
echo Deshake %1
rem Clear Deshaker log file if exist C:\Users\me\AppData\Local\Deshaker\Deshaker.log del C:\Users\me\AppData\Local\Deshaker\Deshaker.log if exist %1-failed.txt del %1-failed.txt
rem Clear ffindex files that might stop the clip loading if exist buffer.mts.ffindex del buffer.mts.ffindex
rem Pass 1 C:\Data\Progs\virtdub196\vdub.exe /c /s deshake1.vcf /p %1.avs %1.avi /r /x rem if exist %1.ffindex del %1.ffindex if exist buffer.mts.ffindex del buffer.mts.ffindex
rem Check for error, abandon this try, get picker to try again if NOT exist C:\Users\me\AppData\Local\Deshaker\Deshaker.log goto exit
rem Pass 2 C:\Data\Progs\virtdub196\vdub.exe /c /s deshake2.vcf /p %1.avs %1.avi /r /x
rem Delete the avs file so Picker doesn't choose it again if exist %1.avs del %1.avs if exist %1.ffindex del %1.ffindex if exist buffer.mts.ffindex del buffer.mts.ffindex
rem Check for error? (no longer used since retry technique) if NOT exist C:\Users\me\AppData\Local\Deshaker\Deshaker.log echo FAILED > %1-failed.txt
:exit rem Done One, won't do it again, now call NewSesh for new session for any next ones start NewSesh.vbs
|
NewSesh.vbs script file, with 4 seconds delay for good measure 
| CODE | WScript.Sleep(4000)
DIM objShell set objShell = wscript.createObject("wscript.shell") iReturn = objShell.Run("C:\Data\Progs\Deshake\Picker.bat", , True)
|
(example picker.bat scheduler, as would be created by deshake.bat)
| CODE | @echo off echo Picking next file... If exist C:\00676.MTS.avs C:\Data\Progs\Deshake\Deshake1.bat C:\00676.MTS If exist C:\00677.MTS.avs C:\Data\Progs\Deshake\Deshake1.bat C:\00677.MTS If exist C:\00678.MTS.avs C:\Data\Progs\Deshake\Deshake1.bat C:\00678.MTS If exist C:\00679.MTS.avs C:\Data\Progs\Deshake\Deshake1.bat C:\00679.MTS echo All files processed pause
|
It's not exactly the single file elegance of stephanV's approach, but I've documented the reasons why I wanted each deshake attempt in a fresh command window due to the avs loading being so temperamental! And this way you get to retry a clip if the Pass 1 fails... |
 |
| MJ Peg |
| Posted: Oct 3 2009, 01:37 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 38
Member No.: 26241
Joined: 29-September 09

|
and here's demo I made to show how wonderful deshaker is... FWIW http://www.vimeo.com/groups/avchdlite/videos/6872650
Thanks again for all the help |
 |