VideoHelp Forum
+ Reply to Thread
Results 1 to 24 of 24
Thread
  1. Hi cats,

    please consider that I'm already inside a batch processing. For example I have this example .avs

    Code:
    Import("v:\automazioneclip\avisynth\plugins\IResize.avsi")
    Import("V:\automazioneclip\AviSynth\plugins\smoothFPS2.avsi")
    LoadPlugin("v:\automazioneclip\AviSynth\Lsmash64perVirtualDub64\LSMASHSource.dll")
    LoadPlugin("V:\automazioneclip\AviSynth\plugins64\ffms2.dll")
    LoadCPlugin("v:\automazioneclip\avisynth\plugins64\yadif.dll")  
    vid=LSMASHVideoSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4")          
    aud=LWLibavAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4",stream_index=1)
    left=GetChannel(aud, 1)
    right=GetChannel(aud, 2)
    both=mergechannels(left, right)
    audiodub(vid, both)
    ConvertAudioTo16Bit()
    ConvertToYUY2(interlaced=false)
    colorMatrix(mode="Rec.601->Rec.709")
    SmoothFPS2(50000,1000) 
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave() 
    AssumeFPS(25)
    I need to delete ONLY the red line independently for the path of the mp4 file.
    I want erase all the red text

    Code:
    aud=LWLibavAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4",stream_index=1)
    I want to tell to the batch process that have to delete "aud=LWLibavAudioSource" and all the text included in the "(" ")"

    How can I do? thanks
    Quote Quote  
  2. The script will fail if you delete that line. The next five lines all reference the audio.
    Quote Quote  
  3. yes I know, but really I need to replace it with:

    Code:
    aud=FFAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4")
    it should replace "LWLibavAudioSource" with "FFAudioSource"

    and delete ",stream_index=X" where "X" is variable (can be 0 or 1 or 2 etc..)

    but first of all I preferable delete all the line, if possible
    Quote Quote  
  4. Originally Posted by jagabo View Post
    I don't know why you can just search for yourself:
    Perhaps Google isn't available in his country?

    https://www.google.com/search?q=batch+search+replace+utility&ie=utf-8&oe=utf-8
    Quote Quote  
  5. ok but in my case I need to delete and replace all the text included inside the brackets "(" and ")".

    However I try to do a routine, inside a batch, that recognize if the encoding process of a pre-created .avs crashes or not.
    In case of crash the batch processing, replace the LSMASHSource Video and Audio sources using FFVideoSource and FFAudioSource. But FFAudioSource don't want the ",stream_index=x"

    Code:
            set "seemsAllOk=0"    
            if exist "%CD%\tempGeneralTest.mp4" del "%CD%\tempGeneralTest.mp4"
            ffmpeg64bit2014.exe -loglevel fatal -y -i "%~n1_HD.avs" -c:v mjpeg -pix_fmt uyvy422 -c:a libmp3lame -ar 48000 -aspect 16:9 -ar 48000 -ss 00:00:00 -t 00:00:01 -an "%CD%\tempGeneralTest.mp4"
            if exist "%CD%\tempGeneralTest.mp4" set "seemsAllOk=1" 
            if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" "vid=LSMASHVideoSource" "vid=FFVideoSource"
            if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" "vid=LWLibavVideoSource" "vid=FFVideoSource"
            if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" "aud=LWLibavAudioSource" "aud=FFAudioSource"
            if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" ",stream_index=0" " "
            if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" ",stream_index=1" " "
            if exist "%CD%\tempGeneralTest.mp4" del "%CD%\tempGeneralTest.mp4"
    For which I would primarily need to delete the ",stream_index=x"

    For example:

    from
    Code:
    aud=LWLibavAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4",stream_index=1)
    I need to get

    Code:
    aud=LWLibavAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4")
    But I'm not able to do that, because I'm a ***
    Quote Quote  
  6. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    If you haven't already found a solution to this you might try AVISYNTh's Try...Catch. I have modified the code below since I do not have the same Filters but you
    should notice I do not have your Aud path or file in the first Try portion and the AVS completes through the catch portion with the path and file I do have

    Code:
    LoadPlugin("C:\Users\Bud\Desktop\MEGA_Trimmed_Tabbed_2_2\bin\Debug\ffms2.dll")
    LoadPlugin("C:\Users\Bud\Desktop\MEGA_Trimmed_Tabbed_2_2\bin\Debug\DGDecode.dll")
    LoadPlugin("C:\Users\Bud\Desktop\MEGA_Trimmed_Tabbed_2_2\bin\Debug\AutoCrop.dll")
    
    try {
    aud=LWLibavAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4",stream_index=1)
    }
    
    catch(err_msg) {
    aud=FFAudioSource("C:\Users\Bud\Desktop\[dp]Manjandani-1.mp4")
    }
    
    vid = FFVideoSource("C:\Users\Bud\Desktop\[dp]Manjandani-1.mp4")
    left=GetChannel(aud, 1)
    right=GetChannel(aud, 2)
    both=mergechannels(left, right)
    audiodub(vid, both)
    ConvertAudioTo16Bit()
    ConvertToYUY2(interlaced=false)
    colorMatrix(mode="Rec.601->Rec.709")
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave() 
    AssumeFPS(25)
    Last edited by Budman1; 30th Dec 2017 at 22:18. Reason: Revised code for simpler form
    Quote Quote  
  7. Instead deleting isn't easier just generate script without this line?
    Quote Quote  
  8. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    But I'm not able to do that, because I'm a ***
    I DID mention it was in case he had not found a better way already. I also thought that he may, in the future, want to change the script of a different file in addition to just deleting a line. I would just ignore my post if try catch is something everyone knows of already.
    Thanks
    Quote Quote  
  9. Why not use a single function to open both the audio and video? Is there a reason for using LSmash for one and ffms2 for the other?
    Is it also possible LWLibavAudioSource is failing because stream_index=1?
    Stream index can also be -1 which means the first audio stream found in the source file.

    marcorocchini, here's a couple of scripts you might want to try,

    They're based on the FFmpegSource2 and LSmashSource2/LibavSource2 scripts for opening both audio and video. The FFMS3 script should open anything ffms2 can open but without throwing an error if you open an audio-only file without disabling the video. The LSMASH3 script should open anything the LSmashSource2 & LibavSource2 scripts can open, only they're combined into a single script, and they can open audio only files etc.
    The FFMS3 and LSMASH3 scripts seem to be working well and can be found here. They'll co-exist with the old FFmpegSource2, LSmashSource2 and LibavSource2 scripts.

    A little while ago I tried combining the FFMS3 and LSMASH3 scripts into a single function I called FFMSmash, for want of a better name. It should try every which way to open sources with both the FFMS3 and LSMASH3 scripts and without bothering you with errors unless it fails completely. It can open audio and video together like so:

    FFMSmash("E:\Video.mp4")

    Or if you still want to open them individually you can do it like this:

    V = FFMSmash("E:\Video.mp4", Atrack=-2)
    A = FFMSmash("E:\Video.mp4", Vtrack=-2)

    There's basic instructions at the top of the script (there's only a few options), but I haven't tested it much, so if you try it let me know if you find any problems. It's attached if you want to give it a spin.
    Image Attached Files
    Last edited by hello_hello; 1st Jan 2018 at 10:01.
    Quote Quote  
  10. Originally Posted by Budman1 View Post
    If you haven't already found a solution to this you might try AVISYNTh's Try...Catch. I have modified the code below since I do not have the same Filters but you
    should notice I do not have your Aud path or file in the first Try portion and the AVS completes through the catch portion with the path and file I do have

    Code:
    try {
    LoadPlugin("C:\Users\Bud\Desktop\MEGA_Trimmed_Tabbed_2_2\bin\Debug\ffms2.dll")
    LoadPlugin("C:\Users\Bud\Desktop\MEGA_Trimmed_Tabbed_2_2\bin\Debug\DGDecode.dll")
    LoadPlugin("C:\Users\Bud\Desktop\MEGA_Trimmed_Tabbed_2_2\bin\Debug\AutoCrop.dll")
    aud=LWLibavAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4",stream_index=1)
    vid = FFVideoSource("C:\Users\Bud\Desktop\[dp]Manjandani-1.mp4")
    left=GetChannel(aud, 1)
    right=GetChannel(aud, 2)
    both=mergechannels(left, right)
    audiodub(vid, both)
    ConvertAudioTo16Bit()
    ConvertToYUY2(interlaced=false)
    colorMatrix(mode="Rec.601->Rec.709")
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave() 
    AssumeFPS(25)
    }
    
    catch(err_msg) {
    aud=FFAudioSource("C:\Users\Bud\Desktop\[dp]Manjandani-1.mp4")
    vid = FFVideoSource("C:\Users\Bud\Desktop\[dp]Manjandani-1.mp4")
    left=GetChannel(aud, 1)
    right=GetChannel(aud, 2)
    both=mergechannels(left, right)
    audiodub(vid, both)
    ConvertAudioTo16Bit()
    ConvertToYUY2(interlaced=false)
    colorMatrix(mode="Rec.601->Rec.709")
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave() 
    AssumeFPS(25)
    }
    Image
    [Attachment 44230 - Click to enlarge]


    mmm c*t in interesting but I don't know if with my limited intellingence I'm good to modify my base-script:

    Code:
         rem ***Make The .avs Script File ***
    
            if exist "%~n1_HD.avs" del "%~n1_HD.avs"
            echo Import^("v:\automazioneclip\avisynth\plugins\IResize.avsi"^)>"%~n1_HD.avs"
            echo Import^("V:\automazioneclip\AviSynth\plugins\smoothFPS2.avsi"^)>>"%~n1_HD.avs"
            rem echo Import^("v:\automazioneclip\AviSynth\plugins\AddBordersToMake.avsi"^)>>"%~n1_HD.avs"
            echo Import^("v:\automazioneclip\AviSynth\plugins\FrostyBorders.avsi"^)>>"%~n1_HD.avs"
            echo Import^("V:\automazioneclip\AviSynth\plugins\CropResizeBorder_ColouredBorders3.avsi"^)>>"%~n1_HD.avs"
    
            echo LoadPlugin^("v:\automazioneclip\AviSynth\Lsmash64perVirtualDub64\LSMASHSource.dll"^)>>"%~n1_HD.avs"
            echo LoadPlugin^("V:\automazioneclip\AviSynth\plugins64\ffms2.dll"^)>>"%~n1_HD.avs"
            echo LoadCPlugin("v:\automazioneclip\avisynth\plugins64\yadif.dll")>>"%~n1_HD.avs"  
            echo vid=%LSMASHVideotype%^(%4^)%eventualeScanBottom%>>"%~n1_HD.avs"          
      
            IF not "%AudioProc3%"=="true" echo aud=%LSMASHAudiotype%^(%AudioSource%^,stream_index=%streamIndexNumber%^)>>"%~n1_HD.avs"
    
            IF "%AudioProc3%"=="true" echo left=%LSMASHAudiotype%^(%4, stream_index=1^)>>"%~n1_HD.avs"
            IF "%AudioProc3%"=="true" echo right=%LSMASHAudiotype%^(%4, stream_index=2^)>>"%~n1_HD.avs"
            IF "%AudioProc3%"=="true" echo both=mergechannels^(left^, right^)>>"%~n1_HD.avs"        
    
            IF "%AudioProc1%"=="true" echo left=GetChannel^(aud, %LeftChanNumb%^)>>"%~n1_HD.avs"
            IF "%AudioProc1%"=="true" echo right=GetChannel^(aud, %RightChanNumb%^)>>"%~n1_HD.avs"
            IF "%AudioProc1%"=="true" echo both=mergechannels^(left^, right^)>>"%~n1_HD.avs"
    
            IF "%AudioProc2%"=="true" echo left=GetChannel^(aud, 1^)>>"%~n1_HD.avs"
            IF "%AudioProc2%"=="true" echo right=GetChannel^(aud, 2^)>>"%~n1_HD.avs"
            IF "%AudioProc2%"=="true" echo both=mergechannels^(left^, right^)>>"%~n1_HD.avs"
    
            if "%NoAudioInsideInputFile%"=="1" echo left=GetChannel^(aud, 1^)>>"%~n1_HD.avs"
            if "%NoAudioInsideInputFile%"=="1" echo right=GetChannel^(aud, 2^)>>"%~n1_HD.avs"
            if "%NoAudioInsideInputFile%"=="1" echo both=mergechannels^(left^, right^)>>"%~n1_HD.avs"
    
            echo audiodub^(vid^, both^)>>"%~n1_HD.avs"
    
            echo ConvertAudioTo16Bit^(^)>>"%~n1_HD.avs"
    
            if "%rotation90%"=="1" echo TurnRight^(^)>>"%~n1_HD.avs"
            if "%rotation180%"=="1" echo Turn180^(^)>>"%~n1_HD.avs"
            if "%rotation270%"=="1" echo TurnLeft^(^)>>"%~n1_HD.avs"
            echo #TurnRight^(^)>>"%~n1_HD.avs"
            echo #Turn180^(^)>>"%~n1_HD.avs"
            echo #TurnLeft^(^)>>"%~n1_HD.avs"      
    
            if "%V_Q%"=="XDCAM_IMX" echo crop^(0,32,0,0^)>>"%~n1_HD.avs"
            if "%V_Q%"=="XDCAM_IMX_NTSC" echo crop^(0,26,0,0^)>>"%~n1_HD.avs"
    
            echo #robocrop^(^)>>"%~n1_HD.avs"
           
    
            if NOT "%Ch_Sub422%"=="yes" if NOT "%ScanBottomORdvcam%"=="1" if not "%SDorIMX%"=="YES" if not "%ApplyKelvinColorShift_RISCALDAorApplyKelvinColorShift_RAFFREDDA%"=="1" echo ConvertToYUY2^(interlaced=%truefalse%^)>>"%~n1_HD.avs"
            
            rem *** colormatrix richiede sempre colorspace YUV ***
            if NOT "%Ch_Sub422%"=="yes" if NOT "%ScanBottomORdvcam%"=="1" if "%SDorIMX%"=="YES"  echo ConvertToYUY2^(interlaced=%truefalse%^)>>"%~n1_HD.avs"
            if "%SDorIMX%"=="YES"  echo colorMatrix^(mode="Rec.601->Rec.709"^)>>"%~n1_HD.avs"
    
            if "%ApplyKelvinColorShift_RISCALDA%"=="1" echo ConvertToRGB^(interlaced=true^).KelvinColorShift^(5000, 8000^).convertToYUY2^(interlaced=%truefalse%^)>>"%~n1_HD.avs"
            if "%ApplyKelvinColorShift_RAFFREDDA%"=="1" echo ConvertToRGB^(interlaced=true^).KelvinColorShift^(5000, 3000^).convertToYUY2^(interlaced=%truefalse%^)>>"%~n1_HD.avs"              
            
            IF "%H1088%"=="1" echo crop^(0,0,1920,1080^)>>"%~n1_HD.avs"    
            if "%necessarioFlipHorizontal%"=="1" echo FlipHorizontal^(^)>>"%~n1_HD.avs"
            if "%necessarioFlipVertical%"=="1" echo FlipVertical^(^)>>"%~n1_HD.avs"                    
            
            if NOT "%fps25OR50%"=="1" if NOT "%PROGRESSIVE%"=="1" if not "%necessarioCropAndResize%"=="1" if NOT "%necessarioFuzzy%"=="1" echo yadif^(1,1^)>>"%~n1_HD.avs"
            if NOT "%fps25OR50%"=="1" if not "%necessarioCropAndResize%"=="1" if NOT "%necessarioFuzzy%"=="1" echo SmoothFPS2^(50000,1000^)>>"%~n1_HD.avs" 
    
            rem **** ho notato che se il resize (anche del gruppo fuzzy) avviene dopo lo smoothFps2 codifica molto piu velocemente per cui le 2 linee sottostanti vanno sempre sotto smoothFps2 ****
    
    
            if NOT "%fullHD%"=="1" if "%fps25OR50%"=="1" if "%PROGRESSIVE%"=="1" if not "%necessarioCropAndResize%"=="1" if NOT "%necessarioFuzzy%"=="1" if not "%H1088%"=="1" echo LanczosResize^(1920,1080^)>>"%~n1_HD.avs"
            if NOT "%fullHD%"=="1" if "%fps25OR50%"=="1" if NOT "%PROGRESSIVE%"=="1" if not "%necessarioCropAndResize%"=="1" if NOT "%necessarioFuzzy%"=="1" if not "%H1088%"=="1" echo IResize^(1920,1080^)>>"%~n1_HD.avs"
        
            if NOT "%fullHD%"=="1" if NOT "%fps25OR50%"=="1" if not "%necessarioCropAndResize%"=="1" if NOT "%necessarioFuzzy%"=="1" if not "%H1088%"=="1" echo LanczosResize^(1920,1080^)>>"%~n1_HD.avs"
    but is an interesting function
    Quote Quote  
  11. Originally Posted by pandy View Post
    Instead deleting isn't easier just generate script without this line?
    my batch have to "verify" automatically if the .avs is working or if it crash. It try to encode using Lsmash but if, during encoding, there is a crash ---> automatically generate an alternative using FFvideoSource. To do this the script have to recognize the crash and try to modify the previous .avs so that is used FF and not LSmash

    Is a feline idea
    Quote Quote  
  12. thank you, is interesting but I'm a poor, unable, and from very from limited intelligence C*T

    is too compliCaTed for me

    however I try to study on it for a few months and something I'll understand.

    In the meantime my batch generate a final .avs that before the final encoding is checked by a little routine that try to encode for real it, but only for some second.
    If the check is passed --> the .avs go into encoding.

    If check fails --> the batch try to use FF in place of LSmash.


    Exactly I don't know if there is a reason for using LSmash for one and ffms2 for the other: maybe another feline idea?

    Code:
    :Make_File_other <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    IF EXIST "%~dp1%~n1_HD.avi" del "%~dp1%~n1_HD.avi"
    cls
    
    color e
    
            echo ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
            echo ³                                      ³
            echo ³            OTHER ROUTINE             ³
            echo ³                                      ³
            echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
            echo.
    
            IF "%scanInterlace%"=="undef" IF "%scanProgressive%"=="undef" IF NOT "%scanMBAFF%"=="1" echo sorgente_senzaTagInterneProgressivoInterlacciato_AutomaticamenteAssuntaComeProgressiva>"%~dp1%~n1_sorgente_senzaTagInterneProgressivoInterlacciato_AutomaticamenteAssuntaComeProgressiva.txt"
            IF "%scanInterlace%"=="undef" IF "%scanProgressive%"=="undef" IF NOT "%scanMBAFF%"=="1" Set "PROGRESSIVE=1"
            IF "%scanInterlace%"=="undef" IF "%scanProgressive%"=="undef" IF "%scanMBAFF%"=="1" Set "PROGRESSIVE=0"
            IF "%scanMBAFF%"=="1" Set "PROGRESSIVE=0"
            
            if "%variableFrameRate%"=="1" set "fps25=0"
            if "%variableFrameRate%"=="1" set "fps50=0"
            if "%variableFrameRate%"=="1" set "fps25OR50=0"
    
            if exist *.raw del *.raw
            IF "%P2Panasonic%"=="1" v:\automazioneclip\bmx\mxf2raw.exe -p tempP2processing %4
    
            rem ********** PRELIMINARY AUDIO CHECK **********
    
            rem *** procedura 1 sembra per ALTRI TIPI di files ***
            if exist "%~dp1TESTonly1.wav" del "%~dp1TESTonly1.wav"        
            if not "%isMXF%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %4 -ss 00:00:00 -t 00:00:10 -af "pan=stereo:c0=c0:c1=c1,volume=1.0" -c:a pcm_s16le -ar 48000 "%~dp1TESTonly1.wav"
            for %%v in ("TESTonly1.wav") do (
    		if %%~zv LSS 128 (			
                    if exist "%WorkFolder%\TESTonly1.wav" del "%WorkFolder%\TESTonly1.wav"
    		)
    	) 
    
            Set "AudioProc1=false"        
            IF EXIST "%~dp1TESTonly1.wav" set "AudioProc1=true"
            if exist "%~dp1TESTonly1.wav" del "%~dp1TESTonly1.wav"  
    
            rem *** procedura 2 per MXF IMX ***
            if exist "%~dp1TESTonly2.wav" del "%~dp1TESTonly2.wav" 
            if "%isMXF%"=="1" if "%IMX%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %4 -ss 00:00:00 -t 00:00:10 -map_channel 0.1.0 -map_channel 0.1.1  -c:a pcm_s16le -ar 48000 "%~dp1TESTonly2.wav"
            for %%v in ("TESTonly2.wav") do (
    		if %%~zv LSS 128 (			
                    if exist "%WorkFolder%\TESTonly2.wav" del "%WorkFolder%\TESTonly2.wav"
    		)
    	) 
    
            Set "AudioProc2=false"
            IF EXIST "%~dp1TESTonly2.wav" set "AudioProc2=true"
            if exist "%~dp1TESTonly2.wav" del "%~dp1TESTonly2.wav" 
    
            rem *** procedura 3 per MXF HD e DVCAM ***
            if exist "%~dp1TESTonly3.wav" del "%~dp1TESTonly3.wav"         
            IF NOT "%P2Panasonic%"=="1" if "%isMXF%"=="1" if NOT "%IMX%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %4 -ss 00:00:00 -t 00:00:10 -filter_complex "[0:1] [0:2] amerge,volume=1.0" -c:a pcm_s16le -ar 48000 "%~dp1TESTonly3.wav"
            for %%v in ("TESTonly3.wav") do (
    		if %%~zv LSS 128 (			
                    if exist "%WorkFolder%\TESTonly.wav" del "%WorkFolder%\TESTonly.wav"
    		)
    	) 
            Set "AudioProc3=false"
            IF EXIST "%~dp1TESTonly3.wav" set "AudioProc3=true"
            if exist "%~dp1TESTonly3.wav" del "%~dp1TESTonly3.wav"
     
            Set "NoAudioInsideInputFile=0"
                  
            if "%AudioProc1%"=="false" if "%AudioProc2%"=="false" if "%AudioProc3%"=="false" Set "NoAudioInsideInputFile=1"        
            if NOT "%NoAudioInsideInputFile%"=="1" Set "AudioSource=%4"
            if "%NoAudioInsideInputFile%"=="1" Set AudioSource="v:\automazioneclip\system\empty.wav"
                    
            echo *** AudioProc1 [non-MXF files] = %AudioProc1% ***
            echo *** AudioProc2 [MXF IMX files] = %AudioProc2% ***
            echo *** AudioProc3 [MXF HD e DVCAM] = %AudioProc3% ***
            echo audioSource is %AudioSource%
    
            if exist "%~dp1empty.wav" del "%~dp1empty.wav"
            if exist "%~dp1TESTonly.wav" del "%~dp1TESTonly.wav"
    
           Set "TokenS=0"
           Set "fps25OR50=0"
           if "%fps25%"=="yes" Set "TokenS=1" 
           if "%fps50%"=="yes" Set "TokenS=1"
           if "%TokenS%"=="1" Set "fps25OR50=1"
           if NOT "%fps25OR50%"=="1" color c
           if "%fullHDinterlace%"=="1" color f
    
    
           Set "TokenS=0"
           Set "ApplyKelvinColorShift_RISCALDAorApplyKelvinColorShift_RAFFREDDA=0" 
           if "%ApplyKelvinColorShift_RISCALDA%"=="1" Set "TokenS=1" 
           if "%ApplyKelvinColorShift_RAFFREDDA%"=="1" Set "TokenS=1" 
           if "%TokenS%"=="1" Set "ApplyKelvinColorShift_RISCALDAorApplyKelvinColorShift_RAFFREDDA=1"
    
           Set "IResizeORlanczos="
           if "%progressive%"=="1" Set "IResizeORlanczos=LanczosResize" 
           if NOT "%progressive%"=="1" Set "IResizeORlanczos=IResize" 
    
            set "quotient=undef"
            set "necessarioFuzzy=0"
            set "necessarioCropAndResize=0"     
            Set /a "quotient=%V_Width%/%V_Height%
            echo quotient assume %quotient%
    
            if %quotient% LSS 1 Set "necessarioFuzzy=1"
            
            if not "%aspectratio169%"=="yes" if not "%necessarioFuzzy%"=="1" set "necessarioCropAndResize=1"
            if "%necessarioCropAndResize%"=="1" set "necessarioFuzzy=0"
    
    
            Set audioIndexID=undef
            Set audioChannels=undef
            set "LeftChanNumb=undef"
            set "RightChanNumb=undef"
            for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\core\ffprobe64bit333.exe -hide_banner -loglevel fatal -pretty -select_streams a -show_streams %4 2^>^&1') DO (
            if "%%~g"=="index" set "audioIndexID=%%~h"
            if "%%~g"=="channels" set "audioChannels=%%~h")        
            if "%audioChannels%"=="1" set "LeftChanNumb=1"
            if "%audioChannels%"=="1" set "RightChanNumb=1"        
            if NOT "%audioChannels%"=="1" set "LeftChanNumb=1"
            if NOT "%audioChannels%"=="1" set "RightChanNumb=2"
    
            Set "streamIndexNumber=undef"
            if "%NoAudioInsideInputFile%"=="1" Set "streamIndexNumber=0"
            if not "%NoAudioInsideInputFile%"=="1" Set "streamIndexNumber=1"
            iF "%AudioProc2%"=="true" Set treamIndexNumber=%audioIndexID%
            iF "%AudioProc1%"=="true" Set streamIndexNumber=%audioIndexID%      
    
            rem *** check for strange Audio Formats routine *********************************************************************************************************************************
    
    
            IF EXIST "%CD%\strangeAudioFormat.wav" del "%CD%\strangeAudioFormat.wav"
    
            Set "TokenS=0"
            Set "strangeAudioFormat=0"
            set "eppureAudioPresente=0"
            IF "%audioChannels%"=="1" Set "TokenS=1" 
            IF "%audioChannels%"=="2" Set "TokenS=1"
            iF "%AudioProc1%"=="true" if not "%TokenS%"=="1" set "strangeAudioFormat=1"
            if "%strangeAudioFormat%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %4 -af "pan=stereo:c0=c0:c1=c1" -c:a pcm_s16le -ar 48000 "%CD%\strangeAudioFormat.wav"       
            
            if "%NoAudioInsideInputFile%"=="1" IF "%ProbabileAudio%"=="1" set "eppureAudioPresente=1"  
            
            rem %Totalcode_Loc% "%~dp1%~n1.mpj" -transcode -quit
            if "%strangeAudioFormat%"=="1" Set AudioSource="%CD%\strangeAudioFormat.wav"
            if "%strangeAudioFormat%"=="1" Set "streamIndexNumber=0"
            if "%strangeAudioFormat%"=="1" set "RChanNumb=1"
            if "%strangeAudioFormat%"=="1" set "RChanNumb=2"
            if "%strangeAudioFormat%"=="1" echo innescataRoutineStrangeAudioFormat>"%~dp1%~n1_innescataRoutineStrangeAudioFormat.txt"
            rem *****************************************************************************************************************************************************************************
    
            IF "%isMP4%"=="1" Set "LSMASHVideotype=LSMASHVideoSource" 
            IF NOT "%isMP4%"=="1" Set "LSMASHVideotype=LWLibavVideoSource"
            IF "%isMP4%"=="1" Set "LSMASHAudiotype=LWLibavAudioSource" 
            IF NOT "%isMP4%"=="1" Set "LSMASHAudiotype=LWLibavAudioSource"
            iF "%WindowsMediaVideoFormat%"=="1" Set "LSMASHVideotype=FFVideoSource"
    
    echo isMXF assume %isMXF%
    echo FULL_HD assume %FULL_HD%
    echo FULL_SDorIMX assume %FULL_SDorIMX%
    echo DisplayAspectRatioOK assume %DisplayAspectRatioOK%
    echo necessarioFuzzy assume %necessarioFuzzy%
    echo necessarioCropAndResize assume %necessarioCropAndResize%
    echo processing %4
            
           set "eventualeScanBottom="
           if "%ScanBottomORdvcam%"=="1" set "eventualeScanBottom=.convertToYUY2^().Crop^(0,1,0,0).AddBorders^(0,0,0,1)"
           Set "TrueFalse=undef" 
           IF "%PROGRESSIVE%"=="1" Set "TrueFalse=false" 
           IF NOT "%PROGRESSIVE%"=="1" Set "TrueFalse=true" 
    
            rem ***Make The .avs Script File ***
    
            if exist "%~n1_HD.avs" del "%~n1_HD.avs"
            echo Import^("v:\automazioneclip\avisynth\plugins\IResize.avsi"^)>"%~n1_HD.avs"
            echo Import^("V:\automazioneclip\AviSynth\plugins\smoothFPS2.avsi"^)>>"%~n1_HD.avs"
            rem echo Import^("v:\automazioneclip\AviSynth\plugins\AddBordersToMake.avsi"^)>>"%~n1_HD.avs"
            echo Import^("v:\automazioneclip\AviSynth\plugins\FrostyBorders.avsi"^)>>"%~n1_HD.avs"
            echo Import^("V:\automazioneclip\AviSynth\plugins\CropResizeBorder_ColouredBorders3.avsi"^)>>"%~n1_HD.avs"
    
            echo LoadPlugin^("v:\automazioneclip\AviSynth\Lsmash64perVirtualDub64\LSMASHSource.dll"^)>>"%~n1_HD.avs"
            echo LoadPlugin^("V:\automazioneclip\AviSynth\plugins64\ffms2.dll"^)>>"%~n1_HD.avs"
            echo LoadCPlugin("v:\automazioneclip\avisynth\plugins64\yadif.dll")>>"%~n1_HD.avs"  
            echo vid=%LSMASHVideotype%^(%4^)%eventualeScanBottom%>>"%~n1_HD.avs"          
      
            IF not "%AudioProc3%"=="true" echo aud=%LSMASHAudiotype%^(%AudioSource%^,stream_index=%streamIndexNumber%^)>>"%~n1_HD.avs"
    
            IF "%AudioProc3%"=="true" echo left=%LSMASHAudiotype%^(%4, stream_index=1^)>>"%~n1_HD.avs"
            IF "%AudioProc3%"=="true" echo right=%LSMASHAudiotype%^(%4, stream_index=2^)>>"%~n1_HD.avs"
            IF "%AudioProc3%"=="true" echo both=mergechannels^(left^, right^)>>"%~n1_HD.avs"        
    
            IF "%AudioProc1%"=="true" echo left=GetChannel^(aud, %LeftChanNumb%^)>>"%~n1_HD.avs"
            IF "%AudioProc1%"=="true" echo right=GetChannel^(aud, %RightChanNumb%^)>>"%~n1_HD.avs"
            IF "%AudioProc1%"=="true" echo both=mergechannels^(left^, right^)>>"%~n1_HD.avs"
    
            IF "%AudioProc2%"=="true" echo left=GetChannel^(aud, 1^)>>"%~n1_HD.avs"
            IF "%AudioProc2%"=="true" echo right=GetChannel^(aud, 2^)>>"%~n1_HD.avs"
            IF "%AudioProc2%"=="true" echo both=mergechannels^(left^, right^)>>"%~n1_HD.avs"
    
            if "%NoAudioInsideInputFile%"=="1" echo left=GetChannel^(aud, 1^)>>"%~n1_HD.avs"
            if "%NoAudioInsideInputFile%"=="1" echo right=GetChannel^(aud, 2^)>>"%~n1_HD.avs"
            if "%NoAudioInsideInputFile%"=="1" echo both=mergechannels^(left^, right^)>>"%~n1_HD.avs"
    
            echo audiodub^(vid^, both^)>>"%~n1_HD.avs"
    
            echo ConvertAudioTo16Bit^(^)>>"%~n1_HD.avs"
    
            if "%rotation90%"=="1" echo TurnRight^(^)>>"%~n1_HD.avs"
            if "%rotation180%"=="1" echo Turn180^(^)>>"%~n1_HD.avs"
            if "%rotation270%"=="1" echo TurnLeft^(^)>>"%~n1_HD.avs"
            echo #TurnRight^(^)>>"%~n1_HD.avs"
            echo #Turn180^(^)>>"%~n1_HD.avs"
            echo #TurnLeft^(^)>>"%~n1_HD.avs"      
    
            if "%V_Q%"=="XDCAM_IMX" echo crop^(0,32,0,0^)>>"%~n1_HD.avs"
            if "%V_Q%"=="XDCAM_IMX_NTSC" echo crop^(0,26,0,0^)>>"%~n1_HD.avs"
    
            echo #robocrop^(^)>>"%~n1_HD.avs"
           
    
            if NOT "%Ch_Sub422%"=="yes" if NOT "%ScanBottomORdvcam%"=="1" if not "%SDorIMX%"=="YES" if not "%ApplyKelvinColorShift_RISCALDAorApplyKelvinColorShift_RAFFREDDA%"=="1" echo ConvertToYUY2^(interlaced=%truefalse%^)>>"%~n1_HD.avs"
            
            rem *** colormatrix richiede sempre colorspace YUV ***
            if NOT "%Ch_Sub422%"=="yes" if NOT "%ScanBottomORdvcam%"=="1" if "%SDorIMX%"=="YES"  echo ConvertToYUY2^(interlaced=%truefalse%^)>>"%~n1_HD.avs"
            if "%SDorIMX%"=="YES"  echo colorMatrix^(mode="Rec.601->Rec.709"^)>>"%~n1_HD.avs"
    
            if "%ApplyKelvinColorShift_RISCALDA%"=="1" echo ConvertToRGB^(interlaced=true^).KelvinColorShift^(5000, 8000^).convertToYUY2^(interlaced=%truefalse%^)>>"%~n1_HD.avs"
            if "%ApplyKelvinColorShift_RAFFREDDA%"=="1" echo ConvertToRGB^(interlaced=true^).KelvinColorShift^(5000, 3000^).convertToYUY2^(interlaced=%truefalse%^)>>"%~n1_HD.avs"              
            
            IF "%H1088%"=="1" echo crop^(0,0,1920,1080^)>>"%~n1_HD.avs"    
            if "%necessarioFlipHorizontal%"=="1" echo FlipHorizontal^(^)>>"%~n1_HD.avs"
            if "%necessarioFlipVertical%"=="1" echo FlipVertical^(^)>>"%~n1_HD.avs"                    
            
            if NOT "%fps25OR50%"=="1" if NOT "%PROGRESSIVE%"=="1" if not "%necessarioCropAndResize%"=="1" if NOT "%necessarioFuzzy%"=="1" echo yadif^(1,1^)>>"%~n1_HD.avs"
            if NOT "%fps25OR50%"=="1" if not "%necessarioCropAndResize%"=="1" if NOT "%necessarioFuzzy%"=="1" echo SmoothFPS2^(50000,1000^)>>"%~n1_HD.avs" 
    
            rem **** ho notato che se il resize (anche del gruppo fuzzy) avviene dopo lo smoothFps2 codifica molto piu velocemente per cui le 2 linee sottostanti vanno sempre sotto smoothFps2 ****
    
    
            if NOT "%fullHD%"=="1" if "%fps25OR50%"=="1" if "%PROGRESSIVE%"=="1" if not "%necessarioCropAndResize%"=="1" if NOT "%necessarioFuzzy%"=="1" if not "%H1088%"=="1" echo LanczosResize^(1920,1080^)>>"%~n1_HD.avs"
            if NOT "%fullHD%"=="1" if "%fps25OR50%"=="1" if NOT "%PROGRESSIVE%"=="1" if not "%necessarioCropAndResize%"=="1" if NOT "%necessarioFuzzy%"=="1" if not "%H1088%"=="1" echo IResize^(1920,1080^)>>"%~n1_HD.avs"
        
            if NOT "%fullHD%"=="1" if NOT "%fps25OR50%"=="1" if not "%necessarioCropAndResize%"=="1" if NOT "%necessarioFuzzy%"=="1" if not "%H1088%"=="1" echo LanczosResize^(1920,1080^)>>"%~n1_HD.avs"
            
    
    
            rem *** necessario Fuzzy per correzione aspect ratio verso 16:9 Sorgente progressiva non 25fps e non 50 fps ***
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo SmoothFPS2^(50000,1000^)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo x = float^(width) / float^(height)>>"%~n1_HD.avs"         
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo LancZosResize^(m4(x * 1080.0),1080)>>"%~n1_HD.avs"        
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo FuzzyBorders^(16,9)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo #FrostyBorders^(1920,1080)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo #BlackBorders^(1920,1080)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo function m4^(float x) {return( x^<16?16:int(round(x/4.0)*4))}>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HD.avs"
    
            rem *** necessario Fuzzy per correzione aspect ratio verso 16:9 Sorgente interlacciata non 25fps e non 50 fps ***
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo yadif^(1,1^)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo SmoothFPS2^(50000,1000^)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo x = float^(width) / float^(height)>>"%~n1_HD.avs"         
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo LancZosResize^(m4(x * 1080.0),1080)>>"%~n1_HD.avs"        
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo FuzzyBorders^(16,9)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo #FrostyBorders^(1920,1080)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo #BlackBorders^(1920,1080)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo function m4^(float x) {return( x^<16?16:int(round(x/4.0)*4))}>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if NOT "%fps25OR50%"=="1"  echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HD.avs"
    
            rem *** necessario Fuzzy per correzione aspect ratio verso 16:9 Sorgente progressiva a 25fps ***
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo x = float^(width) / float^(height)>>"%~n1_HD.avs" 
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo LancZosResize^(m4(x * 1080.0),1080)>>"%~n1_HD.avs"        
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo FuzzyBorders^(16,9)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo #FrostyBorders^(1920,1080)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo #BlackBorders^(1920,1080)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo function m4^(float x) {return( x^<16?16:int(round(x/4.0)*4))}>>"%~n1_HD.avs"
    
            rem *** necessario Fuzzy per correzione aspect ratio verso 16:9 Sorgente interlacciata a 25fps ***
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo yadif^(1,1^)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo x = float^(width) / float^(height)>>"%~n1_HD.avs" 
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo LancZosResize^(m4(x * 1080.0),1080)>>"%~n1_HD.avs"        
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo FuzzyBorders^(16,9)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo #FrostyBorders^(1920,1080)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo #BlackBorders^(1920,1080)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo function m4^(float x) {return( x^<16?16:int(round(x/4.0)*4))}>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if NOT "%PROGRESSIVE%"=="1" if "%fps25%"=="yes"  echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HD.avs"
    
            rem *** necessario Fuzzy per correzione aspect ratio verso 16:9 Sorgente progressiva a 50fps ***
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps50%"=="yes"  echo x = float^(width) / float^(height)>>"%~n1_HD.avs" 
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps50%"=="yes"  echo LancZosResize^(m4(x * 1080.0),1080)>>"%~n1_HD.avs"        
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps50%"=="yes"  echo FuzzyBorders^(16,9)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps50%"=="yes"  echo #FrostyBorders^(1920,1080)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps50%"=="yes"  echo #BlackBorders^(1920,1080)>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps50%"=="yes"  echo function m4^(float x) {return( x^<16?16:int(round(x/4.0)*4))}>>"%~n1_HD.avs"
            if "%necessarioFuzzy%"=="1" if "%PROGRESSIVE%"=="1" if "%fps50%"=="yes"  echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HD.avs"
    
            rem *** necessario CropResize per correzione aspect ratio verso 16:9 Sorgente progressiva non 25fps e non 50fps ***  
            if "%necessarioCropAndResize%"=="1" if NOT "%fps25OR50%"=="1" if "%PROGRESSIVE%"=="1" echo SmoothFPS2^(50000,1000^)>>"%~n1_HD.avs" 
            if "%necessarioCropAndResize%"=="1" if NOT "%fps25OR50%"=="1" if "%PROGRESSIVE%"=="1" echo CropResizeBorder^(Cmode="NR", InDAR=%V_Width%.0/%RealV_Height%.0, PicDAR=16.0/9.0)>>"%~n1_HD.avs"
            if "%necessarioCropAndResize%"=="1" if NOT "%fps25OR50%"=="1" if "%PROGRESSIVE%"=="1" echo LanczosResize^(1920,1080^)>>"%~n1_HD.avs"
            if "%necessarioCropAndResize%"=="1" if NOT "%fps25OR50%"=="1" if "%PROGRESSIVE%"=="1" echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HD.avs" 
    
            rem *** necessario CropResize per correzione aspect ratio verso 16:9 Sorgente interlacciata non 25fps e non 50fps ***
            if "%necessarioCropAndResize%"=="1" if NOT "%fps25OR50%"=="1" if NOT "%PROGRESSIVE%"=="1" echo yadif^(1,1^)>>"%~n1_HD.avs"
            if "%necessarioCropAndResize%"=="1" if NOT "%fps25OR50%"=="1" if NOT "%PROGRESSIVE%"=="1" echo SmoothFPS2^(50000,1000^)>>"%~n1_HD.avs" 
            if "%necessarioCropAndResize%"=="1" if NOT "%fps25OR50%"=="1" if NOT "%PROGRESSIVE%"=="1" echo CropResize^(Cmode="NR", InDAR=%V_Width%.0/%RealV_Height%.0, PicDAR=16.0/9.0)>>"%~n1_HD.avs"
            if "%necessarioCropAndResize%"=="1" if NOT "%fps25OR50%"=="1" if NOT "%PROGRESSIVE%"=="1" echo LanczosResizeBorder^(1920,1080^)>>"%~n1_HD.avs"
            if "%necessarioCropAndResize%"=="1" if NOT "%fps25OR50%"=="1" if NOT "%PROGRESSIVE%"=="1" echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HD.avs"  
    
            rem *** necessario CropResize per correzione aspect ratio verso 16:9 Sorgente progressiva a 25fps ***  
            if "%necessarioCropAndResize%"=="1" if "%fps25%"=="yes" if "%PROGRESSIVE%"=="1" echo CropResizeBorder^(Cmode="NR", InDAR=%V_Width%.0/%RealV_Height%.0, PicDAR=16.0/9.0)>>"%~n1_HD.avs"
            if "%necessarioCropAndResize%"=="1" if "%fps25%"=="yes" if "%PROGRESSIVE%"=="1" echo LanczosResize^(1920,1080^)>>"%~n1_HD.avs"
            
            rem *** necessario CropResize per correzione aspect ratio verso 16:9 Sorgente interlacciata a 25fps ***   
            if "%necessarioCropAndResize%"=="1" if "%fps25%"=="yes" if NOT "%PROGRESSIVE%"=="1" echo yadif^(1,1^)>>"%~n1_HD.avs"
            if "%necessarioCropAndResize%"=="1" if "%fps25%"=="yes" if NOT "%PROGRESSIVE%"=="1" echo CropResizeBorder^(Cmode="NR", InDAR=%V_Width%.0/%RealV_Height%.0, PicDAR=16.0/9.0)>>"%~n1_HD.avs"
            if "%necessarioCropAndResize%"=="1" if "%fps25%"=="yes" if NOT "%PROGRESSIVE%"=="1" echo LanczosResize^(1920,1080^)>>"%~n1_HD.avs"
            if "%necessarioCropAndResize%"=="1" if "%fps25%"=="yes" if NOT "%PROGRESSIVE%"=="1" echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HD.avs" 
    
            rem *** necessario CropResize per correzione aspect ratio verso 16:9 Sorgente progressiva a 50fps ***  
            if "%necessarioCropAndResize%"=="1" if "%fps50%"=="yes" if "%PROGRESSIVE%"=="1" echo CropResizeBorder^(Cmode="NR", InDAR=%V_Width%.0/%RealV_Height%.0, PicDAR=16.0/9.0)>>"%~n1_HD.avs"
            if "%necessarioCropAndResize%"=="1" if "%fps50%"=="yes" if "%PROGRESSIVE%"=="1" echo LanczosResize^(1920,1080^)>>"%~n1_HD.avs"
            if "%necessarioCropAndResize%"=="1" if "%fps50%"=="yes" if "%PROGRESSIVE%"=="1" echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HD.avs"  
    
            rem ***********************************************************************************************************************************************************
    
            if NOT "%fps25OR50%"=="1" if not "%necessarioCropAndResize%"=="1" if NOT "%necessarioFuzzy%"=="1" echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HD.avs"
            if "%fps50%"=="yes" if not "%necessarioCropAndResize%"=="1" if NOT "%necessarioFuzzy%"=="1" echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HD.avs"    
            echo AssumeFPS^(25^)>>"%~n1_HD.avs"
    
    
            rem **** tentativo di scambio LSMASHVideoSource con FFVideoSource in caso di crash ***************************************************************************************************************************** 
            if NOT "%isMXF%"=="1" set "seemsAllOk=0"    
            if NOT "%isMXF%"=="1" if exist "%CD%\tempGeneralTest.mp4" del "%CD%\tempGeneralTest.mp4"
            if NOT "%isMXF%"=="1" v:\automazioneclip\core\ffmpeg64bit2014.exe -loglevel fatal -y -i "%~n1_HD.avs" -c:v mjpeg -pix_fmt uyvy422 -c:a libmp3lame -ar 48000 -aspect 16:9 -ar 48000 -ss 00:00:00 -t 00:00:01 -an "%CD%\tempGeneralTest.mp4"
            if NOT "%isMXF%"=="1" if exist "%CD%\tempGeneralTest.mp4" set "seemsAllOk=1" 
            if NOT "%isMXF%"=="1" IF "%isMP4%"=="1"  if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" "vid=LSMASHVideoSource" "vid=FFVideoSource"
            if NOT "%isMXF%"=="1" IF NOT "%isMP4%"=="1" if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" "vid=LWLibavVideoSource" "vid=FFVideoSource"
            if NOT "%isMXF%"=="1" if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" "aud=LWLibavAudioSource" "aud=FFAudioSource"
            if NOT "%isMXF%"=="1" if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" ",stream_index=0" " "
            if NOT "%isMXF%"=="1" if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" ",stream_index=1" " "
            if NOT "%isMXF%"=="1" if not "%seemsAllOk%"=="1" echo utilizzoDiFFVideoSourceCausaCrashDiLSMASHVideoSource>"%~dp1%~n1_utilizzoDiFFVideoSourceCausaCrashDiLSMASHVideoSource.txt"
            if NOT "%isMXF%"=="1" if exist "%CD%\tempGeneralTest.mp4" del "%CD%\tempGeneralTest.mp4"                 
            rem ************************************************************************************************************************************************************************************************************
    
            REM ************************************************************************************************** VIRTUALDUB64 MAIN SESSION **************************************************************************************************
                         
               echo VirtualDub.audio.SetSource^(0^);>%1
               echo VirtualDub.audio.SetMode^(0^);>>%1
               echo VirtualDub.audio.SetInterleave^(1,500,1,0,0^);>>%1
               echo VirtualDub.audio.SetClipMode^(1,1^);>>%1
               echo VirtualDub.audio.SetEditMode^(1^);>>%1
               echo VirtualDub.audio.SetConversion^(0,0,0,0,0^);>>%1
               echo VirtualDub.audio.SetVolume^(^);>>%1
               echo VirtualDub.audio.SetCompression^(^);>>%1
               echo VirtualDub.audio.EnableFilterGraph^(0^);>>%1
               echo VirtualDub.video.SetInputFormat^(0^);>>%1
               echo VirtualDub.video.SetOutputFormat^(11^);>>%1         
               echo VirtualDub.video.SetMode^(1^);>>%1
               echo VirtualDub.video.SetSmartRendering^(0^);>>%1
               echo VirtualDub.video.SetPreserveEmptyFrames^(0^);>>%1
               echo VirtualDub.video.SetFrameRate2^(0,0,1^);>>%1
               echo VirtualDub.video.SetIVTC^(0, 0, 0, 0^);>>%1
    	   echo VirtualDub.video.SetCompression^(%CompressionCode%,0,10000,0^);>>%1
               echo VirtualDub.video.filters.Clear^(^);>>%1
               echo VirtualDub.audio.filters.Clear^(^);>>%1
               if NOT "%TimeCode%"=="" echo VirtualDub.project.ClearTextInfo^(^);>>%1
               if NOT "%TimeCode%"=="" echo VirtualDub.project.AddTextInfo^("ISMP", "%TIMECODE%"^);>>%1
    	   echo VirtualDub.SaveAVI^("%DestFolder%\\%~n1_HD.avi"^);>>%1
    	   echo VirtualDub.Close^(^);>>%1
    
    
               if "%isMXF%"=="1" %VD_LOC% /min "%~n1_HD.avs" /s %1 /x
               if NOT "%isMXF%"=="1" v:\automazioneclip\VirtualDub64SenzaFFmpegPlugin\vdub64.exe /min "%~n1_HD.avs" /s %1
              
    
               
    
               for %%v in ("%DestFolder%\\%~n1_HD.avi") do (
    		if %%~zv LSS 128 (
    			echo  ERROR!!!  Extra Small File Size Detected!!!
    			pause
    		)
               )  
               
           v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_HD.avi" -u MJPG -d MJPG
           if exist "%DestFolder%\*.ffindex" del "%DestFolder%\*.ffindex"
           IF exist "%~dp1%~n1.vcf" DEL "%~dp1%~n1.vcf"
           
           v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_HD.avi" -u MJPG -d MJPG 
    
            rem ********** AUDIO PROCESSING ROUTINE ****************************************************************************************************************************************************************************************
    
            rem #### check duration of avigen file ####
            if exist aviGenDuration.txt del aviGenDuration.txt
            Set "aviGenDuration=undef"
            v:\automazioneclip\core\FFProbe64bit2014.exe -loglevel fatal -show_entries format=duration -of csv="p=0" -sexagesimal "%CD%\%~n1_HD.avi">aviGenDuration.txt   
            set /p aviGenDuration=<aviGenDuration.txt
            if exist aviGenDuration.txt del aviGenDuration.txt
            echo durata pari a %aviGenDuration%
            rem if NOT "%fps25OR50%"=="1" echo attenzione_al_Framerate_differente25o50>"%~dp1%~n1_ATTENZIONE_FRAMERATE_DIVERSO_DA_25_O_50.txt"
    
            if NOT "%NoAudioInsideInputFile%"=="1" echo **** PROCESSING %AudioSource% ****          
            
            rem *** audio processing for MXF IMX 25 or 50 FPS ***************************************************************************************************************************************************************************
            IF NOT "%P2Panasonic%"=="1" if "%isMXF%"=="1" if "%fps25OR50%"=="1" IF "%IMX%"=="1" v:\automazioneclip\core\ffmpeg64bit2014.exe -y -loglevel fatal -i %AudioSource% -af "pan=stereo:c0=c0:c1=c1,volume=%AudioVolume%" -c:a pcm_s16le -ar 48000 "%~dp1%~n1_HD.wav"
            IF NOT "%P2Panasonic%"=="1" if "%isMXF%"=="1" if "%fps25OR50%"=="1" IF "%IMX%"=="1" if "%audio_MXF_CH3eCH4%"=="1" v:\automazioneclip\core\ffmpeg64bit2014.exe -y -loglevel fatal -i %AudioSource% -af "pan=stereo:c0=c2:c1=c3,volume=%AudioVolume%" -c:a pcm_s16le -ar 48000 "%~dp1%~n1_ch3ch4HD.wav" 
            rem if "%isMXF%"=="1" if "%fps25OR50%"=="1" IF "%IMX%"=="1" echo codificaAudioConProcedura_mxfIMX25or50>"%~dp1%~n1codificaAudioConProcedura_mxfIMX25or50.txt"
            rem *************************************************************************************************************************************************************************************************************************
    
            rem *** audio processing for MXF NON-IMX ***********************************************************************************************************************************************************************************************
            if "%isMXF%"=="1" if "%fps25OR50%"=="1" IF NOT "%IMX%"=="1" IF NOT "%P2Panasonic%"=="1" v:\automazioneclip\core\ffmpeg64bit2014.exe -y -i %AudioSource% -filter_complex "[0:1] [0:2] amerge,volume=%AudioVolume%" -c:a pcm_s16le -ar 48000 "%~dp1%~n1_HD.wav"
            if "%isMXF%"=="1" if "%fps25OR50%"=="1" IF NOT "%IMX%"=="1" if "%audio_MXF_CH3eCH4%"=="1" IF NOT "%P2Panasonic%"=="1" v:\automazioneclip\core\ffmpeg64bit2014.exe -y -loglevel fatal -i %AudioSource% -filter_complex "[0:3] [0:4] amerge,volume=%AudioVolume%" -c:a pcm_s16le -ar 48000 "%~dp1%~n1_ch3ch4HD.wav" 
            rem if "%isMXF%"=="1" if "%fps25OR50%"=="1" IF NOT "%IMX%"=="1" echo codificaAudioConProcedura_MXFnonimx>"%~dp1%~n1codificaAudioConProcedura_MXFnonimx.txt"
            rem ************************************************************************************************************************************************************************************************************************************
     
            rem *** P2-MXF audio processing ***********************************************************************************************************************************************************************************************
            IF "%P2Panasonic%"=="1" if "%isMXF%"=="1"  v:\automazioneclip\core\ffmpeg34_64bit.exe -loglevel fatal -y -i tempP2processing_v0.raw -filter_complex "[0:1][0:2]amerge=inputs=2,pan=stereo|c0=c0|c1=c1[a]" -map "[a]" -shortest -t %aviGenDuration% -c:a pcm_s16le -ar 48000 "%~dp1%~n1_HD.wav"
            IF "%P2Panasonic%"=="1" if "%isMXF%"=="1"  if "%audio_MXF_CH3eCH4%"=="1"     v:\automazioneclip\core\ffmpeg34_64bit.exe -loglevel fatal -y -i tempP2processing_v0.raw -filter_complex "[0:2][0:3]amerge=inputs=2,pan=stereo|c0=c0|c1=c1[a]" -map "[a]" -shortest -t %aviGenDuration% -c:a pcm_s16le -ar 48000 "%~dp1%~n1_ch3ch4HD.wav"                   
            rem ************************************************************************************************************************************************************************************************************************************
            rem ************************************** AUDIO processing Routine MXF NON-25OR50FPS  ***************************************************************************************************************************************************************        
            IF NOT "%P2Panasonic%"=="1" if "%isMXF%"=="1" if NOT "%fps25OR50%"=="1" v:\automazioneclip\core\ffmpeg64bit2014.exe -y -loglevel fatal -i "%~n1_HD.avs" -af "pan=stereo:c0=c0:c1=c1,volume=1.0,apad" -shortest -t %aviGenDuration% -c:a pcm_s16le -ar 48000 "%~dp1%~n1_HD.wav"
            rem if "%isMXF%"=="1" if NOT "%fps25OR50%"=="1" echo codificaAudioConProceduranonMXFNon25O50fpscritico>"%~dp1%~n1codificaAudioConProceduranonMXFNon25O50fpscritico.txt"
            rem ************************************************************************************************************************************************************************************************************************************************* 
            rem *** audio processing for NON-MXF FILES 25/50 OR NOT 25/50FPS ***
            if NOT "%isMXF%"=="1" if NOT "%fps25OR50%"=="1" v:\automazioneclip\core\ffmpeg64bit2014.exe -y -i "%~n1_HD.avs" -af "pan=stereo:c0=c0:c1=c1,volume=1.0,apad" -shortest -t %aviGenDuration% -c:a pcm_s16le -ar 48000 "%~dp1%~n1_HD.wav"     
            rem if NOT "%isMXF%"=="1" if NOT "%fps25OR50%"=="1" echo codificaAudioConProceduranonMXFeNon25O50fps>"%~dp1%~n1codificaAudioConProceduranonMXFeNon25O50fps.txt"  
            if NOT "%isMXF%"=="1" if "%fps25OR50%"=="1"     v:\automazioneclip\core\ffmpeg64bit2014.exe -y -i %AudioSource% -af "pan=stereo:c0=c0:c1=c1,volume=1.0,apad" -shortest -t %aviGenDuration% -c:a pcm_s16le -ar 48000 "%~dp1%~n1_HD.wav"
            rem if NOT "%isMXF%"=="1" if "%fps25OR50%"=="1" echo codificaAudioConProceduraNonMXF25o50>"%~dp1%~n1codificaAudioConProceduraNonMXF25o50.txt"    
            rem ************************************************************************************************************************************************************************************************************************************************* 
    
            rem #### check duration of avi and wav file ####
    
            for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdub\FFProbe -hide_banner -loglevel fatal -pretty -select_streams v:0 -show_streams -show_entries stream^=codec_type^,duration^,r_frame_rate^,width^,height^,sample_aspect_ratio:stream_disposition^=:format_tags^=timecode^,company_name^,product_name^,product_version "%~dp1%~n1_HD.avi" 2^>^&1') DO (
            if "%%~g"=="duration" set "aviDuration=%%~h")    
    
            for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdub\FFProbe -hide_banner -loglevel fatal -pretty -show_streams -show_entries stream^=codec_type^,duration^,r_frame_rate^,width^,height^,sample_aspect_ratio:stream_disposition^=:format_tags^=timecode^,company_name^,product_name^,product_version "%~dp1%~n1_HD.wav" 2^>^&1') DO (
            if "%%~g"=="duration" set "wavDuration=%%~h") 
         	 
            echo durata del file wav pari a %wavDuration%
            echo durata del file avi pari a %aviDuration%
    
            cls
            if "%wavDuration%"=="%aviDuration%" (color A0) else echo attenzione_alledurate_differenti>"%~dp1%~n1ATTENZIONE_DURATE_DIFFERENTI_TRA_WAV_E_AVI.txt"
            timeout /t 1
            rem ************************************************************************************************************************************************************************************************************************************************* 
            
            if "%ApplyKelvinColorShift_RISCALDAorApplyKelvinColorShift_RAFFREDDA%"=="1" echo ApplicatoKelvinColorShift>"%~dp1%~n1ApplicatoKelvinColorShift.txt"   
    
            rem v:\automazioneclip\core\ffmbc074.exe -threads 12 -y -i "%~n1_HD.avs" -i "%~n1_HD.avs" -vcodec copy -timecode %timecode% -target dvcam -an tempRebuild.MXF -acodec pcm_s16le -ar 48000 -newaudio -map_audio_channel 0:1:0:0:1:0 -acodec pcm_s16le -ar 48000 -newaudio -map_audio_channel 0:4:0:0:2:0 -acodec pcm_s16le -ar 48000 -newaudio -acodec pcm_s16le -ar 48000 -newaudio -map_audio_channel 0:3:0:0:3:0 -map_audio_channel 0:4:0:0:4:0 
            IF "%Genera_MXF_XDCAMHD422%"=="1" color b 
            rem IF "%Genera_MXF_XDCAMHD422%"=="1" v:\automazioneclip\core\ffmpeg64bit2014.exe -y -i "%~n1_HD.avs" -an -pix_fmt yuv422p -f rawvideo - | v:\automazioneclip\core\ffmbc074x64.exe -threads 12 -s 1920x1080 -r 25 -y -f rawvideo -pix_fmt yuv422p -i - -i tempAudio_PAIR1_ForFFmbc.wav -i "%~dp1%~n1_HD.wav" -tff -target xdcamhd422 -an out.mxf -acodec pcm_s24le -ar 48000 -newaudio -map_audio_channel 1:0:0:0:1:0 -acodec pcm_s24le -ar 48000 -newaudio -map_audio_channel 1:0:1:0:2:0 -acodec pcm_s24le -ar 48000 
            
            IF "%Genera_MXF_XDCAMHD422%"=="1" v:\automazioneclip\core\ffmpeg64bit2014.exe -y -i "%~n1_HD.avs" -an -pix_fmt yuv422p -f rawvideo - | v:\automazioneclip\core\ffmbc074x64.exe -threads 12 -s 1920x1080 -r 25 -y -f rawvideo -pix_fmt yuv422p -i - -i "%~dp1%~n1_HD.wav" -tff -target xdcamhd422 -an "%~dp1%~n1_HDxPDWF800.MXF" -acodec pcm_s24le -ar 48000 -newaudio -map_audio_channel 1:0:0:0:1:0 -acodec pcm_s24le -ar 48000 -newaudio -map_audio_channel 1:0:1:0:2:0 -acodec pcm_s24le -ar 48000
    
            rem **** CLEANUP ***************************************************************************************************
            IF EXIST "%CD%\strangeAudioFormat.wav" del "%CD%\strangeAudioFormat.wav"
    
            rem IF exist  "%~n1_HD.avs" DEL "%~n1_HD.avs"
            IF EXIST "%~dpnx4.lwi" del "%~dpnx4.lwi"
    
            rem echo %~n1_codificato_con_procedura_Make_File_other>"%~dp1%~n1codificato_con_procedura_Make_File_other.txt"
    
    if exist "unicodefile.txt" del "unicodefile.txt"
    if exist "ascii.txt" del "ascii.txt"
    if exist "mediainfo.txt" del "mediainfo.txt"
    if exist "timecodes.txt" del "timecodes.txt"
    if exist "strangeAudioFormat.wav.lwi" del "strangeAudioFormat.wav.lwi"
    if "%strangeAudioFormat%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" "strangeAudioFormat.wav" "%~n1_HD.wav"
    if exist tempP2processing_v0.raw del tempP2processing_v0.raw
    
    rem if exist "%~n1_HD.avs" del "%~n1_HD.avs"
    
    rem ***EXIT_SPACE***
    For example:

    if the final .avs have

    Code:
    aud=LWLibavAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4",stream_index=1)
    I need to "recnognize" all the text included between the "(" ........... ")" of the aud=LWLibavAudioSource line.

    And for example replace with a string called ABCDMyparticularCatString so that it become:

    Code:
    aud=LWLibavAudioSource(ABCDMyparticularCatString)
    this is my target request
    Last edited by marcorocchini; 30th Dec 2017 at 19:58.
    Quote Quote  
  13. Originally Posted by marcorocchini View Post
    For example:

    from
    Code:
    aud=LWLibavAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4",stream_index=1)
    I need to get

    Code:
    aud=LWLibavAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4")
    fart Find And Replace Text:

    Code:
    fart -C filename.avs ,stream_index=1) )
    One possible problem with this is that every occurrence of stream_index=1 will be removed. But your sample script only contained one instance.

    And if you need to replace LWLibavAudioSource with ffAudiowSource (what you say you need keeps changing) use:

    Code:
    fart -C filename.avs LWLibavAudioSource ffAudioSource
    Last edited by jagabo; 30th Dec 2017 at 21:49.
    Quote Quote  
  14. Originally Posted by jagabo View Post
    Originally Posted by marcorocchini View Post
    For example:

    from
    Code:
    aud=LWLibavAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4",stream_index=1)
    I need to get

    Code:
    aud=LWLibavAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4")
    fart Find And Replace Text:

    Code:
    fart -C filename.avs ,stream_index=1) )
    One possible problem with this is that every occurrence of stream_index=1 will be removed. But your sample script only contained one instance.

    And if you need to replace LWLibavAudioSource with ffAudiowSource (what you say you need keeps changing) use:

    Code:
    fart -C filename.avs LWLibavAudioSource ffAudioSource
    thanks but I can have stream_index=1 or stream_index=2 or stream_index=3 or stream_index=x where x is a variable.

    I would like delete stream_index=? for entire, independentely of the value

    OR more simply: I would like delete all the string inside the "(" ...")"

    for example: aud=LWLibavAudioSource(bla bla bla)

    the routine have to delete for entire "bla bla bla"

    and in a next step I replace bla bla bla with the source for FFaudioSource
    Quote Quote  
  15. You have a convoluted script, but if I understand correctly, this might be a solution.

    Echo both variants, but with ffAudioSource commented out.

    Then simply replace aud=LWLibavAudioSource with #aud=LWLibavAudioSource and vice versa.
    Quote Quote  
  16. Code:
    aud=LWLibavAudioSource("C:\Users\Administrator\Desktop\particolare1\480 368 per robocrop vfvar.mp4",stream_index=1)
    yes but is not enought:

    I need to delete ,stream_index=1

    but stream_index can assume 2 or 3 or 10 (teorically)

    the routine should to delete ,stream_index=x in every case

    the final result have to be:

    aud=FFAudioSource("C:\Users\Administrator\Desktop\ particolare1\480 368 per robocrop vfvar.mp4")
    Quote Quote  
  17. So after seeing how to remove ",stream_index=1" you can't figure out how to remove ",stream_index=2" or some other minor variation?

    Here's a hint: What happens if the string you are trying to replace or remove doesn't appear in the file.
    Quote Quote  
  18. Originally Posted by jagabo View Post
    So after seeing how to remove ",stream_index=1" you can't figure out how to remove ",stream_index=2" or some other minor variation?

    Here's a hint: What happens if the string you are trying to replace or remove doesn't appear in the file.
    impossible condition: the batch is forced to alwais have at least the

    Code:
    aud=LWLibavAudioSource("pathfile",stream_index=x)
    also in the case of no-audio input, because an appropriate routine (with 3 soub routine) detect the audio stream_index and if a audio is present or not.
    If audio not present, a silence .wav audio file is assumed as new source audio file:

    Code:
       rem ********** PRELIMINARY AUDIO CHECK **********
    
            rem *** procedura 1 sembra per ALTRI TIPI di files ***
            if exist "%~dp1TESTonly1.wav" del "%~dp1TESTonly1.wav"        
            if not "%isMXF%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %4 -ss 00:00:00 -t 00:00:10 -af "pan=stereo:c0=c0:c1=c1,volume=1.0" -c:a pcm_s16le -ar 48000 "%~dp1TESTonly1.wav"
            for %%v in ("TESTonly1.wav") do (
    		if %%~zv LSS 128 (			
                    if exist "%WorkFolder%\TESTonly1.wav" del "%WorkFolder%\TESTonly1.wav"
    		)
    	) 
    
            Set "AudioProc1=false"        
            IF EXIST "%~dp1TESTonly1.wav" set "AudioProc1=true"
            if exist "%~dp1TESTonly1.wav" del "%~dp1TESTonly1.wav"  
    
            rem *** procedura 2 per MXF IMX ***
            if exist "%~dp1TESTonly2.wav" del "%~dp1TESTonly2.wav" 
            if "%isMXF%"=="1" if "%IMX%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %4 -ss 00:00:00 -t 00:00:10 -map_channel 0.1.0 -map_channel 0.1.1  -c:a pcm_s16le -ar 48000 "%~dp1TESTonly2.wav"
            for %%v in ("TESTonly2.wav") do (
    		if %%~zv LSS 128 (			
                    if exist "%WorkFolder%\TESTonly2.wav" del "%WorkFolder%\TESTonly2.wav"
    		)
    	) 
    
            Set "AudioProc2=false"
            IF EXIST "%~dp1TESTonly2.wav" set "AudioProc2=true"
            if exist "%~dp1TESTonly2.wav" del "%~dp1TESTonly2.wav" 
    
            rem *** procedura 3 per MXF HD e DVCAM ***
            if exist "%~dp1TESTonly3.wav" del "%~dp1TESTonly3.wav"         
            IF NOT "%P2Panasonic%"=="1" if "%isMXF%"=="1" if NOT "%IMX%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %4 -ss 00:00:00 -t 00:00:10 -filter_complex "[0:1] [0:2] amerge,volume=1.0" -c:a pcm_s16le -ar 48000 "%~dp1TESTonly3.wav"
            for %%v in ("TESTonly3.wav") do (
    		if %%~zv LSS 128 (			
                    if exist "%WorkFolder%\TESTonly.wav" del "%WorkFolder%\TESTonly.wav"
    		)
    	) 
            Set "AudioProc3=false"
            IF EXIST "%~dp1TESTonly3.wav" set "AudioProc3=true"
            if exist "%~dp1TESTonly3.wav" del "%~dp1TESTonly3.wav"
     
            Set "NoAudioInsideInputFile=0"
                  
            if "%AudioProc1%"=="false" if "%AudioProc2%"=="false" if "%AudioProc3%"=="false" Set "NoAudioInsideInputFile=1"        
            if NOT "%NoAudioInsideInputFile%"=="1" Set "AudioSource=%4"
            if "%NoAudioInsideInputFile%"=="1" Set AudioSource="v:\automazioneclip\system\empty.wav"
                    
            echo *** AudioProc1 [non-MXF files] = %AudioProc1% ***
            echo *** AudioProc2 [MXF IMX files] = %AudioProc2% ***
            echo *** AudioProc3 [MXF HD e DVCAM] = %AudioProc3% ***
            echo audioSource is %AudioSource%
    
            if exist "%~dp1empty.wav" del "%~dp1empty.wav"
            if exist "%~dp1TESTonly.wav" del "%~dp1TESTonly.wav"
    so
    Quote Quote  
  19. Originally Posted by marcorocchini View Post
    Originally Posted by jagabo View Post
    So after seeing how to remove ",stream_index=1" you can't figure out how to remove ",stream_index=2" or some other minor variation?

    Here's a hint: What happens if the string you are trying to replace or remove doesn't appear in the file.
    impossible condition: the batch is forced to alwais have at least...
    I can't believe you're this dense.

    Code:
    fart -C filename.avs ,stream_index=1) )
    fart -C filename.avs ,stream_index=2) )
    fart -C filename.avs ,stream_index=3) )
    etc.
    Quote Quote  
  20. but if, for example: stream_index=27

    I cannot do
    fart -C filename.avs ,stream_index=1) )
    fart -C filename.avs ,stream_index=2) )
    fart -C filename.avs ,stream_index=3) )
    fart -C filename.avs ,stream_index=4) )
    fart -C filename.avs ,stream_index=5) )
    ...
    fart -C filename.avs ,stream_index=27) )

    And if stream_index=1288 ?

    yes I know: in the 99,99% of all the cases stream_index will be 1 or 2 but in principle I must delete the content of a variable regardless of whatever value it has
    Quote Quote  
  21. Then use a smarter string editor like sed that supports wildcards.

    Code:
    sed -i s/,stream_index=.*)/)/ filename.avs
    Last edited by jagabo; 31st Dec 2017 at 20:40.
    Quote Quote  
  22. if NOT "%isMXF%"=="1" if exist "%CD%\tempGeneralTest.mp4" del "%CD%\tempGeneralTest.mp4"
    if NOT "%isMXF%"=="1" v:\automazioneclip\core\ffmpeg64bit2014.exe -loglevel fatal -y -i "%~n1_HD.avs" -c:v mjpeg -pix_fmt uyvy422 -c:a libmp3lame -ar 48000 -aspect 16:9 -ar 48000 -ss 00:00:00 -t 00:00:01 -an "%CD%\tempGeneralTest.mp4"
    if NOT "%isMXF%"=="1" if exist "%CD%\tempGeneralTest.mp4" set "seemsAllOk=1"
    if NOT "%isMXF%"=="1" IF "%isMP4%"=="1" if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" "vid=LSMASHVideoSource" "vid=FFVideoSource"
    if NOT "%isMXF%"=="1" IF NOT "%isMP4%"=="1" if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" "vid=LWLibavVideoSource" "vid=FFVideoSource"
    if NOT "%isMXF%"=="1" if not "%seemsAllOk%"=="1" V:\automazioneclip\system\fart.exe "%~n1_HD.avs" "aud=LWLibavAudioSource" "aud=FFAudioSource"
    if NOT "%isMXF%"=="1" if not "%seemsAllOk%"=="1" v:\automazioneclip\system\sed\sed.exe -i s/,stream_index=.*)/)/ "%~n1_HD.avs"
    if NOT "%isMXF%"=="1" if not "%seemsAllOk%"=="1" echo utilizzoDiFFVideoSourceCausaCrashDiLSMASHVideoSour ce>"%~dp1%~n1_utilizzoDiFFVideoSourceCausaCrashDiL SMASHVideoSource.txt"
    if NOT "%isMXF%"=="1" if exist "%CD%\tempGeneralTest.mp4" del "%CD%\tempGeneralTest.mp4"[/CODE]

    solved cat thank you
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!