VideoHelp Forum




+ Reply to Thread
Page 2 of 4
FirstFirst 1 2 3 4 LastLast
Results 31 to 60 of 98
  1. VirtualDub.RemoveInputStreams();
    VirtualDub.video.DeleteComments(1);
    VirtualDub.video.AddComment(0x0000000C,"","01:34:2 1:15");
    VirtualDub.video.AdjustChapters(1);
    VirtualDub.video.SetDepth(24,24);
    VirtualDub.video.SetMode(1);
    VirtualDub.video.SetFrameRate(0,1);
    VirtualDub.video.SetIVTC(0,0,-1,0);
    VirtualDub.video.SetCompression(0x6a6d7674,0,10000 ,0);
    VirtualDub.video.SetCompData(28,"TUpQRxgAAAAAAAAAA gAAAAgAAAACAAAAAQAAAA==");
    VirtualDub.video.filters.Clear();


    summarily script this is the .vcf script to elaborate [01:34:21:15 is a e.g. timecode]

    the output avi file would be o:\temp.avi
    Quote Quote  
  2. p.s. considering your script, would be better if o:\temp.avi is fixed as default output of the script
    (because to hook it to my script I get temp.avi and rename as %initialSourceNameWithoutMXFextension%.avi
    Quote Quote  
  3. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Code:
    CALL :MAKEVCF "%~dpn1.vcf" "%~dpn1.avs" "Temp.avi" "%~f1"
    OR

    Code:
    "VirtualDubMod.exe" /s%1 /p%2,"Temp.avi" /r /x
    OR

    Replace "Temp.avi" with "%~dp1Temp.avi" or with any other path, depending on where you want to put it.
    Quote Quote  
  4. mm some minutes ago semms work, but not I have copy/past you entire code but seems the temp.avi file is empty
    seems my script returns: no timecode found but I do some proof
    Quote Quote  
  5. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    ??? I just ran my script, I got the end file, only I don't have the Modified VDubMod so:

    Recorded date : 01:34:21.15

    Unless I've changed something... I'll check.
    Quote Quote  
  6. no sorry: I'm wrong! argh I have input wrong .mxf

    seems work

    Anhoter thing: I have modify virtualdubmod.exe with hex editor

    Click image for larger version

Name:	VMOD1.JPG
Views:	185
Size:	298.9 KB
ID:	25161Click image for larger version

Name:	VMOD2.JPG
Views:	184
Size:	270.4 KB
ID:	25162
    Last edited by marcorocchini; 11th May 2014 at 15:10.
    Quote Quote  
  7. ISMP in place of ICRD :=)
    otherwise it don't means "timecode"
    NLE recognize "timecode" as "ISMP" Image
    [Attachment 25160 - Click to enlarge]
    Quote Quote  
  8. ndjamena please I ask you kindly:

    how I have modify the script so that the .avs file have to include a crop(0,32,0,0) line e.g.:

    directshowSource("mycats.mxf")
    crop(0,32,0,0)
    Quote Quote  
  9. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Code:
    echo DirectShowSource^(%4^)>%2
    echo Crop^(0,32,0,0^)>%2
    Hmmmm. Now I'm thinking I should look at your script with a more cynical eye
    Quote Quote  
  10. mmmm wont you try my new NLE? It's called speed razor, I have adjust it for work HD files.. :=)
    Quote Quote  
  11. Originally Posted by ndjamena View Post
    Code:
    echo DirectShowSource^(%4^)>%2
    echo Crop^(0,32,0,0^)>%2
    Hmmmm. Now I'm thinking I should look at your script with a more cynical eye



    ahh I have tryed

    echo DirectShowSource^(%4^)>%2
    echo crop(0,32,0,0)^(%4^)>%2

    but I have don't see the ^ because I have the cat's eye

    echo Crop^(0,32,0,0^)>%2
    Quote Quote  
  12. https://dl.dropboxusercontent.com/u/39871584/C0015.MXF

    this is an example of what avisynth have to do: cut 32 upper lines with the crop(0,32,0,0)

    but I don't know why, but seems the script generate a c0015.avs that contains only:

    Crop(0,32,0,0)

    and not

    directshowsource(...)
    Crop(0,32,0,0)
    Quote Quote  
  13. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Sorry, my bad:

    Code:
    echo DirectShowSource^(%4^)>%2
    echo Crop^(0,32,0,0^)>>%2
    Quote Quote  
  14. mmm interesting
    you use a refined and delicate hands to program, but I have a cat paws.

    hoping not to bore you too much now I should just integrate your script in my script:

    simply I think my source is %d%\%%~na.mxf

    now seems to me your script have to assume that %d%\%%~na.mxf is the source file
    Quote Quote  
  15. maybe the block to change is:

    SetLocal DisableDelayedExpansion

    Set "EXTLIST=*.mxf"
    Set "DoPop="

    if [%1]==[] (
    Set "Pattern=%EXTLIST%"
    CALL :START %1
    )


    maybe it have assume only that file to treat is my %d%\%%~na.mxf
    because my script have jet choosed the .mxf file to treat (the older .mxf file in the watch directory)


    OR I can use your script but I need to change it fo do:

    in a dir have to be choosed the old (old date) .mxf file
    if it is HD do ...
    if it is SD do...
    and then, if it is HD and have timecode do...
    if it is SD and have timecode do...

    if it is HD and don't have timecode do...
    if it is SD and don't have timecode do...

    If is not recognizable HD or SD independently by the timecode try to do...
    Last edited by marcorocchini; 11th May 2014 at 18:07. Reason: grr
    Quote Quote  
  16. rightly be in bed, anyway thanks ^^
    Quote Quote  
  17. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Code:
    :Process_File
    
    	Set /a Count+=1
    
    	SetLocal DisableDelayedExpansion
    	rem Find TimeCode Info
    	echo Processing; "%~nx1"
    	set "TIMECODE="
    	for /f "tokens=1,2 delims=^=" %%g in ('FFProbe -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"
    			  goto :next
    		 )
    		 if "%%~g"=="width" (
    			set "V_Width=%%~h"
    		 )
    		 if "%%~g"=="height" (
    			set "V_Height=%%~h"
    		 )
    		 if "%%~g"=="sample_aspect_ratio" (
    			set "V_PAR=%%~h"
    		 )
    	)
    
    	if "%TIMECODE%"=="" (
    		 echo NO TIMECODE FOUND IN:
    		 echo "%~1"
    		 pause
    	) else (
    		CALL :MAKEVCF "%~dpn1.vcf" "%~dpn1.avs" "%~dp1Temp.avi" "%~f1"
    	)
    	echo Done!
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    If you can incorporate that it should make things a little easier.

    Code:
    	for /f "delims=" %%y in ('dir %Pattern% /b /od /a-d') do (
    		if /I NOT "%%~y"=="File Not Found" CALL :Process_File "%%~fy"
    	)
    and that goes in the start routine to select files in order of age.
    Quote Quote  
  18. Code:
    abc
    Quote Quote  
  19. ndjamena sorry, I have try to replace your new block of : process file but returns that timecode are not found for all .mxf

    try to replace the

    Code:
    for /f "delims=" %%y in ('dir %Pattern% /b /od /a-d') do (
    		if /I NOT "%%~y"=="File Not Found" CALL :Process_File "%%~fy"
    	)
    so new code is


    Code:
    SetLocal DisableDelayedExpansion
    
    Set "EXTLIST=*.mxf"
    Set "DoPop="
    
    if [%1]==[] (
    	Set "Pattern=%EXTLIST%"
    	CALL :START %1
    )
    
    :ARGS
    
    	if [%1]==[] (
    		EndLocal
    		pause
    		goto :eof
    	)
    	if NOT EXIST %1 (
    		SHIFT
    		goto :ARGS
    	)
    	Set "Pattern=%EXTLIST%"
    	if "%~f1"=="%CD%" (
    		CALL :START %1
    		SHIFT
    		goto :ARGS
    	)
    	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"
    	for /f "delims=" %%y in ('dir %Pattern% /b /od /a-d') do (
    		if /I NOT "%%~y"=="File Not Found" CALL :Process_File "%%~fy"
    	)
    
    goto :eof
    
    :Process_File
    
    	Set /a Count+=1
    
    	SetLocal DisableDelayedExpansion
    	echo Processing; "%~nx1"
    	set "HOUR="
    	for /f "tokens=1,2,3,4,5 delims=: " %%g in ('FFPROBE.EXE "%~1" 2^>^&1') DO (
    		 if "%%~g"=="timecode" (
    			  set "HOUR=%%~h"
    			  set "MINS=%%~i"
    			  set "SECS=%%~j"
    			  set "MILLI=%%~k"
    			  goto :next
    		 )
    	)
    :NEXT
    
    	if "%HOUR%"=="" (
    		 echo NO TIMECODE FOUND IN:
    		 echo "%~1"
    		 pause
    	) else (
    		CALL :MAKEVCF "%~dpn1.vcf" "%~dpn1.avs" "%~dpn1.avi" "%~f1"
    	)
    	echo Done!
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    	
    :MAKEVCF
    
    	echo VirtualDub.RemoveInputStreams^(^)^;>%1
    	echo VirtualDub.video.DeleteComments^(1^)^;>>%1
    	echo VirtualDub.video.AddComment^(0x0000000C,"","%HOUR%:%MINS%:%SECS%.%MILLI%"^)^;>>%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 DirectShowSource^(%4^)>%2
           echo Crop^(0,32,0,0^)>>%2
    
    	"VirtualDubMod.exe" /s%1 /p%2,"o:\%~n1.avi" /r /x
    
    goto :eof
    hoewver this makevcf procedure is valid only for SD .mxf files
    I would like have multiple "makevcf":

    if .mxf is HD and have timecode --->makevcf for hd files that have timecode
    if .mxf is HD and don't have timecode --->makevcf for hd files that don't have timecode

    if .mxf is SD and have timecode --->makevcf for SD files that have timecode
    if .mxf is SD and don't have timecode --->makevcf for SD files that don't have timecode

    if file is not clear is HD or SD indepentently from timecode try to do another procedure routine

    this are sample HD and SD .mxf files

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

    SD:
    https://dl.dropboxusercontent.com/u/39871584/IMX169.mxf
    https://dl.dropboxusercontent.com/u/39871584/C0044.MXF
    https://dl.dropboxusercontent.com/u/39871584/C0015.MXF

    would be nice is the script include 4 different routine to treat HD/SD tc/noTC .mxf files
    Quote Quote  
  20. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    I've removed the HOUR/MINS/SECS/MILLI variables and replaced them with TIMECODE as they weren't necessary to what you are doing. You'll need to replace them in the MAKEVCF section too.

    I added V_Width and V_Height so you could determine dimensions of the video, you can now tell if the file is SD or HD if you write the code in yourself.

    If you copy the :MAKEVCF section and rename them to indicate SD and HD you can CALL either one depending on the resolution. PAR will tell you if they're anamorphic or not, which is likely if you're going to start dealing with SD content. I can't really write the entire thing for you as I don't actually know what the end result is supposed to be.
    Quote Quote  
  21. ok thanks, but only one thing: if the script had to be not ciclic, if when it start ask: "please insert filename to process" how it has to be changed? thank you ndjamena
    Quote Quote  
  22. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    User input is difficult because you can write anything into Set /p and can easily crash the batch. I'm going to have to assume you'll just drag and drop a single file or directory onto the command prompt because anything else would be too difficult.


    This goes at the end of the file:
    Code:
    :GetFileName
    
    	Set "FileName="
    	Set /p FileName=EnterFileName:
    	
    	if [%FileName%]==[] (
    		CALL :ExitPrompt
    	)
    	if /I [%FileName%]==[EXIT] Set "FileName="
    	if /I NOT [%FileName%]==[NoExit] if /I NOT [%FileName%]==[] (
    		CALL :ARGS %FileName%
    	)
    	
    goto :eof
    
    :ExitPrompt
    
    	CHOICE /c YN /m "Exit Batch?"
    	if ERRORLEVEL 2 Set "FileName=NoExit"
    	
    goto :eof
    And the start of :ARGS becomes this:
    Code:
    :ARGS
    	
    	rem if there are no further arguments then exit the batch. -Edit- Ask for a FileName First
    	if [%1]==[] (
    		CALL :GetFileName
    	)
    	if [%1]==[] if [%FileName%]==[] (
    		EndLocal
    		pause
    		goto :eof
    	)
    	if [%1]==[] goto :ARGS
    	
    	rem if the argument doesn't exist in the file system in any form skip it.
    You can delete:
    Code:
    if [%1]==[] (
    	Set "Pattern=%EXTLIST%"
    	CALL :START %1
    )
    from the beginning if you like.
    Quote Quote  
  23. Name:  Lost Cat.jpg
Views: 334
Size:  14.1 KB

    With the manual input I try to understand the batch, however considerig only the initial script (the ciclic script) please can only modify it so for HD .mxf do "procedure HD" and for SD .mxf do "procedure SD"?

    is not important the virtualdubmod commanline and .vcf, I modify it, it's only to understand how have to do to differentiate the routines
    Last edited by marcorocchini; 12th May 2014 at 17:13.
    Quote Quote  
  24. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    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="
    
    rem process the arguments one by one.
    :ARGS
    	
    	rem if there are no further arguments then exit the batch.
    	if [%1]==[] (
    		CALL :GetFileName
    	)
    	if [%1]==[] if [%FileName%]==[] (
    		EndLocal
    		pause
    		goto :eof
    	)
    	if [%1]==[] 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
    	)
    	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 <CURRENT_ARG>
    
    	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" (
    		for /d %%b in (*) do (
    			pushd "%%~fb"
    			CALL :START "%%~fb"
    			popd
    		)
    	)
    
    goto :eof
    
    :Process_File <MXF_FILENAME>
    
    	Set /a Count+=1
    	
    	echo Process; "%~1"
    
    	SetLocal DisableDelayedExpansion
    	rem Find TimeCode Info
    	echo Processing; "%~nx1"
    	set "TIMECODE="
    	for /f "tokens=1,2 delims=^=" %%g in ('FFProbe -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 "%~dpn1.vcf" "%~dpn1.avs" "%~dp1Temp.avi" "%~f1"
    		) else (
    			CALL :MAKEVCF_HD "%~dpn1.vcf" "%~dpn1.avs" "%~dp1Temp.avi" "%~f1"
    		)
    	)
    	echo Done!
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    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^(0x6a6d7674,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
    
    	rem ***Call VirtualDub[Mod]
    	"C:\Program Files (x86)\VirtualDubMod\VirtualDubMod.exe" /s%1 /p%2,%3 /r /x
    
    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^(0x6a6d7674,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,30,0,0^)>>%2
    	
    	rem ***Call VirtualDub[Mod]
    	"C:\Program Files (x86)\VirtualDubMod\VirtualDubMod.exe" /s%1 /p%2,%3 /r /x
    
    goto :eof
    
    :GetFileName
    
    	Set "FileName="
    	Set /p FileName=EnterFileName:
    	
    	if [%FileName%]==[] (
    		CALL :ExitPrompt
    	)
    	if /I [%FileName%]==[EXIT] Set "FileName="
    	if /I NOT [%FileName%]==[NoExit] if /I NOT [%FileName%]==[] (
    		CALL :ARGS %FileName%
    	)
    	
    goto :eof
    
    :ExitPrompt
    
    	CHOICE /c YN /m "Exit Batch?"
    	if ERRORLEVEL 2 Set "FileName=NoExit"
    	
    goto :eof
    http://ss64.com/nt/
    Quote Quote  
  25. mmm interesting, I was meaning the recursive script (your initial, but with this implementations). This, if I don't mistake, ask for inputfile.

    However can it accept as HD files, .mxf that are 1920x1080?
    Quote Quote  
  26. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    You CAN enter a directory name if you like, it'll process it exactly the same as before, or you can just add the first bit back in if you really want it to start by itself.

    HD = 720p or higher, if you want more resolution distinctions you can add them. Like I said, I don't really know what the end result should be and it will get more and more complicated the more options you add.

    This will let you type in CD to process the current directory:
    Code:
    :GetFileName
    
    	Set "FileName="
    	Set /p FileName=EnterFileName:
    	
    	if [%FileName%]==[] (
    		CALL :ExitPrompt
    	)
    	if /I [%FileName%]==[CD] Set FileName="%CD%"
    	if /I [%FileName%]==[EXIT] Set "FileName="
    	if /I NOT [%FileName%]==[NoExit] if /I NOT [%FileName%]==[] (
    		CALL :ARGS %FileName%
    	)
    	
    goto :eof
    Quote Quote  
  27. oh yes, the current directory is fantastic

    at the moment it return "Video Width not found" but maybe I have mistake something.
    Now I have to go bed, however thanks
    Quote Quote  
  28. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Mine is working, using your original file...
    Quote Quote  
  29. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    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="
    
    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
    	)
    	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 if the argument doesn't exist in the file system in any form skip it.
    	if NOT EXIST %1 (
    		SHIFT
    		goto :ARGS
    	)
    	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%"
    	
    	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 ('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
    	)
    	if %V_Width% LEQ 1024 if %V_Height% LEQ 576 Set "V_Q=SD"
    	if %V_Width% LEQ 1280 if %V_Height% LEQ 720 Set "V_Q=MD"
    	if %V_Width% LEQ 1920 if %V_Height% LEQ 1088 Set "V_Q=HD"
    	if "%V_Q%"=="" Set "V_Q=UD"
    	echo Using %V_Q% Mode.
    	echo PAR = %V_PAR%
    	if "%TimeCode%"=="" echo Warning! no TimeCode Found!
    :MakeTempFile
    	Set TEMPFILE="%~dpn1-t%RANDOM%.avi"
    	if EXIST %TEMPFILE% goto :MakeTempFile
    	CALL :MAKEVCF "%~dpn1.vcf" "%~dpn1.avs" %TEMPFILE% "%~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
    	
    	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 "C:\Program Files (x86)\VirtualDubMod\VirtualDubMod.exe" (
    		echo Um, where the hell is VirtualDubMod?
    		pause
    	)
    	"C:\Program Files (x86)\VirtualDubMod\VirtualDubMod.exe" /s%1 /p%2,%3 /r /x
    	if NOT "%ERRORLEVEL%"=="0" (
    		echo WARNING!!!  VirtualDubMod Error Detected!!!
    		pause
    	)
    	rem Clean-up
    	if NOT EXIST DONE MKDIR DONE
    	MOVE %4 DONE
    	DEL %1
    	DEL %2
    	if NOT EXIST "%~n4.avi" (
    		REN %3 "%~n4.avi"
    		goto :Skip-Cleanup
    	)
    :MakeOldFile
    	Set TEMPFILE="%~n4-o%RANDOM%.avi"
    	if EXIST %TEMPFILE% goto :MakeOldFile
    	REN %3 %TEMPFILE%
    	
    :Skip-Cleanup
    
    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="
    		CALL :ExitPrompt
    		goto :DQSkip
    	)
    	
    	Set "FileName-DQ=%FileName:"=%"
    	if NOT DEFINED FileName-DQ (
    		Set "FileName="
    		Set "FileName-DQ="
    		CALL :ExitPrompt
    		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%"=="CD" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="EXIT" 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
    
    :ExitPrompt
    
    	CHOICE /c YN /m "Exit Batch?"
    	if ERRORLEVEL 1 (
    		Set "FileName=Exit"
    		Set "FileName-DQ=Exit"
    	)
    	if ERRORLEVEL 2 (
    		Set "FileName=NoExit"
    		Set "FileName-DQ=NoExit"
    	)
    	
    goto :eof
    Warning; it may be buggy.

    I've been re-reading the thread. My batch script processes files or, if given a directory, all files in said directory, it always has. You'll have to add audio processing yourself, I don't have your setup, or all the files you're using so there's no point in me taking it too far (or at least, even further). I've added four levels of resolution detection, you can add more if you like, the tags have been available for a while, use them how you will. I collapsed MAKEVCF into a single function, you could even collapse it into Process_File if you like, it'll be cleaner, but harder to modify later. Anyway, I can't tell if I'm just being a nuisance or not so I'll stop now.
    Quote Quote  
  30. nono, your script is useful! thanks
    only me and my five cats trying to understand your script (at the moment I get Video width not found) so need time to understand: please forget the manual entry of inputfile (I wondered for it only to understand step by step). It would have to be reiterative, but only I have some fixed conditional:

    1) input folder can be the current folder, or the script (as my script) can ask for the input folder and if I hit the return key assum the current folder
    e.g if my .mxf files are in d:\mycats I type d:\mycats [or press Enter if i'm jet] (of course mycats contains C0001.mxf C0002.mxf C0003.mxf ecc.)

    2) output folder is fixed to (e.g.) o:\
    output .avi naming is the same name of .mxf inputfile (and not alwais o:\temp.avi)

    3) (as my script) if output folder (o:\) jet contatins (e.g.) c0035.avi ---> then the script have to no-process d:\mycats\C0035.mxf
    And in general, if output folder jet contain processed file, simply have to start from files not processed (I assumed files processed are good)
    If I'm not mistaken your script each time is started, start afresh overwriting .avi in output folder

    4) if - during process of file - happens an error reading .mxf (mxf corrupter file data, mxf unopenable or unseekable ecc..) the script have to proceed with the next file without generate any output, even without generating an empty file

    5) script have not to act to files contained in subdirectory (eg. if exist d:\mycats\dogs with .mxf files in dogs --> it have to consider only .mxf in mycats, and not .mxf in dogs)

    what version of ffprove have you?

    thanks a lot

    ps. think I don't have the "choice" command
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!