VideoHelp Forum
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. For kindness, ndjamena can you help my cat that need you? ^^
    Click image for larger version

Name:	ccat6.jpg
Views:	398
Size:	51.0 KB
ID:	25839

    I would like to change my (your) modified script.
    At the moment this modified script do this: distinguish if the input file (or drag and dropped) is internally mjpeg or uncompressed yuy2.
    If it is mjpeg ---> goto procedure for mjpeg
    If it is yuy2---> goto procedure for uncompressed

    result is a file .mxf

    Source is a .avi file and a .wav file:

    this line is for uncompressed
    ffmbc -loglevel fatal -y -i "%CD%\%~n1.avi" -i "%CD%\%~n1.wav" -target imx50 -aspect 16:9 %WorkFolder%\%~n1.mxf

    and this is for mjpeg:
    ffmpeg.exe -y -i "%CD%\%~n1.avi" -pix_fmt yuvj422p -an -f rawvideo - | v:\automazioneclip\core\ffmbc.exe -loglevel fatal -y -f rawvideo -pix_fmt yuv422p -s 720x576 -r 25 -i - -tff -i "%CD%\%~n1.wav" -target imx50 -aspect 16:9 %WorkFolder%\%~n1.mxf

    booth use as audio source the same filname of the .avi. For example: if I drag and drop C:\cats\C0001.avi, the command line use c:\cats\C0001.wav as audio source.


    Now I would like change it so it do this:

    1) if audio source does not exist (if the the same filename with extension .wav is not found in the same dir of the .avi) the batch assume that audio is v:\empty.wav

    2) I would like integrate a timecode in the .mxf so would be nice if the batch ask to the user... "please specify timecode, press Enter", within 3 second. If in 3 second the user don't press ENTER the batch start the procedure without timecode.

    But if the user press enter and put a timecode (e.g.) 01:22:40:55

    the command line become

    ffmbc -loglevel fatal -y -i "%CD%\%~n1.avi" -i "%CD%\%~n1.wav" -target imx50 -timecode 01:22:40:55 -aspect 16:9 %WorkFolder%\%~n1.mxf


    THANKS!!!!!
    Last edited by marcorocchini; 19th Jun 2014 at 19:57.
    Quote Quote  
  2. This is the batch:

    Code:
    @rem unless otherwise specified for debugging reasons turn echo off
    @if "%EMode%"=="" Set EMode=ON
    @ECHO %EMode%
    @ECHO off
    
    SetLocal DisableDelayedExpansion
    
    Set "EXTLIST=*.avi"
    Set "DoPop=0"
    Set "ARGLVL=0"
    Set "FileName-DQ="
    Set VDM_LOC="v:\automazioneclip\VirtualDubMOD\virtualdubmod.exe"
    
    if not exist v:\automazioneclip\output\progetto1 mkdir v:\automazioneclip\output\progetto1
    set "DestFolder=v:\automazioneclip\output\broadcast"
    
    
    Set "WorkFolder=%DestFolder%"
    
    if not exist %DestFolder% mkdir %DestFolder%
    
    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%" (
    		rem 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 (
    		rem 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"
    			rem echo Processing Directory "%%~fb"
    			Set /a STARTLVL+=1
    			CALL :START "%%~fb"
    			Set /a STARTLVL-=1
    			popd
    		)
    	)
    
    goto :eof
    
    :Process_File <AVI_FILENAME>
    
    	Set /a Count+=1
    	Set "FOUNDLVL=%STARTLVL%"
    
    	echo Processing "%CD%\%~nx1"
    	if /I NOT "%~x1"==".avi" (
    		echo "%~nx1"
    		echo  is not a .avi file
    		pause
    		goto :eof
    	)
    	if EXIST "%DestFolder%\%~n1.avi" (
    		echo  File già esistente nella directory di destinazione %DestFolder%
    
    
    
    
    
    
    		goto :eof
    	)
    	if EXIST "%WorkFolder%\%~n1.mp4" (
    		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 ('v:\automazioneclip\virtualdubmod\FFProbe -hide_banner -loglevel fatal -pretty -show_streams -show_entries stream^=codec_type^,codec_tag_string^,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_tag_string" set "codec_tag_string=%%~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 "%codec_tag_string%"=="" (
    		echo  ERROR: no codec tag 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 "%codec_tag_string%"=="YUY2" (CALL :MAKEVCF_YUY2 "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    if "%codec_tag_string%"=="MJPG" (CALL :MAKEVCF_MJPG "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    
    
    
    rem CALL :MAKEVCF "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1"
    
    	echo  FATTO
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    
    :MAKEVCF_YUY2 <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <avi_FILENAME>
    
            v:\automazioneclip\core\ffmbc -loglevel fatal -y -i "%CD%\%~n1.avi" -i "%CD%\%~n1.wav" -target imx50 -aspect 16:9 %WorkFolder%\%~n1.mxf
    
    	
    goto :eof
    
    
    :MAKEVCF_MJPG <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <avi_FILENAME>
    
    
            v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -pix_fmt yuvj422p -an -f rawvideo - |  v:\automazioneclip\core\ffmbc.exe -loglevel fatal -y -f rawvideo -pix_fmt yuv422p -s 720x576 -r 25 -i - -tff -i "%CD%\%~n1.wav" -target imx50 -aspect 16:9 %WorkFolder%\%~n1.mxf
    
          
    
    goto :eof
    
    :GetTargetName
    
    	Set "FileName="
    	Set /p FileName=InputFileName.mxf o InputFolder - INVIO per convertire tutto (EXIT esce):
    	
    	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%"=="NOEXIT" goto :GetTargetName
    	if DEFINED FileName (
    		Set /a ARGLVL+=1
    		CALL :ARGS %FileName%
    		Set /a ARGLVL-=1
    	)
    	
    goto :GetTargetName
    Quote Quote  
  3. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Please stop with the CAT thread titles. Please describe the problem in the thread title instead.
    Quote Quote  
  4. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    if exist "%~dpn1.wav" (
    set "Audio=%~dpn1.wav"
    ) else (
    set "Audio....

    Can't be bothered finishing. You're not using XP now, so use choice with it's timeout option.
    Quote Quote  
  5. Originally Posted by ndjamena View Post
    if exist "%~dpn1.wav" (
    set "Audio=%~dpn1.wav"
    ) else (
    set "Audio....

    Can't be bothered finishing. You're not using XP now, so use choice with it's timeout option.
    mm thanks: now I'm in a windows 8.1 s.o. ^^
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!