VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Page 3 of 4
FirstFirst 1 2 3 4 LastLast
Results 61 to 90 of 98
Thread
  1. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Originally Posted by http://ss64.com/nt/choice.html
    Choice.exe is a standard command in Windows 2003, Vista and Windows 7 (for XP you can use the early resource kit versions).
    1. you can drag and drop one of more folders and/or files onto the .bat file and the script will process them, when it's run out of arguments to process it will ask for user input ie another file or folder.

    2. is easily correctable but at the moment it makes the new AVI in the same directory as the file it's processing.

    3. I just changed that in the new version. Now it creates a unique randomised name for the working file, then when it's done renames any old avi versions is finds before renaming the current working file and moves the .MXF into a folder called "Done". Or at least I hope it does.

    4. I tried to add error correction but apparently VDM returns 0 even when something goes wrong. I could test for zero file size if you like (I do that in my own scripts) it's really not that hard.

    5. Hopefully, it only looks in subdirectories if it doesn't find anything to process in the directory it's in and only if you've specifically pointed it at a directory. I need that for TV Shows that have season folders. It's easily removed.

    Code:
    ffprobe version N-63013-g4cdea92 Copyright (c) 2007-2014 the FFmpeg developers
      built on May  6 2014 22:02:02 with gcc 4.8.2 (GCC)
    I think I may have only just downloaded it, I'm not sure.
    Quote Quote  
  2. ah ok, so I think I have to change something to well test it. Because for the function that is useful to me, the script cannot work in the same dir of input file:
    I use a sony pdw-f800 camera in FAM (file access mode), when I connect it on the pc, windows recognize the xdcam disc as drive (e.g. f:) and source .mxf are in (e.g.) f:\clips

    but this drive is readonly, cannot write anythings

    wishing, I can copy all the files in f:\clips into (e.g.) d:\mycats and process mycats but copying process would be employ also 1 hours (with the 50GB xdcam disc) ... it's more easy use f:\clips as source for opening .mxf files and point o:\ as target folder so I don't have to copy uselessy .mxf files into hard disk

    So, for this reason maybe is uselessy (at least from what I have to do) do a "done" folder for processed .mxf

    Initially, in fact, my script was (consider o:\ = v:\automazioneclip\output):

    Code:
    set "d="
    set "done="
    set /p "d=Type source path (or press enter for current folder): "
    if not defined d set "d=%cd%"
    if not exist "%d%" echo Enter valid path - try again & goto :loop
    :loop
    cd /d "%d%"
    for /f "delims=" %%a in ('dir *.mxf /b /od /a-d') do (
       if defined done goto :EOF
       if not exist "v:\automazioneclip\output\%%~na.*" (
          echo %d%\%%~na.mxf|clip >nul
    
    bla bla bla c:\virtualdubsetup\vdub.exe anything .... ..... ....
    
    )
          goto loop  
          set done=1
       )
    Last edited by marcorocchini; 13th May 2014 at 06:25.
    Quote Quote  
  3. also I thought another things: to make more safety and easy the script, avoiding to generate all entire .vcf

    simply it have to use a pre-writed .vcf called script4HD.vcf and script4SD.vcf but the script have to change only the line

    VirtualDub.video.AddComment(0x0000000C,"","01:34:2 1:15");

    or simply it have to found the space reserved to 01:34:21:15 in script4HD.vcf (or script4SD.vcf) and change with the %timecode%

    or delete entire line VirtualDub.video.AddComment(0x0000000C,"","01:34:2 1:15"); and replace with the new containing %timecode%
    Last edited by marcorocchini; 13th May 2014 at 06:30.
    Quote Quote  
  4. or more simply (I think)

    script4SD.vcf/cript4HD.vcf does not have VirtualDub.video.AddComment(0x0000000C,"","01:34:2 1:15");

    the script add a line to the script4HD.vcf and generate script4HDwithTC.vcf to take @ virtualdubmod only if the procced file have timecode
    Quote Quote  
  5. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Batch doesn't work like that. I can either write over the file or append to it, I can't alter bits in the middle. The name of the .VCF actually makes absolutely no difference whatsoever.

    Code:
    @rem unless otherwise specified for debugging reasons turn echo off
    @if "%EMode%"=="" Set EMode=OFF
    @ECHO %EMode%
    
    rem delayed expansion is a bad idea when processing file names
    SetLocal DisableDelayedExpansion
    
    Set "EXTLIST=*.mxf"
    Set "DoPop=0"
    Set "ARGLVL=0"
    Set "FileName-DQ="
    Set VDM_LOC="C:\Program Files (x86)\VirtualDubMod\VirtualDubMod.exe"
    
    
    :MakeFolders
    Set "DestFolder=O:\Output"
    if EXIST "%DestFolder%" goto :MakeWork
    type NUL
    mkdir "%DestFolder%"
    if "%ERRORLEVEL%"=="0" goto :MakeWork
    echo Error!!! Cannot Make Destination Folder:
    echo "%DestFolder%"
    pause
    goto :eof
    
    :MakeWork
    Set "WorkFolder=%DestFolder%\Work"
    if EXIST "%WorkFolder%" goto :ARGS
    type NUL
    mkdir "%WorkFolder%"
    if "%ERRORLEVEL%"=="0" goto :ARGS
    echo Error!!! Cannot Make Work Folder:
    echo "%WorkFolder%"
    pause
    goto :eof
    
    rem process the arguments one by one.
    :ARGS
    	
    	rem if there are no further arguments then exit the batch.
    	if [%1]==[] (
    		if "%ARGLVL%"=="0" (
    			CALL :GetTargetName		
    			EndLocal
    			pause
    		)
    		goto :eof
    	)
    
    	rem wildcard processing
    	Set "FileName=%~1"
    	if "%FileName%"=="" (
    		SHIFT
    		goto :ARGS
    	)
    
    	rem if the argument doesn't exist in the file system in any form skip it.
    	if NOT EXIST %1 (
    		SHIFT
    		goto :ARGS
    	)
    
    	if NOT [%1]==[] if NOT "%FileName:^*=%%FileName:^?=%"=="%FileName%%FileName%" (
    		for %%w in (%1) DO (
    			Set /a ARGLVL+=1
    			CALL :ARGS "%%~fw"
    			Set /a ARGLVL-=1
    		)
    		SHIFT
    		goto :ARGS
    	)
    	Set "FileName="
    		
    	rem Set search/recursion variables
    	Set "Pattern=%EXTLIST%"
    	Set "STARTLVL=0"
    	Set "FOUNDLVL=1024"
    	
    	rem if the argument is the current directory then process everything in it.
    	if "%~f1"=="%CD%" (
    		echo Processing Directory; "%CD%"
    		CALL :START %1
    		SHIFT
    		goto :ARGS
    	)
    	rem Test if the argument is a directory, if it is move to it then process everything in it, if not then move to the file's parent directory and process the file.  Then return to starting directory.
    	Type NUL
    	pushd "%~f1" 2> nul
    	if NOT "%errorlevel%"=="0" (
    		if NOT "%CD%\"=="%~dp1" (
    			pushd "%~dp1"
    			Set "DoPop=1"
    		)
    		Set Pattern="%~nx1"
    	) else (
    		echo Processing Directory; "%~f1"
    		Set "DoPop=1"
    	)
    	CALL :START %1
    	if "%DoPop%"=="1" (
    		popd
    		Set "DoPop=0"
    	)
    	SHIFT
    
    goto :ARGS
    
    :START <CURRENT_ARG>
    
    	rem Count is superseded by FOUNDLVL but may still be useful for renaming purposes
    	Set "Count=0"
    	rem Process all files in the current directory fitting the arguments search pattern.
    	for /f "delims=" %%y in ('dir %Pattern% /b /od /a-d') do (
    		if /I NOT "%%~y"=="File Not Found" CALL :Process_File "%%~fy"
    	)
    	rem if it didn't find anything search all directories instead
    goto :eof
    	if "%Count%"=="0" if %STARTLVL% LSS %FOUNDLVL% (
    		for /d %%b in (*) do (
    			pushd "%%~fb"
    			echo Processing Directory; "%%~fb"
    			Set /a STARTLVL+=1
    			CALL :START "%%~fb"
    			Set /a STARTLVL-=1
    			popd
    		)
    	)
    
    goto :eof
    
    :Process_File <MXF_FILENAME>
    
    	Set /a Count+=1
    	Set "FOUNDLVL=%STARTLVL%"
    
    	echo Processing File; "%~nx1"
    	if /I NOT "%~x1"==".mxf" (
    		echo "%~nx1"
    		echo  Is not an mxf file.
    		pause
    		goto :eof
    	)
    	if EXIST "%DestFolder%\%~n1.avi" (
    		echo  Output Already Exists...
    		goto :eof
    	)
    	if EXIST "%WorkFolder%\%~n1.avi" (
    		echo  Working File Already Exists...
    		goto :eof
    		pause
    	)
    	
    	SetLocal DisableDelayedExpansion
    	rem Find TimeCode Info
    	Set AUCount=0;
    	for /f "tokens=1,2 delims=^=" %%g in ('FFProbe -hide_banner -loglevel fatal -pretty -show_streams -show_entries stream^=codec_type^,width^,height^,sample_aspect_ratio:stream_disposition^=:format_tags^=timecode^,company_name^,product_name^,product_version "%~1" 2^>^&1') DO (
    		 if "%%~g"=="TAG:company_name" set "T_Company_Name=%%~h"
    		 if "%%~g"=="TAG:product_name" set "T_Product_Name=%%~h"
    		 if "%%~g"=="TAG:product_version" set "T_Product_Version=%%~h"
    		 if "%%~g"=="TAG:timecode" set "TIMECODE=%%~h"
    		 if "%%~g"=="width" set "V_Width=%%~h"
    		 if "%%~g"=="height" set "V_Height=%%~h"
    		 if "%%~g"=="sample_aspect_ratio" set "V_PAR=%%~h"
    		 if "%%~g"=="codec_type" if "%%~h"=="audio" set /a AUCount+=1
    	)
    	if "%V_Width%"=="" (
    		echo  ERROR: Video Width NOT FOUND!
    		pause
    		goto :eof
    	)
    	if "%V_Height%"=="" (
    		echo  ERROR: Video Height NOT FOUND!
    		pause
    		goto :eof
    	)
    	if "%V_PAR%"=="" (
    		echo  ERROR: Video PAR NOT FOUND!
    		pause
    		goto :eof
    	)
    	rem Set "V_Q=UD"
    	rem if %V_Width% LEQ 1920 if %V_Height% LEQ 1120 \\
    	Set "V_Q=HD"
    	rem if %V_Width% LEQ 1280 if %V_Height% LEQ 752 Set "V_Q=MD"
    	if %V_Width% LEQ 1024 if %V_Height% LEQ 608 Set "V_Q=SD"
    	echo  Using %V_Q% Mode.
    	echo  PAR = %V_PAR%
    	if "%TimeCode%"=="" echo Warning! no TimeCode Found!
    	if NOT "%TimeCode%"=="" echo Timecode= %TIMECODE%
    	if NOT "%TimeCode:~2,1%"=="" echo %TimeCode:~0,-1%^%TimeCode:~-1,1%>"%~dpn1.txt"
    	rem if NOT "%TimeCode%"=="" echo %TimeCode% 1>"%~dpn1.txt"
    	CALL :MAKEVCF "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1"
    	echo  Done!
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    
    :MAKEVCF <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <MXF_FILENAME>
    
    	rem ***Make The .vcf Script File***
    	echo %T_Company_Name% %T_Product_Name% %T_Product_Version%
    	echo %AUCount% Audio Streams Detected.
    	echo VirtualDub.RemoveInputStreams^(^)^;>%1
    	echo VirtualDub.video.DeleteComments^(1^)^;>>%1
    	if NOT "%TimeCode%"=="" echo VirtualDub.video.AddComment^(0x0000000C,"","%TIMECODE%"^)^;>>%1
    	echo VirtualDub.video.AdjustChapters^(1^)^;>>%1
    	echo VirtualDub.video.SetDepth^(24,24^)^;>>%1
    	echo VirtualDub.video.SetMode^(1^)^;>>%1
    	echo VirtualDub.video.SetFrameRate^(0,1^)^;>>%1
    	echo VirtualDub.video.SetIVTC^(0,0,-1,0^)^;>>%1
    	echo VirtualDub.video.SetCompression^(0x6a6d7674,0,10000 ,0^)^;>>%1
    	echo VirtualDub.video.SetCompData^(28,"TUpQRxgAAAAAAAAAA gAAAAgAAAACAAAAAQAAAA=="^)^;>>%1
    	echo VirtualDub.video.filters.Clear^(^)^;>>%1
    	
    	echo if "%V_Q%"=="HD" echo "Insert HD Video Info Like This">>%1
    	echo if "%V_Q%"=="SD" echo "Insert SD Video Info Like This">>%1
    	
    	rem ***Make The .avs AVISynth Script***
    	echo DirectShowSource^(%4^)>%2
    	if "%V_Q%"=="HD" echo Crop^(0,32,0,0^)>>%2
    	
    	rem ***Call VirtualDub[Mod]
    	if NOT EXIST %VDM_LOC% (
    		echo  Um, where the hell is VirtualDubMod?
    		pause
    	)
    	%VDM_LOC% /s%1 /p%2,%3 /r /x
    	if NOT "%ERRORLEVEL%"=="0" (
    		echo  WARNING!!!  VirtualDubMod Error Detected!!!
    		pause
    	)
    	for %%v in (%3) do (
    		if %%~zv LSS 128 (
    			echo  ERROR!!!  Extra Small File Size Detected!!!
    			pause
    		)
    	)
    	rem Clean-up
    	if NOT EXIST DONE MKDIR DONE
    	DEL %1
    	DEL %2
    	if NOT EXIST "%DESTFOLDER%\%~n4.avi" goto :Skip-To-Cleanup
    
    :MakeOldFile
    	Set "TEMPFILE=%~n4-o%RANDOM%.avi"
    	if EXIST "%DESTFOLDER%\%TEMPFILE%" goto :MakeOldFile
    	REN "%DESTFOLDER%\%~n4.avi" %TEMPFILE%
    	
    :Skip-To-Cleanup
    	REN %3 "%~n4.avi"
    	MOVE "%WorkFolder%\%~n4.avi" ".."
    
    goto :eof
    
    :GetTargetName
    
    	Set "FileName="
    	Set /p FileName=Enter Target Name:
    	
    	rem Add or remove double-quotes if necessary
    
    	if NOT DEFINED FileName (
    		Set "FileName-DQ="
    		goto :DQSkip
    	)
    	
    	Set "FileName-DQ=%FileName:"=%"
    	if NOT DEFINED FileName-DQ (
    		Set "FileName="
    		Set "FileName-DQ="
    		goto :DQSkip
    	)
    	
    	if EXIST "%FileName-DQ%" (
    		if "%FileName-DQ%"=="%FileName-DQ: =%" (
    			Set "FileName=%FileName-DQ%"
    		) else (
    			Set FileName="%FileName-DQ%"
    		)
    	)
    
    :DQSkip
    
    	if /I "%FileName-DQ%"=="" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="CD" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="EXIT" goto :eof
    	if /I "%FileName-DQ%"=="X" goto :eof
    	if /I "%FileName-DQ%"=="NOEXIT" goto :GetTargetName
    	if DEFINED FileName (
    		Set /a ARGLVL+=1
    		CALL :ARGS %FileName%
    		Set /a ARGLVL-=1
    	)
    	
    goto :GetTargetName
    That should work, but I haven't tested it.

    Code:
    FFProbe -hide_banner -loglevel fatal -pretty -show_streams -show_format "%~f1"
    Will give a list of all the relevant possible FFProbe outputs.

    I only got involved in this to correct an atrocious use of the for loop...
    Last edited by ndjamena; 18th May 2014 at 06:50.
    Quote Quote  
  6. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Stop nit-picking.
    Quote Quote  
  7. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Aaaaanyway, I'm about to reinstall windows to see if I can get MKVExtract to stop crashing every time I try to extract some tags... If it works, I'll have to see about trying to get it happening again so I can finally get that bug fixed.
    Quote Quote  
  8. ------------------- (I'm looking for download choise for xp)

    Click image for larger version

Name:	CHOICE.JPG
Views:	224
Size:	40.4 KB
ID:	25187

    maybe your choice is not the same version/os or I don't know that mine

    with another version:

    Click image for larger version

Name:	CHOICE2.JPG
Views:	175
Size:	48.8 KB
ID:	25188

    I'm looking for the choice of the resource kit

    hoewver your script, in my pc, seems to work when I try to drag and drop a file into script (mmm what powerful!) but if I press the Return key not working well because maybe I don't have the right CHOICE

    I have download it from:

    http://hp.vector.co.jp/authors/VA007219/dkclonesup/choice.html
    Last edited by marcorocchini; 13th May 2014 at 09:51.
    Quote Quote  
  9. Code:
    @rem unless otherwise specified for debugging reasons turn echo off
    @if "%EMode%"=="" Set EMode=OFF
    @ECHO %EMode%
    
    echo on
    
    rem delayed expansion is a bad idea when processing file names
    SetLocal DisableDelayedExpansion
    
    Set "EXTLIST=*.mxf"
    Set "DoPop="
    
    rem if no arguments are given, process everything in the current directory.
    if [%1]==[] (
    	Set "Pattern=%EXTLIST%"
    	CALL :START %1
    )
    
    rem process the arguments one by one.
    :ARGS
    	
    	rem if there are no further arguments then exit the batch.
    	if [%1]==[] (
    		EndLocal
    		pause
    		goto :eof
    	)
    	rem if the argument doesn't exist in the file system in any form skip it.
    	if NOT EXIST %1 (
    		SHIFT
    		goto :ARGS
    	)
    	Set "Pattern=%EXTLIST%"
    	rem if the argument is the current directory then process everything in it.
    	if "%~f1"=="%CD%" (
    		CALL :START %1
    		SHIFT
    		goto :ARGS
    	)
    	rem Test if the argument is a directory, if it is move to it then process everything in it, if not then move to the file's parent directory and process the file.  Then return to starting directory.
    	Type NUL
    	pushd "%~f1" 2> nul
    	if NOT "%errorlevel%"=="0" (
    		if NOT "%CD%\"=="%~dp1" (
    			pushd "%~dp1"
    			Set "DoPop=1"
    		)
    		Set Pattern="%~nx1"
    	) else (
    		Set "DoPop=1"
    	)
    	CALL :START %1
    	if "%DoPop%"=="1" (
    		popd
    		Set "DoPop="
    	)
    	SHIFT
    
    goto :ARGS
    
    :START
    
    	Set "Count=0"
    	rem Process all files in the current directory fitting the arguments search pattern.
    	for %%y in (%Pattern%) do (
    		CALL :Process_File "%%~fy"
    	)
    	rem if the last for loop didn't find anything search all directories up one level instead
    	if "%Count%"=="0" (
    		for /d %%b in (*) do (
    			pushd "%%~fb"
    			CALL :START "%%~fb"
    			popd
    		)
    	)
    
    goto :eof
    
    :Process_File <MXF_FILENAME>
    
    	Set /a Count+=1
    	Set "FOUNDLVL=%STARTLVL%"
    	
    	if /I NOT "%~x1"==".mxf" (
    		echo "%~nx1"
    		echo Is not an mxf file.
    		pause
    		goto :eof
    	)
    	
    	SetLocal DisableDelayedExpansion
    	rem Find TimeCode Info
    	echo Processing File; "%~nx1"
    	Set AUCount=0;
            for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdubmod\FFProbe.exe -hide_banner -loglevel fatal -pretty -show_streams -select_streams v -show_entries stream^=width^,height^,sample_aspect_ratio:stream_disposition^=:format_tags^=timecode^,company_name^,product_name^,product_version "%~1" 2^>^&1') DO (
    		 if "%%~g"=="TAG:company_name" (
    			  set "T_Company_Name=%%~h"
    		 )
    		 if "%%~g"=="TAG:product_name" (
    			  set "T_Product_Name=%%~h"
    		 )
    		 if "%%~g"=="TAG:product_version" (
    			  set "T_Product_Version=%%~h"
    		 )
    		 if "%%~g"=="TAG:timecode" (
    			  set "TIMECODE=%%~h"
    		 )
    		 if "%%~g"=="width" (
    			set "V_Width=%%~h"
    		 )
    		 if "%%~g"=="height" (
    			set "V_Height=%%~h"
    		 )
    		 if "%%~g"=="sample_aspect_ratio" (
    			set "V_PAR=%%~h"
    		 )
    	)
    	if "%V_Width%"=="" (
    		echo ERROR: Video Width NOT FOUND!
    		pause
    		goto :eof
    	)
    	if "%V_Height%"=="" (
    		echo ERROR: Video Height NOT FOUND!
    		pause
    		goto :eof
    	)
    	if "%V_PAR%"=="" (
    		echo ERROR: Video PAR NOT FOUND!
    		pause
    		goto :eof
    	)
    	Set "V_Q="
    	if %V_Width% LEQ 1024 if %V_Height% LEQ 576 Set "V_Q=SD"
    	if "%V_Q%"=="" Set "V_Q=HD"
    	if "%TIMECODE%"=="" (
    		 echo NO TIMECODE FOUND IN:
    		 echo "%~1"
    		 pause
    	) else (
    		if "%V_Q%"=="SD" (
    			CALL :MAKEVCF_SD "v:\automazioneclip\virtualdubmod\temp\%~n1.vcf" "v:\automazioneclip\virtualdubmod\temp\%~n1.avs" "o:\%~n1.avi" "%~f1"
    		) else (
    			CALL :MAKEVCF_HD "v:\automazioneclip\virtualdubmod\temp\%~n1.vcf" "v:\automazioneclip\virtualdubmod\temp\%~n1.avs" "o:\%~n1.avi" "%~f1"
    		)
    	)
    echo Done!
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    	
    :MAKEVCF_HD <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <MXF_FILENAME>
    
    	rem ***Make The .vcf Script File***
    	echo VirtualDub.RemoveInputStreams^(^)^;>%1
    	echo VirtualDub.video.DeleteComments^(1^)^;>>%1
    	echo VirtualDub.video.AddComment^(0x0000000C,"","%TIMECODE%"^)^;>>%1
    	echo VirtualDub.video.AdjustChapters^(1^)^;>>%1
    	echo VirtualDub.video.SetDepth^(24,24^)^;>>%1
    	echo VirtualDub.video.SetMode^(1^)^;>>%1
    	echo VirtualDub.video.SetFrameRate^(0,1^)^;>>%1
    	echo VirtualDub.video.SetIVTC^(0,0,-1,0^)^;>>%1
    	echo VirtualDub.video.SetCompression^(0x31626d64,0,10000 ,0^)^;>>%1
    	echo VirtualDub.video.filters.Clear^(^)^;>>%1
    	rem ***Make The .avs AVISynth Script***
    	echo DirectShowSource^(%4^)>%2
            
    
    	rem ***Call VirtualDub[Mod]
    	"v:\automazioneclip\virtualdubmod\virtualdubmod.exe" /s%1 /p%2,%3 /r /x
            "v:\automazioneclip\virtualdub\cfourcc.exe" -i o:\%~n1.avi -u MJPG -d MJPG
    
    goto :eof
    
    :MAKEVCF_SD <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <MXF_FILENAME>
    
    	rem ***Make The .vcf Script File***
    	echo VirtualDub.RemoveInputStreams^(^)^;>%1
    	echo VirtualDub.video.DeleteComments^(1^)^;>>%1
    	echo VirtualDub.video.AddComment^(0x0000000C,"","%TIMECODE%"^)^;>>%1
    	echo VirtualDub.video.AdjustChapters^(1^)^;>>%1
    	echo VirtualDub.video.SetDepth^(24,24^)^;>>%1
    	echo VirtualDub.video.SetMode^(1^)^;>>%1
    	echo VirtualDub.video.SetFrameRate^(0,1^)^;>>%1
    	echo VirtualDub.video.SetIVTC^(0,0,-1,0^)^;>>%1
    	echo VirtualDub.video.SetCompression^(0x31626d64,0,10000 ,0^)^;>>%1
    	echo VirtualDub.video.SetCompData^(28,"TUpQRxgAAAAAAAAAA gAAAAgAAAACAAAAAQAAAA=="^)^;>>%1
    	echo VirtualDub.video.filters.Clear^(^)^;>>%1
    	
    	rem ***Make The .avs AVISynth Script***
    	echo DirectShowSource^(%4^)>%2
            echo Crop^(0,32,0,0^)>>%2
    	
    	
    	rem ***Call VirtualDub[Mod]
    	"v:\automazioneclip\virtualdubmod\virtualdubmod.exe" /s%1 /p%2,%3 /r /x
    
    goto :eof
    this works! but it select HD also for SD files ^_^

    my file HD:

    eneral
    Complete name : D:\galvanina\C0054.MXF
    Format : MXF
    Commercial name : XDCAM HD422
    Format profile : OP-1a
    Format settings : Closed / Complete
    File size : 63.6 MiB
    Duration : 8s 800ms
    Overall bit rate : 60.6 Mbps
    Encoded date : 2013-09-07 18:31:25.000
    Writing application : SONY Opt 1.22
    Writing library : SONY Opt 1.22

    Video
    ID : 2
    Format : MPEG Video
    Commercial name : XDCAM HD422
    Format version : Version 2
    Format profile : 4:2:2@High
    Format settings, BVOP : Yes
    Format settings, Matrix : Custom
    Format settings, GOP : M=3, N=12
    Format_Settings_Wrapping : Frame
    Duration : 8s 800ms
    Bit rate : 50.0 Mbps
    Width : 1 920 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate : 25.000 fps
    Standard : Component
    Color space : YUV
    Chroma subsampling : 4:2:2
    Bit depth : 8 bits
    Scan type : Interlaced
    Scan order : Top Field First
    Compression mode : Lossy
    Bits/(Pixel*Frame) : 0.965
    Stream size : 52.5 MiB (82%)
    Color primaries : BT.709
    Transfer characteristics : BT.709
    Matrix coefficients : BT.709

    Audio #1
    ID : 3
    Format : PCM
    Format settings, Endianness : Little
    Format_Settings_Wrapping : Frame (AES)
    Duration : 8s 800ms
    Bit rate mode : Constant
    Bit rate : 1 152 Kbps
    Channel(s) : 1 channel
    Sampling rate : 48.0 KHz
    Bit depth : 24 bits
    Stream size : 1.21 MiB (2%)

    Audio #2
    ID : 4
    Format : PCM
    Format settings, Endianness : Little
    Format_Settings_Wrapping : Frame (AES)
    Duration : 8s 800ms
    Bit rate mode : Constant
    Bit rate : 1 152 Kbps
    Channel(s) : 1 channel
    Sampling rate : 48.0 KHz
    Bit depth : 24 bits
    Stream size : 1.21 MiB (2%)

    Audio #3
    ID : 5
    Format : PCM
    Format settings, Endianness : Little
    Format_Settings_Wrapping : Frame (AES)
    Duration : 8s 800ms
    Bit rate mode : Constant
    Bit rate : 1 152 Kbps
    Channel(s) : 1 channel
    Sampling rate : 48.0 KHz
    Bit depth : 24 bits
    Stream size : 1.21 MiB (2%)

    Audio #4
    ID : 6
    Format : PCM
    Format settings, Endianness : Little
    Format_Settings_Wrapping : Frame (AES)
    Duration : 8s 800ms
    Bit rate mode : Constant
    Bit rate : 1 152 Kbps
    Channel(s) : 1 channel
    Sampling rate : 48.0 KHz
    Bit depth : 24 bits
    Stream size : 1.21 MiB (2%)

    Audio #5
    ID : 7
    Format : PCM
    Format settings, Endianness : Little
    Format_Settings_Wrapping : Frame (AES)
    Duration : 8s 800ms
    Bit rate mode : Constant
    Bit rate : 1 152 Kbps
    Channel(s) : 1 channel
    Sampling rate : 48.0 KHz
    Bit depth : 24 bits
    Stream size : 1.21 MiB (2%)

    Audio #6
    ID : 8
    Format : PCM
    Format settings, Endianness : Little
    Format_Settings_Wrapping : Frame (AES)
    Duration : 8s 800ms
    Bit rate mode : Constant
    Bit rate : 1 152 Kbps
    Channel(s) : 1 channel
    Sampling rate : 48.0 KHz
    Bit depth : 24 bits
    Stream size : 1.21 MiB (2%)

    Audio #7
    ID : 9
    Format : PCM
    Format settings, Endianness : Little
    Format_Settings_Wrapping : Frame (AES)
    Duration : 8s 800ms
    Bit rate mode : Constant
    Bit rate : 1 152 Kbps
    Channel(s) : 1 channel
    Sampling rate : 48.0 KHz
    Bit depth : 24 bits
    Stream size : 1.21 MiB (2%)

    Audio #8
    ID : 10
    Format : PCM
    Format settings, Endianness : Little
    Format_Settings_Wrapping : Frame (AES)
    Duration : 8s 800ms
    Bit rate mode : Constant
    Bit rate : 1 152 Kbps
    Channel(s) : 1 channel
    Sampling rate : 48.0 KHz
    Bit depth : 24 bits
    Stream size : 1.21 MiB (2%)

    Other #1
    ID : 1
    Type : Time code
    Format : MXF TC
    Time code of first frame : 01:35:38:23
    Time code settings : Striped

    Other #2
    Type : Time code
    Format : SMPTE TC
    Muxing mode : SDTI
    Time code of first frame : 01:35:38:23



    my file SD:
    General
    Complete name : V:\cesenaCalcio\C0039.MXF
    Format : MXF
    Commercial name : IMX 50
    Format profile : OP-1a
    Format settings : Closed / Complete
    File size : 419 MiB
    Duration : 56s 160ms
    Overall bit rate : 62.6 Mbps
    Encoded date : 2013-09-19 15:51:22.000
    Writing application : SONY Opt 1.41
    Writing library : SONY Opt 1.41

    Video
    ID : 2
    Format : MPEG Video
    Commercial name : IMX 50
    Format version : Version 2
    Format profile : 4:2:2@Main
    Format settings, BVOP : No
    Format settings, Matrix : Default
    Format settings, GOP : N=1
    Format_Settings_Wrapping : Frame (D-10)
    Duration : 56s 160ms
    Bit rate : 50.0 Mbps
    Width : 720 pixels
    Height : 576 pixels
    Original height : 608 pixels
    Display aspect ratio : 16:9
    Frame rate : 25.000 fps
    Standard : PAL
    Color space : YUV
    Chroma subsampling : 4:2:2
    Bit depth : 8 bits
    Scan type : Interlaced
    Scan order : Top Field First
    Compression mode : Lossy
    Bits/(Pixel*Frame) : 4.823
    Stream size : 337 MiB (80%)

    Audio
    ID : 3
    Format : PCM
    Format settings, Endianness : Little
    Format_Settings_Wrapping : Frame (D-10)
    Duration : 56s 160ms
    Bit rate mode : Constant
    Bit rate : 12.3 Mbps
    Channel(s) : 8 channels
    Sampling rate : 48.0 KHz
    Bit depth : 24 bits
    Stream size : 82.3 MiB (20%)

    Other #1
    ID : 1
    Type : Time code
    Format : MXF TC
    Time code of first frame : 00:30:09:07
    Time code settings : Striped

    Other #2
    Type : Time code
    Format : SMPTE TC
    Muxing mode : SDTI
    Time code of first frame : 00:30:09:07
    Quote Quote  
  10. Originally Posted by ndjamena View Post

    if "%V_Q%"=="" Set "V_Q=UD"
    UD?
    Quote Quote  
  11. if cannot understand why for SD files the script use alwais HD routine
    Last edited by marcorocchini; 13th May 2014 at 15:48.
    Quote Quote  
  12. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Originally Posted by http://hp.vector.co.jp/authors/VA007219/dkclonesup/choice.txt
    choice.com & choice.exe for Windows NT/2000/XP


    Waits for the user to choose one of a set of choices.
    If the user presses a key that is not among the keys you assigned,
    Choice sounds a warning beep.

    CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text]

    /C[:]choices Specifies allowable keys. Default is YN
    /N Do not display choices and ? at end of prompt string.
    /S Treat choice keys as case sensitive.
    /T[:]c,nn Default choice to c after nn seconds
    text Prompt string to display

    ERRORLEVEL is set to offset of key user presses in choices.



    DOS\*.* MS-DOS,MS-DOS Startup Disk (Windows),MS-DOS mode (Windows 95/98/Me)
    NT\*.* Windows 95/98/Me/NT/2000/XP

    DOS\choice.com .com file - MS-DOS application, tiny model
    DOS\choice.exe .exe file - MS-DOS application, small model
    NT\choice.exe .exe file - Win32 console application
    Just delete the /M message switch. Apparently it doesn't need it.
    Last edited by ndjamena; 13th May 2014 at 16:54.
    Quote Quote  
  13. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    My bad, I forgot to check if it was already set.
    Code:
    	Set "V_Q=UD"
    	if %V_Width% LEQ 1920 if %V_Height% LEQ 1120 Set "V_Q=HD"
    	if %V_Width% LEQ 1280 if %V_Height% LEQ 752 Set "V_Q=MD"
    	if %V_Width% LEQ 1024 if %V_Height% LEQ 608 Set "V_Q=SD"
    	echo  Using %V_Q% Mode.
    Plus your 'SD' videos have a height of 608 for some reason...

    -Edit- I flipped it around to make it neater.
    Last edited by ndjamena; 13th May 2014 at 23:24.
    Quote Quote  
  14. yes, now SD works

    but if you press return key it falls in "invalid switch syntax. Expected form: /C[:]choices"

    however I would like remove you can remove the choice option, is not important
    Quote Quote  
  15. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Code:
    CALL :GetTargetName
    Delete that, or rem it in case you want to add it back.
    Quote Quote  
  16. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Code:
    CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text]
    it LOOKS as though you need to add a colon between the /C and the YN, or else leave out the space. Something like that.
    Quote Quote  
  17. ndjamena please I ask you a kindness: in this days I do many proof
    At the moment I try to understand this:

    if I have a .mxf file c:\mycats\c0001.mxf, and I want insert in a batch file the fact that c0001.mxf is a enviroment variable, what is the restrict procedure that extract timecode with ffprobe from c0001.mxf and put it in another variable?

    and If have a .txt (ascii) file -attached- called that contain

    Click image for larger version

Name:	TCF.JPG
Views:	177
Size:	13.0 KB
ID:	25200

    what is the procedure to put in a enviroment variable 01:24:51:23 ? (procedure without use ffprobe)

    thank you
    Image Attached Files
    Quote Quote  
  18. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    your text file is a pain because it uses spaces in the descriptors but...

    Option 1:
    Code:
    for /F "usebackq tokens=1,* delims=:" %%g in ("c0006.txt") DO (
    	if "%%g"=="Time code of first frame                 " Set TimeCode=%%h
    )
    Set "TimeCode=%TimeCode: =%"
    echo %TimeCode%
    Option 2:
    Code:
    for /F "usebackq tokens=1,2,3,4,5,* delims=: " %%g in ("c0006.txt") DO (
    	if "%%g"=="Time" if "%%h"=="code" if "%%i"=="of" if "%%j"=="first" if "%%k"=="frame" Set TimeCode=%%l
    )
    echo %TimeCode%
    Make sure there's a single set of double quotes around the file name, in case the file name has spaces. You could remove a few tokens from option 2 and remove some of the conditional ifs, it will just be less accurate that way.
    Quote Quote  
  19. ndjamena please help me cat:

    I try to make my script this:

    Code:
    del /q v:\automazioneclip\virtualdubmod\temp\*.*
    
    @echo on
    set "d="
    set "done="
    set /p "d=Type source path (or press enter for current folder): "
    if not defined d set "d=%cd%"
    if not exist "%d%" echo Enter valid path - try again & goto :loop
    :loop
    cd /d "%d%"
    for /f "delims=" %%a in ('dir *.mxf /b /od /a-d') do (
       if defined done goto :EOF
       if not exist "v:\automazioneclip\output\%%~na.*" (
         
    
    if exist v:\automazioneclip\virtualdubmod\temp\ascii.txt del v:\automazioneclip\virtualdubmod\temp\ascii.txt
    if exist v:\automazioneclip\virtualdubmod\temp\unicodefile.txt del v:\automazioneclip\virtualdubmod\temp\unicodefile.txt
    
    v:\automazioneclip\virtualdubmod\mediainfo.exe "%d%\%%~na.mxf" dumpinfo:"v:\automazioneclip\virtualdubmod\temp\unicodefile.txt"
    TYPE "v:\automazioneclip\virtualdubmod\temp\unicodefile.txt" > "v:\automazioneclip\virtualdubmod\temp\ascii.txt
    rename "v:\automazioneclip\virtualdubmod\temp\ascii.txt" mediainfo%%~na.txt
    
    
    for /F "usebackq tokens=1,* delims=:" %%g in ("v:\automazioneclip\virtualdubmod\temp\mediainfo%%~na.txt") DO (
    	if "%%g"=="Time code of first frame                 " Set TimeCode=%%h
    )
    Set "TimeCode=%TimeCode: =%"
    echo "%TimeCode%"
    echo "%TimeCode%"|clip >nul
    
    
            findstr /c:"Commercial name                          : XDCAM HD422" "v:\automazioneclip\virtualdubmod\temp\mediainfo%%~na.txt"
            IF NOT ERRORLEVEL 1 (
       
            echo DirectShowSource^("%d%\%%~na.mxf"^) >> v:\automazioneclip\virtualdubmod\temp\%%~na.avs 
            "v:\automazioneclip\virtualdubmod\virtualdubmod.exe" /s"v:\automazioneclip\virtualdubmod\scriptHD.vcf" /p"v:\automazioneclip\virtualdubmod\temp\%%~na.avs","v:\automazioneclip\output\%%~na.avi" /r /x
    
    if exist v:\automazioneclip\virtualdubmod\temp\ascii.txt del v:\automazioneclip\virtualdubmod\temp\ascii.txt
    if exist v:\automazioneclip\virtualdubmod\temp\unicodefile.txt del v:\automazioneclip\virtualdubmod\temp\unicodefile.txt
    	
    )
    
    
          goto loop  
          set done=1
       )
    )














    this script consider to process only all .mxf files that are not in v:\automazioneclip\output

    e.g if C0007.avi are in v:\automazioneclip\output ---> it don't process C0007.mxf of the input directory

    [because of the if not exist "v:\automazioneclip\output\%%~na.*" ( line]

    during execution it seems store timecode, but strangely don't put is on clipboard (using clip.exe for dos loaded on windows/system32)
    I cannnot undestand why
    Last edited by marcorocchini; 15th May 2014 at 03:33.
    Quote Quote  
  20. or I can use also ffprobe but I don't know how incorporate to my script

    the reason of my script is this: the script start from the .mxf file that are not processed. All .mxf processed have not to rewrite for transcoding.
    If I have 100 .mxf file, and 50 are jet transcoded --> I don't wont to re-transcode first 50 .mxf
    the script have to process only .mxf files not transcoded

    if your script can do this I would be glad to use yours ^^
    Quote Quote  
  21. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    I was just about to add the code to my .bat file when I realised it was already there. However, as always, I need to know the exact purpose of the code. Do you intend to run multiple instances of the batch file? That's important so I know how to position and name the working files and what to check for before I begin another.

    Code:
    echo %TIMECODE%|CLIP
    should work.

    ***I now have one more MKVToolNix bug under my belt, hopefully the time has come where I can continue using the tools without them constantly spitting error messages at me!!!***
    Quote Quote  
  22. at the moment for me is enought if I correct the timecode problem into my script
    I have try with echo %TIMECODE%|CLIP but seems don't work. It's strange because seems easy but in clipboard it don't want take in clipbrd
    Quote Quote  
  23. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    It works on mine... Why do you want the timecode in the clip-board anyhoo?

    What version of windows are you using? Apparently, CLIP was introduce in Windows Server 2003 and Vista. It can be copied between systems and used in Windows XP Pro but it doesn't look like it works with plain old XP at all.
    Quote Quote  
  24. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    By the way:

    Code:
    :Process_File <MXF_FILENAME>
    
    	Set /a Count+=1
    	Set "FOUNDLVL=%STARTLVL%"
    
    	echo Processing File; "%~nx1"
    	if /I NOT "%~x1"==".mxf" (
    		echo "%~nx1"
    		echo  Is not an mxf file.
    		pause
    		goto :eof
    	)
    	if EXIST "%DEST%\%~n1.avi" (
    		echo  Output Already Exists...
    		goto :eof
    	)
    	
    	SetLocal DisableDelayedExpansion
    	rem Find TimeCode Info
    But as it stands my script won't handle multiple instances at all. I've thought about copying your script into mine but you've mentioned things that aren't in there. I'm still trying to figure out why there's a 'set done=1' after a 'goto loop' where it can never be reached.
    Quote Quote  
  25. oh I don't know, it was write by one of my 5 cats!

    hoewver also me was thinking: why if there is a goto and is there a set done=1 so set done is baypassed by a cat! :=)

    the "clip" is just a whim to be sure that the environment variable is correctly assigned.
    The thing that make me angry with my script, is that sometimes (sometimes ^^^) the timecode enter in clip and sometimes not.

    Your script seems working (but I cannot try with the choice version) but seems to me each time it start from afresh:

    eg. if I have 1000 .mxf files in c:\mycats and I have processed 700 files, but the script start afresh from c0001.mxf and I have to be waith until C1000.mxf

    I woulk like a script that don't have to transcode the first 700 .mxf

    another thing: copy temp files would be sometimes uncomfortable when it comes to copying files of 20-30GB

    summarizing, I should do this:


    1) when the script starts it habe to ask if you want (as watch directory) to use the Current Directory or please specify what the Watch Directory of input .mxf files (but at the same time would be glad to receive .mxf files via drag and drop)

    [? set "d="
    set "done="
    set /p "d=Type source path (or press enter for current folder): "
    if not defined d set "d=%cd%"]

    2) output directory is fixed (e.g. o:\ or o:\output or o:\work o:\outputCATS ec.. for example here I assume o:\work )

    3) if o:\work have a file that have the same name without extension of a file contents in the watch directory ---> that file have to no process
    example: if o:\work have jet C009.avi and C0010.AVI and C0011.avi AND IF the watch directory have C0009.mxf and C0010.MXF and C0011.mxf ---> C0009/10/11.mxf have not to process [? if not exist "v:\automazioneclip\output\%%~na.*" ( ...]

    4) the order of the files to be processed should be from the older to the younger [for /f "delims=" %%a in ('dir *.mxf /b /od /a-d')]

    5) the script have to distinguish only hd (1920x1080) files from SD (IMX D-10 is 608?X576)

    (it's nice to see other resolutions and others addicted functions in your script but I risk of lose-me, if I before understand the bare essentials-->after I understand all the complements)

    Possibly would be better if the script recall a defined .vcf called (e.g) scriptHD.vcf and scriptSD.vcf
    because for HD have to use a codec (dmb1)
    and for SD have to use another codec (tvmj) (the reason of that is is more easy modify the vcf for subsequent additions to the operations of virtualdub, I know hoever it's possibile with the insertion o single lines

    echo VirtualDub.video.AdjustChapters^(1^)^;>>%1
    echo VirtualDub.video.SetDepth^(24,24^)^;>>%1
    echo VirtualDub.video.SetMode^(1^)^;>>%1

    but seems to me more pratical use pre-defined .vcf)

    6) timecode: if exist in source .mxf ---> it must be inserted in .avi (destination files)

    if not exist in .mxf don't insert nothing

    ndjamena thanks anyway also by my 5 cats
    Quote Quote  
  26. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    OK, THIS is how to make different .vcf files for HD and SD content:

    Code:
    	echo if "%V_Q%"=="HD" echo "Insert HD Video .vcf Info Like This">>%1
    	echo if "%V_Q%"=="SD" echo "Insert SD Video .vcf Info Like This">>%1

    And as far as I can tell, THIS is pretty much everything you've asked for:
    Code:
    @rem unless otherwise specified for debugging reasons turn echo off
    @if "%EMode%"=="" Set EMode=OFF
    @ECHO %EMode%
    
    rem delayed expansion is a bad idea when processing file names
    SetLocal DisableDelayedExpansion
    
    Set "EXTLIST=*.mxf"
    Set "DoPop=0"
    Set "ARGLVL=0"
    Set "FileName-DQ="
    Set VDM_LOC="C:\Program Files (x86)\VirtualDubMod\VirtualDubMod.exe"
    
    
    :MakeFolders
    Set "DestFolder=O:\output"
    if EXIST "%DestFolder%" goto :MakeWork
    type NUL
    mkdir "%DestFolder%"
    if "%ERRORLEVEL%"=="0" goto :MakeWork
    echo Error!!! Cannot Make Destination Folder:
    echo "%DestFolder%"
    pause
    goto :eof
    
    :MakeWork
    Set "WorkFolder=%DestFolder%\Work"
    if EXIST "%WorkFolder%" goto :ARGS
    type NUL
    mkdir "%WorkFolder%"
    if "%ERRORLEVEL%"=="0" goto :ARGS
    echo Error!!! Cannot Make Work Folder:
    echo "%WorkFolder%"
    pause
    goto :eof
    
    rem process the arguments one by one.
    :ARGS
    	
    	rem if there are no further arguments then exit the batch.
    	if [%1]==[] (
    		if "%ARGLVL%"=="0" (
    			CALL :GetTargetName		
    			EndLocal
    			pause
    		)
    		goto :eof
    	)
    
    	rem wildcard processing
    	Set "FileName=%~1"
    	if "%FileName%"=="" (
    		SHIFT
    		goto :ARGS
    	)
    
    	rem if the argument doesn't exist in the file system in any form skip it.
    	if NOT EXIST %1 (
    		SHIFT
    		goto :ARGS
    	)
    
    	if NOT [%1]==[] if NOT "%FileName:^*=%%FileName:^?=%"=="%FileName%%FileName%" (
    		for %%w in (%1) DO (
    			Set /a ARGLVL+=1
    			CALL :ARGS "%%~fw"
    			Set /a ARGLVL-=1
    		)
    		SHIFT
    		goto :ARGS
    	)
    	Set "FileName="
    		
    	rem Set search/recursion variables
    	Set "Pattern=%EXTLIST%"
    	Set "STARTLVL=0"
    	Set "FOUNDLVL=1024"
    	
    	rem if the argument is the current directory then process everything in it.
    	if "%~f1"=="%CD%" (
    		echo Processing Directory; "%CD%"
    		CALL :START %1
    		SHIFT
    		goto :ARGS
    	)
    	rem Test if the argument is a directory, if it is move to it then process everything in it, if not then move to the file's parent directory and process the file.  Then return to starting directory.
    	Type NUL
    	pushd "%~f1" 2> nul
    	if NOT "%errorlevel%"=="0" (
    		if NOT "%CD%\"=="%~dp1" (
    			pushd "%~dp1"
    			Set "DoPop=1"
    		)
    		Set Pattern="%~nx1"
    	) else (
    		echo Processing Directory; "%~f1"
    		Set "DoPop=1"
    	)
    	CALL :START %1
    	if "%DoPop%"=="1" (
    		popd
    		Set "DoPop=0"
    	)
    	SHIFT
    
    goto :ARGS
    
    :START <CURRENT_ARG>
    
    	rem Count is superseded by FOUNDLVL but may still be useful for renaming purposes
    	Set "Count=0"
    	rem Process all files in the current directory fitting the arguments search pattern.
    	for /f "delims=" %%y in ('dir %Pattern% /b /od /a-d') do (
    		if /I NOT "%%~y"=="File Not Found" CALL :Process_File "%%~fy"
    	)
    	rem if it didn't find anything search all directories instead
    	if "%Count%"=="0" if %STARTLVL% LSS %FOUNDLVL% (
    		for /d %%b in (*) do (
    			pushd "%%~fb"
    			echo Processing Directory; "%%~fb"
    			Set /a STARTLVL+=1
    			CALL :START "%%~fb"
    			Set /a STARTLVL-=1
    			popd
    		)
    	)
    
    goto :eof
    
    :Process_File <MXF_FILENAME>
    
    	Set /a Count+=1
    	Set "FOUNDLVL=%STARTLVL%"
    
    	echo Processing File; "%~nx1"
    	if /I NOT "%~x1"==".mxf" (
    		echo "%~nx1"
    		echo  Is not an mxf file.
    		pause
    		goto :eof
    	)
    	if EXIST "%DestFolder%\%~n1.avi" (
    		echo  Output Already Exists...
    		goto :eof
    	)
    	if EXIST "%WorkFolder%\%~n1.avi" (
    		echo  Working File Already Exists...
    		goto :eof
    		pause
    	)
    	
    	SetLocal DisableDelayedExpansion
    	rem Find TimeCode Info
    	Set AUCount=0;
    	for /f "tokens=1,2 delims=^=" %%g in ('FFProbe -hide_banner -loglevel fatal -pretty -show_streams -show_entries stream^=codec_type^,width^,height^,sample_aspect_ratio:stream_disposition^=:format_tags^=timecode^,company_name^,product_name^,product_version "%~1" 2^>^&1') DO (
    		 if "%%~g"=="TAG:company_name" set "T_Company_Name=%%~h"
    		 if "%%~g"=="TAG:product_name" set "T_Product_Name=%%~h"
    		 if "%%~g"=="TAG:product_version" set "T_Product_Version=%%~h"
    		 if "%%~g"=="TAG:timecode" set "TIMECODE=%%~h"
    		 if "%%~g"=="width" set "V_Width=%%~h"
    		 if "%%~g"=="height" set "V_Height=%%~h"
    		 if "%%~g"=="sample_aspect_ratio" set "V_PAR=%%~h"
    		 if "%%~g"=="codec_type" if "%%~h"=="audio" set /a AUCount+=1
    	)
    	if "%V_Width%"=="" (
    		echo  ERROR: Video Width NOT FOUND!
    		pause
    		goto :eof
    	)
    	if "%V_Height%"=="" (
    		echo  ERROR: Video Height NOT FOUND!
    		pause
    		goto :eof
    	)
    	if "%V_PAR%"=="" (
    		echo  ERROR: Video PAR NOT FOUND!
    		pause
    		goto :eof
    	)
    	rem Set "V_Q=UD"
    	rem if %V_Width% LEQ 1920 if %V_Height% LEQ 1120 \\
    	Set "V_Q=HD"
    	rem if %V_Width% LEQ 1280 if %V_Height% LEQ 752 Set "V_Q=MD"
    	if %V_Width% LEQ 1024 if %V_Height% LEQ 608 Set "V_Q=SD"
    	echo  Using %V_Q% Mode.
    	echo  PAR = %V_PAR%
    	if "%TimeCode%"=="" echo Warning! no TimeCode Found!
    	if NOT "%TimeCode%"=="" echo Timecode= %TIMECODE%
    	if NOT "%TimeCode:~2,1%"=="" echo %TimeCode:~0,-1%^%TimeCode:~-1,1%>"%~dpn1.txt"
    	rem if NOT "%TimeCode%"=="" echo %TimeCode% 1>"%~dpn1.txt"
    	CALL :MAKEVCF "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1"
    	echo  Done!
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    
    :MAKEVCF <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <MXF_FILENAME>
    
    	rem ***Make The .vcf Script File***
    	echo %T_Company_Name% %T_Product_Name% %T_Product_Version%
    	echo %AUCount% Audio Streams Detected.
    	echo VirtualDub.RemoveInputStreams^(^)^;>%1
    	echo VirtualDub.video.DeleteComments^(1^)^;>>%1
    	if NOT "%TimeCode%"=="" echo VirtualDub.video.AddComment^(0x0000000C,"","%TIMECODE%"^)^;>>%1
    	echo VirtualDub.video.AdjustChapters^(1^)^;>>%1
    	echo VirtualDub.video.SetDepth^(24,24^)^;>>%1
    	echo VirtualDub.video.SetMode^(1^)^;>>%1
    	echo VirtualDub.video.SetFrameRate^(0,1^)^;>>%1
    	echo VirtualDub.video.SetIVTC^(0,0,-1,0^)^;>>%1
    	echo VirtualDub.video.SetCompression^(0x6a6d7674,0,10000 ,0^)^;>>%1
    	echo VirtualDub.video.SetCompData^(28,"TUpQRxgAAAAAAAAAA gAAAAgAAAACAAAAAQAAAA=="^)^;>>%1
    	echo VirtualDub.video.filters.Clear^(^)^;>>%1
    	
    	echo if "%V_Q%"=="HD" echo "Insert HD Video Info Like This">>%1
    	echo if "%V_Q%"=="SD" echo "Insert SD Video Info Like This">>%1
    	
    	rem ***Make The .avs AVISynth Script***
    	echo DirectShowSource^(%4^)>%2
    	if "%V_Q%"=="HD" echo Crop^(0,32,0,0^)>>%2
    	
    	rem ***Call VirtualDub[Mod]
    	if NOT EXIST %VDM_LOC% (
    		echo  Um, where the hell is VirtualDubMod?
    		pause
    	)
    	%VDM_LOC% /s%1 /p%2,%3 /r /x
    	if NOT "%ERRORLEVEL%"=="0" (
    		echo  WARNING!!!  VirtualDubMod Error Detected!!!
    		pause
    	)
    	for %%v in (%3) do (
    		if %%~zv LSS 128 (
    			echo  ERROR!!!  Extra Small File Size Detected!!!
    			pause
    		)
    	)
    	rem Clean-up
    	if NOT EXIST DONE MKDIR DONE
    	DEL %1
    	DEL %2
    	if NOT EXIST "%DESTFOLDER%\%~n4.avi" goto :Skip-To-Cleanup
    
    :MakeOldFile
    	Set "TEMPFILE=%~n4-o%RANDOM%.avi"
    	if EXIST "%DESTFOLDER%\%TEMPFILE%" goto :MakeOldFile
    	REN "%DESTFOLDER%\%~n4.avi" %TEMPFILE%
    	
    :Skip-To-Cleanup
    	REN %3 "%~n4.avi"
    	MOVE "%WorkFolder%\%~n4.avi" ".."
    
    goto :eof
    
    :GetTargetName
    
    	Set "FileName="
    	Set /p FileName=Enter Target Name:
    	
    	rem Add or remove double-quotes if necessary
    
    	if NOT DEFINED FileName (
    		Set "FileName-DQ="
    		goto :DQSkip
    	)
    	
    	Set "FileName-DQ=%FileName:"=%"
    	if NOT DEFINED FileName-DQ (
    		Set "FileName="
    		Set "FileName-DQ="
    		goto :DQSkip
    	)
    	
    	if EXIST "%FileName-DQ%" (
    		if "%FileName-DQ%"=="%FileName-DQ: =%" (
    			Set "FileName=%FileName-DQ%"
    		) else (
    			Set FileName="%FileName-DQ%"
    		)
    	)
    
    :DQSkip
    
    	if /I "%FileName-DQ%"=="" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="CD" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="EXIT" goto :eof
    	if /I "%FileName-DQ%"=="X" goto :eof
    	if /I "%FileName-DQ%"=="NOEXIT" goto :GetTargetName
    	if DEFINED FileName (
    		Set /a ARGLVL+=1
    		CALL :ARGS %FileName%
    		Set /a ARGLVL-=1
    	)
    	
    goto :GetTargetName
    You need to customise the .vcf output and add the audio processing, I can see you're more than capable of doing that, just add the code to the :MAKEVCF block. %4 is the original file, the variable works just like %%a. ie. [%~n4]==[%%~na] so I know you understand.

    I've never used FFMPEG to process audio like that, and since it's not relevant to my ripping of DVDs and Blu Rays I don't see any point in learning.

    I haven't tested it yet, I can't actually test it anyway, I wiped my boot drive and all the programs on it.

    It doesn't sort files you've dragged and drop onto the .bat. It's possible to make it do that but very, very complicated.

    I've removed CHOICE, just pressing enter uses the current directory, which is useless unless you plan on copying the batch to the other hard drive. To exit you type EXIT.

    If it doesn't work I'll try to debug it blind.
    Last edited by ndjamena; 18th May 2014 at 06:44.
    Quote Quote  
  27. Name:  crying_cat.jpg
Views: 215
Size:  8.5 KB
    mm seems cannot create workfolder of impossible to find a envoroment variable at the beginning

    Click image for larger version

Name:	N3.JPG
Views:	208
Size:	58.2 KB
ID:	25210

    I have o: in subst ( subst o: v:\automazioneclip\output ) but I don't think is this the problem
    Last edited by marcorocchini; 15th May 2014 at 15:56.
    Quote Quote  
  28. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Set "Work=%DestFolder%\Work"

    Should be:

    Set "WorkFolder=%DestFolder%\Work"

    You specified calling %DestFolder% %D% so I fiddled with the names for a while before deciding on long names. I missed one.
    Quote Quote  
  29. I see now your answer, thanks: tomorrow I test it.

    In the meantime I try to understand a basic procedure in my rudimentary script, please can help me to insert the timecode-reading procedure?

    I have make a dir in c:\ called gatto
    so c:\gatto have 2 .mxf HD files:

    https://dl.dropboxusercontent.com/u/39871584/HD169.MXF
    https://dl.dropboxusercontent.com/u/39871584/C0020.mxf

    My output dir is v:\automazioneclip\output

    dir containig virtualdubmod is v:\automazioneclip\virtualdubmod

    and dir for temp files is v:\automazioneclip\virtualdubmod\temp

    the script is c:\gatto\s30.bat :

    Code:
    rem *** delete all .avs and .vcf temp file***
    del /q v:\automazioneclip\virtualdubmod\temp\*.*
    
    rem *** del o:\*.avi is only for debug-mode: it previously delete all .avi generated by virtualdub only for reiterate each time the entire process. Normally this line does not exist***
    del o:\*.avi
    
    @echo off
    set "d="
    set "done="
    set /p "d=Type source path (or press enter for current folder): "
    if not defined d set "d=%cd%"
    if not exist "%d%" echo Enter valid path - try again & goto :loop
    :loop
    cd /d "%d%"
    for /f "delims=" %%a in ('dir *.mxf /b /od /a-d') do (
      if defined done goto :EOF
       if not exist "v:\automazioneclip\output\%%~na.*" (
       
    
    
    
    rem ***in this hell I would like to be put the timecode-reader routine and point to %TIMECODE% ***
    
    
    
    
    
    
    
     echo Processing %d%\%%~na.mxf
    
            rem ***make .vcf in v:\automazioneclip\virtualdubmod\temp***
    	echo VirtualDub.RemoveInputStreams^(^)^;>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.DeleteComments^(1^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	if NOT "%TimeCode%"=="" echo VirtualDub.video.AddComment^(0x0000000C,"","%TIMECODE%"^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.AdjustChapters^(1^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.SetDepth^(24,24^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.SetMode^(1^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.SetFrameRate^(0,1^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.SetIVTC^(0,0,-1,0^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.SetCompression^(0x31626d64,0,10000 ,0^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.filters.Clear^(^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    
    
    
    
            rem ***make .avs an put it on v:\automazioneclip\virtualdubmod\temp***
            echo DirectShowSource^("%d%\%%~na.mxf"^) >> v:\automazioneclip\virtualdubmod\temp\%%~na.avs 
           
            rem *** make .avi file by virtualdub and put on v:\automazioneclip\output at the same time the script watch this dir to don't process all .mxf in input dir that are not in v:\automazioneclip\output ***
            "v:\automazioneclip\virtualdubmod\virtualdubmod.exe" /s"v:\automazioneclip\virtualdubmod\temp\%%~na.vcf" /p"v:\automazioneclip\virtualdubmod\temp\%%~na.avs","v:\automazioneclip\output\%%~na.avi" /r /x
            
    
    
    
    
    
          goto loop  
             )
    )

    so I try to modify it so add the timecode function:


    Code:
    rem *** delete all .avs and .vcf temp file***
    del /q v:\automazioneclip\virtualdubmod\temp\*.*
    
    rem *** del o:\*.avi is only for debug-mode: it previously delete all .avi generated by virtualdub only for reiterate each time the entire process. Normally this line does not exist***
    del o:\*.avi
    
    @echo off
    set "d="
    set "done="
    set /p "d=Type source path (or press enter for current folder): "
    if not defined d set "d=%cd%"
    if not exist "%d%" echo Enter valid path - try again & goto :loop
    :loop
    cd /d "%d%"
    for /f "delims=" %%a in ('dir *.mxf /b /od /a-d') do (
      if defined done goto :EOF
       if not exist "v:\automazioneclip\output\%%~na.*" (
       
    
    
    	for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdubmod\FFProbe -hide_banner -loglevel fatal -pretty -show_streams -show_entries stream^=codec_type^,width^,height^,sample_aspect_ratio:stream_disposition^=:format_tags^=timecode^,company_name^,product_name^,product_version "%d%\%%~na.mxf" 2^>^&1') DO (
    
    		 if "%%~g"=="TAG:timecode" set "TIMECODE=%%~h"
    	
    	)
    
    
    
    
    echo Processing %d%\%%~na.mxf
    echo %timecode%
    
            rem ***make .vcf in v:\automazioneclip\virtualdubmod\temp***
    	echo VirtualDub.RemoveInputStreams^(^)^;>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.DeleteComments^(1^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	if NOT "%TimeCode%"=="" echo VirtualDub.video.AddComment^(0x0000000C,"","%TIMECODE%"^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.AdjustChapters^(1^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.SetDepth^(24,24^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.SetMode^(1^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.SetFrameRate^(0,1^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.SetIVTC^(0,0,-1,0^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.SetCompression^(0x31626d64,0,10000 ,0^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    	echo VirtualDub.video.filters.Clear^(^)^;>>v:\automazioneclip\virtualdubmod\temp\%%~na.vcf
    
    
    
    
            rem ***make .avs an put it on v:\automazioneclip\virtualdubmod\temp***
            echo DirectShowSource^("%d%\%%~na.mxf"^) >> v:\automazioneclip\virtualdubmod\temp\%%~na.avs 
           
            rem *** make .avi file by virtualdub and put on v:\automazioneclip\output at the same time the script watch this dir to don't process all .mxf in input dir that are not in v:\automazioneclip\output ***
            "v:\automazioneclip\virtualdubmod\virtualdubmod.exe" /s"v:\automazioneclip\virtualdubmod\temp\%%~na.vcf" /p"v:\automazioneclip\virtualdubmod\temp\%%~na.avs","v:\automazioneclip\output\%%~na.avi" /r /x
            
    
    
    
    
    
          goto loop  
             )
    )
    but this produce a strange result:


    Click image for larger version

Name:	ERR8.JPG
Views:	162
Size:	47.3 KB
ID:	25212


    transcoding of the .mxf to .avi is ok (with naming and all) but at the first start of the script, the timecode %timecode% don't exist (echo error) and at the second pass - during processing C0077.mxf - where stored timecode of the previously file ... C0068.mxf

    please ndjamena can help me...

    tomorrow I try yours script, thanks!

    ps: my o:\ is v:\automazioneclip\output (is substed)
    Quote Quote  
  30. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    You can't change the value of a variable in a for statement from within said for statement (within the brackets). A value set inside a for statement only becomes set AFTER YOU LEAVE THE FOR STATEMENT BLOCK. It's the same with if statements with brackets or even enclosing code in nothing but brackets. That's why I keep using CALL.

    CMD parses the bracketed statement as a single script command and doesn't rebuild the command every time you set a variable. Until you move onto the next command all variables are fixed. CALL and Delayed Expansion are the only ways around that. Or possibly masses of gotos, or masses of ifs...
    Last edited by ndjamena; 16th May 2014 at 04:15.
    Quote Quote