VideoHelp Forum




+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 39 of 39
  1. Originally Posted by aazerty View Post
    Hi ,
    OPEN your eyes !!!
    Image
    [Attachment 42531 - Click to enlarge]


    thank you but I dont' need and I don't want recode MP4 files, if this is the answer. My source files are generally MXF/xdcamhd422 but there are possible that other type of source are present in the watched directory, whatched by my batch. My target is this: for all files present in the watched directory I would like create a correspondant MP4 file in a subdirectory called tempFFMPEG. Finally, when I think to create the final output.mp4 file, with another batch procedure I concatenate all the mp4 files contatined in the tempFFMPEG subdirectory. This mean that all .mp4 file created by the bath need to be concatenable one by one without errors.

    The batch I have thinked, but I'm Cat , have two routine: one is the MAIN routine that process all source different than xdcamhd422 using alwais avisynth as source and treating all type of audio possibilities: at the end, the MAIN routine should generate a .MP4 file that have 1 video stream (on ID 1) and 1 audio stereo L+R stream (on ID 2). Meanwhile the CONFI routine (that treat only xdcamhd422 mxf sources) process exclusively MXF HD422 sources without using avisynth and using the 64 bit version of ffmpeg.

    But the problem is that to treat MXF xdcamhd422 sources is necessary a commanline like this:
    Code:
    ffmpeg64bit332.exe -y -threads 12 -i MXFXDCAMHD422source.MXF -filter_complex "[0:1] [0:2] amerge" -s 1920x1080 -r 25 -f mp4 -vf scale=interl=1,format=pix_fmts=yuv420p -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -bf 2 -crf 22.8 -flags +ildct+ilme -top 1 -c:a ac3 -b:a 320k -ar 48000 -aspect 16:9 meowwcat.MP4
    that generate the video section on ID 2, and audio on ID 1: this causes the failure of concatenate.

    So I wonder if there is a way to use
    Code:
    -filter_complex "[0:1] [0:2] amerge
    but keeping the video on ID 1 and audio on ID 2 as the MAIN routine do

    Code:
    rem *** inserire uno swith per ch3 e ch4 audio ***
    
    Set "ConvertiComunque_a_REC601_=0"
    Set "AudioVolume=1.0"
    Set "ffEXT=mp4"
    
    @rem unless otherwise specified for debugging reasons turn echo off 
    @if "%EMode%"=="" Set EMode=ON
    @ECHO %EMode%
    @ECHO off   
     
    SetLocal DisableDelayedExpansion
    
    Set "EXTLIST=*.*"
    Set "DoPop=0"
    Set "ARGLVL=0"
    Set "FileName-DQ="
    
    set "DestFolder=."
    Set "WorkFolder=%DestFolder%"
    
    rem process the arguments one by one
    :ARGS
    color
    	
    	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>
    color
    
    	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 <FILENAME>
    color
    
    IF EXIST "%cd%\tempFFMPEG\%~n1.%ffEXT%" goto :eof
    timeout /t 2
     
            if NOT EXIST "v:\automazioneclip\system\empty.wav" (
    		echo  v:\automazioneclip\system\empty.wav not Found! 
    		pause
    
    	)
    
            Set "TokenS=0"
            Set "lnkError=0"
            IF "%~x1"==".LNK" Set "TokenS=1" 
            IF "%~x1"==".lnk" Set "TokenS=1"
    	if "%Tokens%"=="1" (
    		echo  ERRORE! non inserire collegamenti .lnk come input!
                    timeout /5 
    		goto :eof
                   	)
           
            Set "TokenS=0"
            Set "Filter=0"
            IF "%~x1"==".MXF" Set "TokenS=1" 
            IF "%~x1"==".mxf" Set "TokenS=1"
            IF "%~x1"==".AVI" Set "TokenS=1" 
            IF "%~x1"==".avi" Set "TokenS=1"
            IF "%~x1"==".MP4" Set "TokenS=1" 
            IF "%~x1"==".mp4" Set "TokenS=1"
            IF "%~x1"==".MOV" Set "TokenS=1" 
            IF "%~x1"==".mov" Set "TokenS=1"
            IF "%~x1"==".MKV" Set "TokenS=1" 
            IF "%~x1"==".mkv" Set "TokenS=1"
            IF "%~x1"==".MPEG" Set "TokenS=1"
            IF "%~x1"==".mpeg" Set "TokenS=1"
            IF "%~x1"==".VOB" Set "TokenS=1"
            IF "%~x1"==".vob" Set "TokenS=1"
            IF "%~x1"==".MPG" Set "TokenS=1" 
            IF "%~x1"==".mpg" Set "TokenS=1"
            IF "%~x1"==".MPE" Set "TokenS=1" 
            IF "%~x1"==".mpe" Set "TokenS=1"
            IF "%~x1"==".FLV" Set "TokenS=1" 
            IF "%~x1"==".flv" Set "TokenS=1"
            IF "%~x1"==".FLC" Set "TokenS=1" 
            IF "%~x1"==".flc" Set "TokenS=1"
            IF "%~x1"==".FLI" Set "TokenS=1" 
            IF "%~x1"==".fli" Set "TokenS=1"
            IF "%~x1"==".SWF" Set "TokenS=1" 
            IF "%~x1"==".swf" Set "TokenS=1"
            IF "%~x1"==".WMV" Set "TokenS=1" 
            IF "%~x1"==".wmv" Set "TokenS=1"
            IF "%~x1"==".3GP" Set "TokenS=1" 
            IF "%~x1"==".3gp" Set "TokenS=1"
            IF "%~x1"==".3gpp" Set "TokenS=1"
            IF "%~x1"==".3GPP" Set "TokenS=1"
            IF "%~x1"==".DV" Set "TokenS=1" 
            IF "%~x1"==".dv" Set "TokenS=1"
            IF "%~x1"==".TS" Set "TokenS=1" 
            IF "%~x1"==".ts" Set "TokenS=1"
            IF "%~x1"==".QT" Set "TokenS=1" 
            IF "%~x1"==".qt" Set "TokenS=1"
            IF "%~x1"==".ASF" Set "TokenS=1" 
            IF "%~x1"==".asf" Set "TokenS=1"
            IF "%~x1"==".AMV" Set "TokenS=1" 
            IF "%~x1"==".amv" Set "TokenS=1"
            IF "%~x1"==".OGM" Set "TokenS=1" 
            IF "%~x1"==".ogm" Set "TokenS=1"
    
            If "%TokenS%"=="1" Set "Filter=1" 
    
            Set "TokenS=0"
            Set "isMXF=0"
            IF "%~x1"==".MXF" Set "TokenS=1" 
            IF "%~x1"==".mxf" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isMXF=1"
    
            If NOT "%Filter%"=="1" (
    		echo  *** input file non MXF o non MP4 o non nei formati .MOV .AVI .MKV .MPEG .VOB .MPG .MPE .FLV .FLI .FLC .SWF .WMV .3GP .DV .TS .QT .ASF .AMV .OGM .3gpp  *** 
            goto :eof                                                             
    	)
    
            Set "SetMemoryMaxValue=16"
    
           	Set /a Count+=1
    	Set "FOUNDLVL=%STARTLVL%"
    	SetLocal DisableDelayedExpansion
            
    
            rem Find TimeCode Info
         	Set AUCount=0;
    
    	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^,r_frame_rate^,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"=="r_frame_rate" set "Frame_Rate=%%~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!
    		timeout /t 3
    		goto :eof
    	)
    	if "%V_Height%"=="" (
    		echo  ERROR: Video Height NOT FOUND!
    		pause
    		goto :eof
    	)
            if "%Frame_Rate%"=="" (
    		echo  ERROR: Frame_Rate NOT FOUND!
    		)
    	if "%V_PAR%"=="" (
    		echo  ERROR: Video PAR NOT FOUND!
    		pause			)
    
    	if %V_Width% GTR 801 if %V_Height% GTR 609 set "V_Q=HD"
    	if %V_Width% LEQ 800 if %V_Height% LEQ 601 Set "V_Q=SD"
            if "%V_Width%"=="720" if "%V_Height%"=="608" Set "V_Q=XDCAM_IMX"
           	echo  Using %V_Q% Mode
    	echo  PAR = %V_PAR%
    
            set "ALPHA=0"
            rem *** check if file is MXF
    
            Set "TokenS=0"
            Set "isMXF=0"
            IF "%~x1"==".MXF" Set "TokenS=1" 
            IF "%~x1"==".mxf" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isMXF=1"
    
            IF exist "%DestFolder%\unicodefile.txt" DEL "%DestFolder%\unicodefile.txt"
            IF exist  "%DestFolder%\mediainfo.txt" DEL "%DestFolder%\mediainfo.txt"
    
            v:\automazioneclip\virtualdub\mediainfo.exe "%~dpnx1" dumpinfo:unicodefile.txt
            TYPE unicodefile.txt>mediainfo.txt
    
            findstr /c:"Codec ID                                 : 0D01030102020201-0401020202010200" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "dvcam=1")
            
            set "PROGRESSIVE=0"
            findstr /c:"Scan type                                : Progressive" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "PROGRESSIVE=1")
    
            set "doubleframrate=0"
            findstr /c:"Frame rate                               : 50.000 fps" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "doubleframrate=1")
            findstr /c:"Codec ID                                 : YUY2" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "UNCOMPRESSED=1")           
               
            set "fullHDinterlace=0" 
            set "xdcamhd422=unknown"
            set "fps=unknown"
            set "ch_sub=unknown"
            set "scanInterlace=unknown"
            findstr /c:"Format profile                           : 4:2:2@High" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "xdcamhd422=yes")
            findstr /c:"Frame rate                               : 25.000 fps" "mediainfo.txt"  
            IF NOT ERRORLEVEL 1 (set "fps25=yes")
            findstr /c:"Chroma subsampling                       : 4:2:2" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "ch_sub=yes")
            findstr /c:"Scan type                                : Interlaced" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "scanInterlace=yes")
            findstr /c:"Scan type                                : Progressive" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "scanProgressive=yes")
            findstr /c:"Scan type                                : MBAFF" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "scanMBAFF=1")
            findstr /c:"Height                                   : 1 088" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "height1088=1")
            findstr /c:"Original height                          : 1 088 pixels" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "Morgan1088=1")
    
            if "%xdcamhd422%"=="yes" if  "%fps25%"=="yes" if "%ch_sub%"=="yes" if "%scanInterlace%"=="yes" set "fullHDinterlace=1"
            if "%xdcamhd422%"=="yes" if  "%fps25%"=="yes" if "%ch_sub%"=="yes" if "%scanProgressive%"=="yes" set "fullHDprogressive=1"
    
            set "IMX=0"
            findstr /c:"Commercial name                          : IMX" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "IMX=1")
    
            set "MXFXDCAMHQorSP25fpsinterlaced=0"
            set "MXFXDCAMHQorSP25fpsProgressive=0"  
            set "fps25=unknown"
            set "ch_sub420=unknown"
            set "IMXorDVCAM=no"
            findstr /c:"Commercial name                          : XDCAM HD 35" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "xdcamhd35=yes")
            findstr /c:"Commercial name                          : XDCAM HD 25" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "xdcamhd25=yes")
            findstr /c:"Format                                   : MPEG Video" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "mpegvideoF335=yes")
            findstr /c:"Commercial name                          : HDV 1080i" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "HDV1080i=yes")
            findstr /c:"Commercial name                          : HDV 1080p" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "HDV1080p=yes")
            findstr /c:"Frame rate                               : 25.000 fps" "mediainfo.txt"  
            IF NOT ERRORLEVEL 1 (set "fps25=yes")
            findstr /c:"Frame rate                               : 50.000 fps" "mediainfo.txt"  
            IF NOT ERRORLEVEL 1 (set "fps50=yes")
            findstr /c:"Frame rate                               : 25.000 fps" "mediainfo.txt"  
            IF NOT ERRORLEVEL 1 (set "fps25tag=1")
            findstr /c:"Chroma subsampling                       : 4:2:0" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "ch_sub420=yes")
            findstr /c:"Scan type                                : Interlaced" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "scanInterlace=yes")
            findstr /c:"Scan type                                : Progressive" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "scanProgressive420=yes")
            findstr /c:"Width                                    : 720" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "IMXorDVCAM=yes")
            findstr /c:"Width                                    : 1 920" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "H1920=yes")
            findstr /c:"Height                                   : 1 080" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "V1080=yes")
            findstr /c:"Scan order                               : Bottom Field First" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "ScanBottom=1")
            findstr /c:"Rotation                                 : 90ø" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "rotation=1")
            findstr /c:"Color space                              : RGBA" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "ALPHACHANNEL=1")
    
            rem *** check FOR MP4 routine *** 
            Set "isMP4=0"         
            Set "TokenS=0"
            IF "%~x1"==".MP4" Set "TokenS=1" 
            IF "%~x1"==".mp4" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isMP4=1"
            rem *** check FOR MP4 *** 
            
            if "%xdcamhd35%"=="yes" if  "%fps25%"=="yes" if "%ch_sub420%"=="yes" if "%scanInterlace%"=="yes" set "MXFXDCAM3525fpsinterlaced=1"
            if "%HDV1080i%"=="yes" if  "%fps25%"=="yes" if "%ch_sub420%"=="yes" if "%scanInterlace%"=="yes" set "MXFXDCAMHDV1080i25fpsinterlaced=1"
            if "%mpegvideoF335%"=="yes" if  "%fps25%"=="yes" if "%ch_sub420%"=="yes" if "%scanInterlace%"=="yes" set "MXFXDCAMF335interlaced=1"
            set "MXFXDCAMHQorSP25fpsinterlaced=0" 
            if "%MXFXDCAM3525fpsinterlaced%"=="1" set "MXFXDCAMHQorSP25fpsinterlaced=1" 
            if "%MXFXDCAMHDV1080i25fpsinterlaced%"=="1" set "MXFXDCAMHQorSP25fpsinterlaced=1"
            if "%MXFXDCAMF335interlaced%"=="1" set "MXFXDCAMHQorSP25fpsinterlaced=1"
            if "%xdcamhd35%"=="yes" if  "%fps25%"=="yes" if "%ch_sub420%"=="yes" if "%scanProgressive420%"=="yes" set "MXFXDCAM3525fpsProgressive=1"
            if "%xdcamhd35%"=="yes" if "%ch_sub420%"=="yes" if "%scanProgressive420%"=="yes" if "%doubleframrate%"=="1" set "MXFXDCAM35_50fps_Progressive=1"
            if "%xdcamhd25%"=="yes" if "%ch_sub420%"=="yes" if "%scanProgressive420%"=="yes" if "%doubleframrate%"=="1" set "MXFXDCAM25_50fps_Progressive=1"     
            if "%MXFXDCAM35_50fps_Progressive%"=="1" set "MXFXDCAM35or25_50fps_Progressive=1"
            if "%MXFXDCAM25_50fps_Progressive%"=="1" set "MXFXDCAM35or25_50fps_Progressive=1"
    
            if "%HDV1080p%"=="yes" if  "%fps25%"=="yes" if "%ch_sub420%"=="yes" if "%scanProgressive420%"=="yes" set "MXFXDCAMHDV1080p25fpsProgressive=1"       
            set "MXFXDCAMHQorSP25fpsProgressive=0" 
            if "%MXFXDCAM3525fpsProgressive%"=="1" set "MXFXDCAMHQorSP25fpsProgressive=1" 
            if "%MXFXDCAMHDV1080p25fpsProgressive%"=="1" set "MXFXDCAMHQorSP25fpsProgressive=1"
    
            set "dvcamPal=0"       
            if "%dvcam%"=="1" if "%fps25tag%"=="1" Set "dvcamPal=1"
    
            set "fullHD=0"       
            if "%H1920%"=="yes" if "%V1080%"=="yes" Set "fullHD=1"
    
    rem ***debugecho xdcamhd35interlacciato uguale a "%MXFXDCAM3525fpsinterlaced%"
    rem ***debug  echo HDV1080iinterlacciato uguale a "%MXFXDCAMHDV1080i25fpsinterlaced%"
    rem ***debug  echo MXFXDCAMHQorSP25fpsinterlaced "%MXFXDCAMHQorSP25fpsinterlaced%"
    rem ***debug  echo MXFXDCAM3525fpsProgressive "%MXFXDCAM3525fpsProgressive%"
    rem ***debug echo MXFXDCAMHDV1080p25fpsProgressive "%MXFXDCAMHDV1080p25fpsProgressive%"
    rem ***debug echo MXFXDCAMHQorSP25fpsProgressive "%MXFXDCAMHQorSP25fpsProgressive%"
    
            Set "TokenS=0"
            Set "ScanProgressive25fps=0"
            if "%fps25%"=="yes" if "%scanProgressive%"=="yes" Set "ScanProgressive25fps=1"
    echo fps25 is %fps25%
    echo scanProgressive %scanProgressive%
    echo ScanProgressive25fps is %ScanProgressive25fps%
    
            Set "TokenS=0"
            Set "H1088=0"
            if "%H1920%"=="yes" if "%height1088%"=="1" Set "H1088=1"
            if "%H1920%"=="yes" if "%Morgan1088%"=="1" Set "H1088=1"
    
            Set "TokenS=0"
            Set "ScanBottomORdvcam=0"
            if "%ScanBottom%"=="1" Set "TokenS=1"
            if "%dvcam%"=="1" Set "TokenS=1"
            IF "%TokenS%"=="1" Set "ScanBottomORdvcam=1"
    
           rem *** check if file is MXF non-PAL***
           Set "TokenS=0"
           Set "fps25OR50=0"
           Set "MXFnonPAL=0"
           if "%fps25%"=="yes" Set "TokenS=1" 
           if "%fps50%"=="yes" Set "TokenS=1"
           if "%TokenS%"=="1" Set "fps25OR50=1"
            Set "TokenS=0"
            Set "isMXF=0"
            IF "%~x1"==".MXF" Set "TokenS=1" 
            IF "%~x1"==".mxf" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isMXF=1"
    
            If "%isMXF%"=="1" if NOT "%fps25OR50%"=="1" Set "MXFnonPAL=1"
    
            rem *** check if file is MXF and - at the same time - any HD ***
            Set "TokenS=0"
            Set "isMXF=0"
            set "HDformat=0"
            set "mxfHD422=0"
            set "mxfHD420=0"
            set "Ch_Sub422=unknown"
            set "Ch_Sub420=unknown"
    	if %V_Height% GEQ 720 (Set "HDformat=1")
            IF "%~x1"==".MXF" Set "TokenS=1" 
            IF "%~x1"==".mxf" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isMXF=1"
            findstr /c:"Chroma subsampling                       : 4:2:2" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "Ch_Sub422=yes")
            findstr /c:"Chroma subsampling                       : 4:2:0" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "Ch_Sub420=yes")
        
            Set "ScanTypeProgressive=0"
            Set "ScanTypeInterlaced=0"
    
            findstr /c:"Scan type                                : Progressive" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "ScanTypeProgressive=1")
            findstr /c:"Scan type                                : Interlaced" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "ScanTypeInterlaced=1")      
    
            rem *** check if is an .avi mjpeg input file
            Set "TokenS=0"
            Set "isAVI=0"
            IF "%~x1"==".AVI" Set "TokenS=1" 
            IF "%~x1"==".avi" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isAVI=1"
            Set "TokenS=0"
            IF "%isAVI%"=="1" (v:\automazioneclip\virtualdub\mediainfo.exe "%~dp1%~n1.avi" dumpinfo:unicodefile.txt
            TYPE unicodefile.txt>mediainfo.txt)
            findstr /c:"Codec ID                                 : MJPG" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "AVImjpeg=1")
    
            Set "TokenS=0"
            Set "AVIMJPEG_OR_AVIUNCOMPRESSED"=0"
            IF "%isAVI%"=="1" if "%AVImjpeg%"=="1" Set "TokenS=1" 
            IF "%isAVI%"=="1" if "%UNCOMPRESSED%"=="1" Set "TokenS=1" 
            If "%TokenS%"=="1" Set "AVIMJPEG_OR_AVIUNCOMPRESSED=1"
    
            rem if "%AVImjpeg%"=="1" (CALL :Make_File_AVImjpeg "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
            rem if "%UNCOMPRESSED%"=="1" (CALL :Make_File_AVImjpeg "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    
            IF NOT "%ScanTypeProgressive%"=="1" IF NOT "%ScanTypeInterlaced%"=="1" Set "ScanTypeProgressive=1"
            IF "%scanMBAFF%"=="1" set "ScanTypeInterlaced=1"
            IF "%scanMBAFF%"=="1" Set "ScanTypeProgressive=0"
    
            if exist "unicodefile.txt" del "unicodefile.txt"
            if exist "ascii.txt" del "ascii.txt"
            if exist "mediainfo.txt" del "mediainfo.txt"
            if exist "%DestFolder%\tempFFMPEG\tempVideoAudioFile.MP4" del "%DestFolder%\tempFFMPEG\tempVideoAudioFile.MP4"
    
            rem *** redirect to generic CONFI or MAIN procedure
    
            If "%Filter%"=="1" if "%fullHDinterlace%"=="1" (CALL :Make_File_CONFI "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
            If "%Filter%"=="1" if NOT "%fullHDinterlace%"=="1" (CALL :Make_File_MAIN "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    
            
    
    	echo  FATTO
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    
    :Make_File_CONFI <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
               IF EXIST "%cd%\tempFFMPEG\%~n1.%ffEXT%" goto :eof
    
               color a
    
               REM ************************************************************************************************** FFMPEG CONFI SESSION **************************************************************************************************
               if not exist "%cd%\tempFFMPEG" MD "%cd%\tempFFMPEG"
    
               if exist "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%" del "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%"
    
               v:\automazioneclip\core\ffmpeg64bit332.exe -y -threads 12 -i %4 -filter_complex "[0:1] [0:2] amerge" -vn -c:a ac3 -b:a 320k -ar 48000 tempAudio1.mp4
               v:\automazioneclip\core\ffmpeg64bit332.exe -y -threads 12 -i %4 -i tempAudio1.mp4 -s 1920x1080 -r 25 -f mp4 -vf scale=interl=1,format=pix_fmts=yuv420p -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=1:rc_lookahead=1:chroma_qp_offset=0:8x8dct=1 -g 100 -bf 2 -crf 22.8 -flags +ildct+ilme -top 1 -acodec copy -aspect 16:9 "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%"
              
               ren "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%" "%~n1.%ffEXT%"
               REM **************************************************************************************************************************************************************************************************************************
    
    if exist "tempAudio1.mp4" del "tempAudio1.mp4"
    if exist "unicodefile.txt" del "unicodefile.txt"
    if exist "ascii.txt" del "ascii.txt"
    if exist "mediainfo.txt" del "mediainfo.txt"
    If exist "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%" del "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%"
    if exist "%cd%\tempFFMPEGAudio\%~n1.wav" del "%cd%\tempFFMPEGAudio\%~n1.wav"
    
    color f
    
    goto :eof
    
    :Make_File_MAIN <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
            IF EXIST "%cd%\tempFFMPEG\%~n1.%ffEXT%" goto :eof
    
    color e
    
    IF "%AudioVolume%"==""  (
    			echo  ERRORE !!! per qualche motivo non è stata definita la variabile AudioVolume !!!
    			pause
    		)
    	)
    
            echo ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
            echo ³                                      ³
            echo ³              MAIN                    ³
            echo ³                                      ³
            echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
            echo.
    
           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 a
    
            rem ***Make The .avs Script File ***
    
            if exist "%~n1_HD.avs" del "%~n1_HD.avs"
            echo SetMemoryMax^(%SetMemoryMaxValue%^)>"%~n1_HD.avs"
            echo Import^("v:\automazioneclip\avisynth\plugins\IResize.avsi"^)>>"%~n1_HD.avs"
            echo LoadPlugin^("v:\automazioneclip\avisynth\plugins\LSMASHSource.dll"^)>>"%~n1_HD.avs"
            echo LoadCPlugin("v:\automazioneclip\avisynth\plugins\yadif.dll")>>"%~n1_HD.avs"  
            IF "%isMP4%"=="1" echo LSMASHVideoSource^(%4^)>>"%~n1_HD.avs"
            IF NOT "%isMP4%"=="1" echo LWLibavVideoSource^(%4^)>>"%~n1_HD.avs"
            if NOT "%Ch_Sub422%"=="yes" if "%PROGRESSIVE%"=="1" echo ConvertToYUY2^(interlaced=false^)>>"%~n1_HD.avs"
            if NOT "%Ch_Sub422%"=="yes" IF NOT "%PROGRESSIVE%"=="1" echo ConvertToYUY2^(interlaced=true^)>>"%~n1_HD.avs"
            if "%IMXorDVCAM%"=="yes" echo colorMatrix^(mode="Rec.601->Rec.709"^)>>"%~n1_HD.avs"        
            IF "%IMX%"=="1" echo crop^(0,32,0,0^)>>"%~n1_HD.avs"        
            if NOT "%fullHD%"=="1" if NOT "%PROGRESSIVE%"=="1" if not "%H1088%"=="1" echo IResize^(1920,1080^)>>"%~n1_HD.avs"
            if NOT "%fullHD%"=="1" if "%PROGRESSIVE%"=="1" if not "%H1088%"=="1" echo LanczosResize^(1920,1080^)>>"%~n1_HD.avs"
            if "%ScanBottomORdvcam%"=="1" echo ReverseFieldDominance^(^)>>"%~n1_HD.avs"
            IF "%H1088%"=="1" echo crop^(0,0,1920,1080^)>>"%~n1_HD.avs"                
            echo ### ATTENZIONE l'uso dei filtri ColorYUV rende difficile il playback in realtime ###>>"%~n1_HD.avs"
            echo #ColorYUV^(levels="PC->TV"^)>>"%~n1_HD.avs"
            echo #ColorYUV^(gamma_y=-7, gamma_u=-7, gamma_v=-7^)>>"%~n1_HD.avs"
            echo #TurnLeft^(^)>>"%~n1_HD.avs"
            echo #TurnRight^(^)>>"%~n1_HD.avs"
            IF "%rotation%"=="1" echo Turn180^(^)>>"%~n1_HD.avs"
            if NOT "%fps25OR50%"=="1" if NOT "%PROGRESSIVE%"=="1" echo yadif^(1,1^)>>"%~n1_HD.avs"
            if NOT "%fps25OR50%"=="1" echo SmoothFPS2^(50000,1000^)>>"%~n1_HD.avs" 
            if NOT "%fps25OR50%"=="1" echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HD.avs"
            if "%fps50%"=="yes" echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>"%~n1_HD.avs"    
            echo AssumeFPS^(25^)>>"%~n1_HD.avs"
    
            rem ********** AUDIO PROCESSING ROUTINE****************************************************************************************************************************************************************************************
            if exist "%~dp1TESTonly.wav"  del "%~dp1TESTonly.wav"
    
            rem *** procedura 1 sembra per ALTRI TIPI di files ***
            
            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 "%~dp1TESTonly.wav"
            for %%v in ("TESTonly.wav") do (
    		if %%~zv LSS 128 (			
                    del "%WorkFolder%\TESTonly.wav"
    		)
    	) 
    
            rem *** procedura 2 per MXF IMX ***
            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 "%~dp1TESTonly.wav"
            for %%v in ("TESTonly.wav") do (
    		if %%~zv LSS 128 (			
                    del "%WorkFolder%\TESTonly.wav"
    		)
    	) 
    
            rem *** procedura 3 per MXF HD e DVCAM ***
            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 "%~dp1TESTonly.wav"
            for %%v in ("TESTonly.wav") do (
    		if %%~zv LSS 128 (			
                    del "%WorkFolder%\TESTonly.wav"
    		)
    	) 
     
    
            Set "NoAudioInsideInputFile=0"
            rem if NOT exist "%~dp1TESTonly.wav" xcopy /y v:\automazioneclip\system\empty.wav "%~dp1"
            if NOT exist "%~dp1TESTonly.wav" Set "AudioSource=v:\automazioneclip\system\empty.wav"
            if NOT exist "%~dp1TESTonly.wav" Set "NoAudioInsideInputFile=1"
            if exist "%~dp1TESTonly.wav" Set "AudioSource=%4"
            echo audioSource assume %AudioSource%
    
            rem ren "%~dp1empty.wav" "%~n1_HD.wav"
            if exist "%~dp1empty.wav" del "%~dp1empty.wav"
            if exist "%~dp1TESTonly.wav" del "%~dp1TESTonly.wav"
            cls  
            
            echo PROCESSING %4
    
    
    echo isMP4 assume %isMP4%
    echo Ch_Sub422 assume %Ch_Sub422%
    echo progressive assume %PROGRESSIVE%
    echo fullHD assume %fullHD% 
    echo IMXorDVCAM assume %IMXorDVCAM%
    
            Set "TokenS=0"
            if "%MXFnonPAL%"=="1" set "TokenS=1"
            if "%fps25OR50%"=="1" set "TokenS=1"
            if NOT "%fps25OR50%"=="1" set "TokenS=1"
            if "%TokenS%"=="1" set "MXFnonPAL_OR_fps25OR50_OR_NOT25or50=1"
    
            echo MXFnonPAL_OR_fps25OR50_OR_NOT25or50 assume %MXFnonPAL_OR_fps25OR50_OR_NOT25or50%
    
            rem *** audio processing for MXF IMX 25 or 50 FPS***
            if not exist "%cd%\tempFFMPEGAudio" MD "%cd%\tempFFMPEGAudio"
            IF NOT EXIST "%cd%\tempFFMPEGAudio\%~n1.wav" if "%isMXF%"=="1" if "%fps25OR50%"=="1" IF "%IMX%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %AudioSource% -af "pan=stereo:c0=c0:c1=c1,volume=%AudioVolume%" -c:a pcm_s16le -ar 48000 "%cd%\tempFFMPEGAudio\%~n1.wav"
        
            rem *** audio processing for MXF HD & DVCAM files 25 or 50 FPS ***
            IF NOT EXIST "%cd%\tempFFMPEGAudio\%~n1.wav" if "%isMXF%"=="1" if "%fps25OR50%"=="1" IF NOT "%IMX%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %AudioSource% -filter_complex "[0:1] [0:2] amerge,volume=%AudioVolume%" -c:a pcm_s16le -ar 48000 "%cd%\tempFFMPEGAudio\%~n1.wav"
            
    
            rem #### check duration of .avi gen file ####
    
            if exist aviGenDuration.txt del aviGenDuration.txt
            if NOT "%fps25OR50%"=="1" v:\automazioneclip\core\FFProbe2016 -show_entries format=duration -v quiet -of csv="p=0" -sexagesimal "%~n1_HD.avs" >aviGenDuration.txt     
            if NOT "%fps25OR50%"=="1" set /p aviGenDuration=<aviGenDuration.txt
    
    
            rem ************************************** AUDIO PARTICULAR processing subcatRoutine ***************************************************************************************************************************************************************        
            IF NOT EXIST "%cd%\tempFFMPEGAudio\%~n1.wav" if "%isMXF%"=="1" IF NOT "%IMX%"=="1" if NOT "%fps25OR50%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %AudioSource% -filter_complex "[0:1] [0:2] amerge,volume=1.0,apad" -shortest -t %aviGenDuration% -c:a pcm_s16le -ar 48000 "%cd%\tempFFMPEGAudio\%~n1.wav"   
            IF NOT EXIST "%cd%\tempFFMPEGAudio\%~n1.wav" if "%isMXF%"=="1" IF "%IMX%"=="1" if NOT "%fps25OR50%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %AudioSource% -af "pan=stereo:c0=c0:c1=c1,volume=1.0,apad" -shortest -t %aviGenDuration% -c:a pcm_s16le -ar 48000 "%cd%\tempFFMPEGAudio\%~n1.wav"       
            IF NOT EXIST "%cd%\tempFFMPEGAudio\%~n1.wav" if not "%isMXF%"=="1" if NOT "%fps25OR50%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %AudioSource% -af "pan=stereo:c0=c0:c1=c1,volume=1.0,apad" -shortest -t %aviGenDuration% -c:a pcm_s16le -ar 48000 "%cd%\tempFFMPEGAudio\%~n1.wav"   
            IF NOT EXIST "%cd%\tempFFMPEGAudio\%~n1.wav" if "%NoAudioInsideInputFile%"=="1" IF NOT EXIST "%~n1.wav" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %AudioSource% -af "pan=stereo:c0=c0:c1=c1,volume=1.0,apad" -shortest -t %aviGenDuration% -c:a pcm_s16le -ar 48000 "%cd%\tempFFMPEGAudio\%~n1.wav"
            rem ************************************************************************************************************************************************************************************************************************************************* 
    
            rem *** audio processing for NON-MXF FILES 25 or 50 fps ***
            
            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 "%~n1_HD.avs"     2^>^&1') DO (
            if "%%~g"=="duration" set "aviDuration=%%~h"
    	)  
    
            IF NOT EXIST "%cd%\tempFFMPEGAudio\%~n1.wav" if NOT "%isMXF%"=="1" if "%fps25OR50%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %AudioSource% -af "pan=stereo:c0=c0:c1=c1,volume=1.0,apad" -shortest -t %aviDuration% -c:a pcm_s16le -ar 48000 "%cd%\tempFFMPEGAudio\%~n1.wav"
    
            IF NOT EXIST "%cd%\tempFFMPEGAudio\%~n1.wav" if "%NoAudioInsideInputFile%"=="1"  v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %AudioSource% -af "pan=stereo:c0=c0:c1=c1,volume=1.0,apad" -shortest -t %aviDuration% -c:a pcm_s16le -ar 48000 "%cd%\tempFFMPEGAudio\%~n1.wav"
    
            IF NOT EXIST "%cd%\tempFFMPEGAudio\%~n1.wav" if NOT "%NoAudioInsideInputFile%"=="1"  v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i "%~n1.avi" -af "pan=stereo:c0=c0:c1=c1,volume=1.0" -c:a pcm_s16le -ar 48000 "%cd%\tempFFMPEGAudio\%~n1.wav"
            IF NOT EXIST "%cd%\tempFFMPEGAudio\%~n1.wav" if "%NoAudioInsideInputFile%"=="1" IF EXIST "%~n1.wav"   v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i "%~n1.wav" -af "pan=stereo:c0=c0:c1=c1,volume=1.0" -c:a pcm_s16le -ar 48000 "%cd%\tempFFMPEGAudio\%~n1.wav"                                                                                                         
            IF NOT EXIST "%cd%\tempFFMPEGAudio\%~n1.wav" if "%NoAudioInsideInputFile%"=="1" IF NOT EXIST "%~n1.wav" v:\automazioneclip\core\ffmpeg.exe -y -loglevel fatal -i %AudioSource% -af "pan=stereo:c0=c0:c1=c1,volume=1.0,apad" -shortest -t %aviDuration% -c:a pcm_s16le -ar 48000 "%cd%\tempFFMPEGAudio\%~n1.wav"
    
      
               REM ************************************************************************************************** FFMPEG MAIN SESSION **************************************************************************************************
               if not exist "%cd%\tempFFMPEG" MD "%cd%\tempFFMPEG"
    
               if exist "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%" del "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%"
    
               v:\automazioneclip\core\ffmpeg.exe -y -i "%~n1_HD.avs" -i "%cd%\tempFFMPEGAudio\%~n1.wav" -s 1920x1080 -r 25 -f mp4 -vf scale=interl=1,format=pix_fmts=yuv420p -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=1:rc_lookahead=1:chroma_qp_offset=0:8x8dct=1 -g 100 -bf 2 -crf 22.8 -flags +ildct+ilme -top 1 -c:a ac3 -b:a 320k -ar 48000 -aspect 16:9 "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%"
    
               ren "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%" "%~n1.%ffEXT%"
               REM ************************************************************************************************************************************************************************************************************************* 
    
    if exist "unicodefile.txt" del "unicodefile.txt"
    if exist "ascii.txt" del "ascii.txt"
    if exist "mediainfo.txt" del "mediainfo.txt"
    IF exist "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%" del "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%"
    if exist "%~n1_HD.avs" del "%~n1_HD.avs"
    del *.lwi
    if exist "%cd%\tempFFMPEGAudio\%~n1.wav" del "%cd%\tempFFMPEGAudio\%~n1.wav"
    
           goto :eof
    
    :GetTargetName
    color
    
    	Set "FileName="
    	rem Set /p FileName=InputFileName 
    	
    	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
    color
    
    	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
    please note that to correct the problem I have to modify the CONFI section so that the audio part is processed separately:
    Code:
    v:\automazioneclip\core\ffmpeg64bit332.exe -y -threads 12 -i %4 -filter_complex "[0:1] [0:2] amerge" -vn -c:a ac3 -b:a 320k -ar 48000 tempAudio1.mp4
               v:\automazioneclip\core\ffmpeg64bit332.exe -y -threads 12 -i %4 -i tempAudio1.mp4 -s 1920x1080 -r 25 -f mp4 -vf scale=interl=1,format=pix_fmts=yuv420p -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=1:rc_lookahead=1:chroma_qp_offset=0:8x8dct=1 -g 100 -bf 2 -crf 22.8 -flags +ildct+ilme -top 1 -acodec copy -aspect 16:9 "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%"
              
               ren "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%" "%~n1.%ffEXT%"
    but if possible I wonder if is there a way to do all in one line
    Quote Quote  
  2. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Quick question. Isit supposed to be 0:1 and 0:2? Would it be 0:0 and 0:1? Im not an expert on filter complex so just need an education on this if possible.
    Quote Quote  
  3. Sorry *** I dont know

    MXF xdcamhd422 video files have 8 mono audio track like this:

    Code:
    General
    Complete name                            : V:\S\clipA.MXF
    Format                                   : MXF
    Commercial name                          : XDCAM HD422
    Format profile                           : OP-1a
    Format settings                          : Closed / Complete
    File size                                : 23.2 MiB
    Duration                                 : 3s 200ms
    Overall bit rate                         : 60.8 Mbps
    Encoded date                             : 2017-07-25 12:59:28.000
    Writing application                      : SONY Opt  1.22
    Writing library                          : SONY Opt  1.22
    
    Video
    ID                                       : 2
    Format                                   : MPEG Video
    Commercial name                          : XDCAM HD422
    Format version                           : Version 2
    Format profile                           : 4:2:2@High
    Format settings, BVOP                    : Yes
    Format settings, Matrix                  : Custom
    Format settings, GOP                     : M=3, N=12
    Format_Settings_Wrapping                 : Frame
    Duration                                 : 3s 200ms
    Bit rate                                 : 50.0 Mbps
    Width                                    : 1 920 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Frame rate                               : 25.000 fps
    Standard                                 : Component
    Color space                              : YUV
    Chroma subsampling                       : 4:2:2
    Bit depth                                : 8 bits
    Scan type                                : Interlaced
    Scan order                               : Top Field First
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.965
    Stream size                              : 19.1 MiB (82%)
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709
    
    Audio #1
    ID                                       : 3
    Format                                   : PCM
    Format settings, Endianness              : Little
    Format_Settings_Wrapping                 : Frame (AES)
    Duration                                 : 3s 200ms
    Bit rate mode                            : Constant
    Bit rate                                 : 1 152 Kbps
    Channel(s)                               : 1 channel
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 24 bits
    Stream size                              : 450 KiB (2%)
    
    Audio #2
    ID                                       : 4
    Format                                   : PCM
    Format settings, Endianness              : Little
    Format_Settings_Wrapping                 : Frame (AES)
    Duration                                 : 3s 200ms
    Bit rate mode                            : Constant
    Bit rate                                 : 1 152 Kbps
    Channel(s)                               : 1 channel
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 24 bits
    Stream size                              : 450 KiB (2%)
    
    Audio #3
    ID                                       : 5
    Format                                   : PCM
    Format settings, Endianness              : Little
    Format_Settings_Wrapping                 : Frame (AES)
    Duration                                 : 3s 200ms
    Bit rate mode                            : Constant
    Bit rate                                 : 1 152 Kbps
    Channel(s)                               : 1 channel
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 24 bits
    Stream size                              : 450 KiB (2%)
    
    Audio #4
    ID                                       : 6
    Format                                   : PCM
    Format settings, Endianness              : Little
    Format_Settings_Wrapping                 : Frame (AES)
    Duration                                 : 3s 200ms
    Bit rate mode                            : Constant
    Bit rate                                 : 1 152 Kbps
    Channel(s)                               : 1 channel
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 24 bits
    Stream size                              : 450 KiB (2%)
    
    Audio #5
    ID                                       : 7
    Format                                   : PCM
    Format settings, Endianness              : Little
    Format_Settings_Wrapping                 : Frame (AES)
    Duration                                 : 3s 200ms
    Bit rate mode                            : Constant
    Bit rate                                 : 1 152 Kbps
    Channel(s)                               : 1 channel
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 24 bits
    Stream size                              : 450 KiB (2%)
    
    Audio #6
    ID                                       : 8
    Format                                   : PCM
    Format settings, Endianness              : Little
    Format_Settings_Wrapping                 : Frame (AES)
    Duration                                 : 3s 200ms
    Bit rate mode                            : Constant
    Bit rate                                 : 1 152 Kbps
    Channel(s)                               : 1 channel
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 24 bits
    Stream size                              : 450 KiB (2%)
    
    Audio #7
    ID                                       : 9
    Format                                   : PCM
    Format settings, Endianness              : Little
    Format_Settings_Wrapping                 : Frame (AES)
    Duration                                 : 3s 200ms
    Bit rate mode                            : Constant
    Bit rate                                 : 1 152 Kbps
    Channel(s)                               : 1 channel
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 24 bits
    Stream size                              : 450 KiB (2%)
    
    Audio #8
    ID                                       : 10
    Format                                   : PCM
    Format settings, Endianness              : Little
    Format_Settings_Wrapping                 : Frame (AES)
    Duration                                 : 3s 200ms
    Bit rate mode                            : Constant
    Bit rate                                 : 1 152 Kbps
    Channel(s)                               : 1 channel
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 24 bits
    Stream size                              : 450 KiB (2%)
    
    Other #1
    ID                                       : 1
    Type                                     : Time code
    Format                                   : MXF TC
    Time code of first frame                 : 00:25:15:17
    Time code settings                       : Striped
    
    Other #2
    Type                                     : Time code
    Format                                   : SMPTE TC
    Muxing mode                              : SDTI
    Time code of first frame                 : 00:25:15:17
    In my target I would like encode in MP4/x264 with ffmpeg using only the first 2 audio track so that the final output have a stereo L+R audio channel like this:

    Code:
    Generale
    Nome completo                           : V:\TE ST\tempFFMPEG\C0122.mp4
    Formato                                 : MPEG-4
    Profilo formato                         : Base Media
    ID codec                                : isom
    Dimensione                              : 11,5MiB
    Durata                                  : 20s 416ms
    Bitrate totale                          : 4.725 Kbps
    Creato con                              : Lavf57.71.100
    
    Video
    ID                                      : 1
    Formato                                 : AVC
    Formato/Informazioni                    : Advanced Video Codec
    Profilo formato                         : High@L4.1
    Impostazioni formato, CABAC             : Si
    Impostazioni formato, ReFrames          : 4 frame
    ID codec                                : avc1
    ID codec/Informazioni                   : Advanced Video Coding
    Durata                                  : 20s 400ms
    Bitrate                                 : 4.403 Kbps
    Larghezza                               : 1.920 pixel
    Altezza                                 : 1.080 pixel
    Rapporto aspetto visualizzazione        : 16:9
    Modalità frame rate                     : Costante
    Frame rate                              : 25,000 fps
    Spazio colore                           : YUV
    Croma subsampling                       : 4:2:0
    Profondità bit                          : 8 bit
    Tipo scansione                          : MBAFF
    Bit/(pixel*frame)                       : 0.085
    Dimensione della traccia                : 10,7MiB (93%)
    Compressore                             : x264 core 152 r2851 ba24899
    Impostazioni compressione               : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=1 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=4 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=tff / bluray_compat=0 / constrained_intra=0 / bframes=2 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=0 / keyint=100 / keyint_min=10 / scenecut=40 / intra_refresh=0 / rc_lookahead=1 / rc=crf / mbtree=1 / crf=22.8 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
    
    Audio
    ID                                      : 2
    Formato                                 : AC-3
    Formato/Informazioni                    : Audio Coding 3
    Estensione modo                         : CM (complete main)
    Impostazioni formato, Endianness        : Big
    ID codec                                : ac-3
    Durata                                  : 20s 416ms
    Modalità bitrate                        : Costante
    Bitrate                                 : 320 Kbps
    Canali                                  : 2 canali
    Posizione canali                        : Front: L R
    Sampling rate                           : 48,0 KHz
    Profondità bit                          : 16 bit
    Modo compressione                       : Con perdita
    Ritardo video                           : 80ms
    Dimensione della traccia                : 798 KiB (7%)
    But using the -filter_complex "[0:1] [0:2] amerge" in the MXF with 8 mono audio track, I get a MP4 that have video part with ID 2 and audio with ID 1 so this don't allow the conCat.

    To "resolve" I have try a different way: encode the audio part separately using:
    Code:
    ffmpeg64bit332.exe -y -threads 12 -i %4 -filter_complex "[0:1] [0:2] amerge" -vn -c:a ac3 -b:a 320k -ar 48000 tempAudio1.mp4

    and isert this in the final encoding:
    Code:
    ffmpeg64bit332.exe -y -threads 12 -i %4 -i tempAudio1.mp4 -s 1920x1080 -r 25 -f mp4 -vf scale=interl=1,format=pix_fmts=yuv420p -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=1:rc_lookahead=1:chroma_qp_offset=0:8x8dct=1 -g 100 -bf 2 -crf 22.8 -flags +ildct+ilme -top 1 -acodec copy -aspect 16:9 "%cd%\tempFFMPEG\tempVideoAudioFile.%ffEXT%"


    This generate a correct MP4 with video ID 1 and audio ID 2 that is fully conCat compatible with the one generate by the MAIN section of the batch == in teory is all concatenable but I need process with two lines, and possibly I would like to do in 1
    Quote Quote  
  4. ffmpeg and ffprobe start counting at 0. MediaInfo starts counting at 1.
    Quote Quote  
  5. jagabo cat please consider that:

    This is the source:

    https://www.dropbox.com/s/hjd72fs0ce68i5y/clipA.MXF?dl=0

    and this is the commandline that generate the Mp4(h264) whit 1 audio track (stereo L+R from original track 1 and 2 of the mxf source)
    Code:
    ffmpeg64bit332.exe -y -threads 12 -i clipA.MXF -filter_complex "[0:1] [0:2] amerge" -s 1920x1080 -r 25 -f mp4 -vf scale=interl=1,format=pix_fmts=yuv420p -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=1:rc_lookahead=1:chroma_qp_offset=0:8x8dct=1 -g 100 -bf 2 -crf 22.8 -flags +ildct+ilme -top 1 -c:a ac3 -b:a 320k -ar 48000 -aspect 16:9 out.mp4
    this out.mp4 plays correct but in the mediainfo I have:

    Code:
    General
    Complete name                            : V:\S\out.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media
    Codec ID                                 : isom
    File size                                : 10.6 MiB
    Duration                                 : 3s 200ms
    Overall bit rate                         : 27.7 Mbps
    Writing application                      : Lavf57.71.100
    
    Video
    ID                                       : 2
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L4.1
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 3s 200ms
    Bit rate                                 : 27.3 Mbps
    Width                                    : 1 920 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Constant
    Frame rate                               : 25.000 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : MBAFF
    Bits/(Pixel*Frame)                       : 0.527
    Stream size                              : 10.4 MiB (99%)
    Writing library                          : x264 core 152 r2851 ba24899
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=1 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=4 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=tff / bluray_compat=0 / constrained_intra=0 / bframes=2 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=0 / keyint=100 / keyint_min=10 / scenecut=40 / intra_refresh=0 / rc_lookahead=1 / rc=crf / mbtree=1 / crf=22.8 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
    
    Audio
    ID                                       : 1
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Mode extension                           : CM (complete main)
    Format settings, Endianness              : Big
    Codec ID                                 : ac-3
    Duration                                 : 3s 200ms
    Bit rate mode                            : Constant
    Bit rate                                 : 320 Kbps
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 16 bits
    Compression mode                         : Lossy
    Delay relative to video                  : 80ms
    Stream size                              : 125 KiB (1%)
    video ID = 2 and audio ID = 1 cannot allow the conCat with all the of MP4 generated by my batch with the MAIN routine (in wich Video ID = 1 and audio ID=2).

    I wonder if is there a way to encode this source (clipA.MXF) so that video ID =1 and audio ID = 2 so I can concatenate with all the rest of MP4
    Quote Quote  
  6. https://trac.ffmpeg.org/wiki/Map
    aazerty already showed it in his posts..
    Quote Quote  
  7. Originally Posted by sneaker View Post
    https://trac.ffmpeg.org/wiki/Map
    aazerty already showed it in his posts..
    Sorry I cannot find the post where is the answer. Maybe this?

    Originally Posted by aazerty View Post
    Hi ,
    ====
    In your post https://forum.videohelp.com/threads/384431-FFMPEG-why-I-cannot-f-concat-this-2-video-f...es#post2492154
    you can read :
    ---
    Input #0, concat, from 'concatlist.txt':
    Duration: N/A, start: -0.005333, bitrate: 32191 kb/s
    Stream #0:0(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 320 kb/s
    Metadata:
    handler_name : SoundHandler
    Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 31871 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
    Metadata:
    handler_name : VideoHandler
    ---
    => Stream #0:0(und): Audio
    => Stream #0:1(und): Video
    ====
    ====
    You can find , with : ffmpeg -i your-vid
    ====
    ====
    For changing ffmpeg -i your-vid -map 0:1 -map 0:0 .....
    => Stream #0:0(und): Video
    => Stream #0:1(und): Audio

    ====

    !!! NOTE : you must recode the quality of streams are not equal . !!!

    Cheers.
    Can someone tell me what is the commandline?

    I have try:

    Code:
    ffmpeg64bit332.exe -y -threads 12 -i clipA.MXF -map 0:1 -map 0:0 -filter_complex "[0:1] [0:2] amerge" -s 1920x1080 -r 25 -f mp4 -vf scale=interl=1,format=pix_fmts=yuv420p -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=1:rc_lookahead=1:chroma_qp_offset=0:8x8dct=1 -g 100 -bf 2 -crf 22.8 -flags +ildct+ilme -top 1 -c:a ac3 -b:a 320k -ar 48000 -aspect 16:9 out.mp4
    but this don't change the problem because video is on ID 2 and audio on ID 1:

    Code:
    General
    Complete name                            : V:\S\out.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media
    Codec ID                                 : isom
    File size                                : 10.6 MiB
    Duration                                 : 3s 200ms
    Overall bit rate                         : 27.7 Mbps
    Writing application                      : Lavf57.71.100
    
    Video
    ID                                       : 2
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L4.1
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 3s 200ms
    Bit rate                                 : 27.3 Mbps
    Width                                    : 1 920 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Constant
    Frame rate                               : 25.000 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : MBAFF
    Bits/(Pixel*Frame)                       : 0.527
    Stream size                              : 10.4 MiB (99%)
    Writing library                          : x264 core 152 r2851 ba24899
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=1 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=4 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=tff / bluray_compat=0 / constrained_intra=0 / bframes=2 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=0 / keyint=100 / keyint_min=10 / scenecut=40 / intra_refresh=0 / rc_lookahead=1 / rc=crf / mbtree=1 / crf=22.8 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
    
    Audio
    ID                                       : 1
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Mode extension                           : CM (complete main)
    Format settings, Endianness              : Big
    Codec ID                                 : ac-3
    Duration                                 : 3s 200ms
    Bit rate mode                            : Constant
    Bit rate                                 : 320 Kbps
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 16 bits
    Compression mode                         : Lossy
    Delay relative to video                  : 80ms
    Stream size                              : 125 KiB (1%)
    I don't need to change the initial MP4 files that I have post.
    My source is the attached MXF: it is from these that I should create the MP4 files that - which later - I need to concatenate
    .

    Please consider my source the MXF files, not the MP4
    Quote Quote  
  8. give filter_complex output node, e.g. [aout] , then call it in the -map

    Code:
    ffmpeg.exe -i clipA.MXF -s 1920x1080 -r 25 -vf scale=interl=1,format=pix_fmts=yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=1:rc_lookahead=1:chroma_qp_offset=0:8x8dct=1 -g 100 -bf 2 -crf 22.8 -flags +ildct+ilme -top 1 -c:a ac3 -b:a 320k -ar 48000 -filter_complex "[0:1] [0:2] amerge [aout]" -map 0:0 -map [aout] -aspect 16:9 output.mp4
    (you can call it [cat_out] if you want, I used [aout] for "audio out" )
    Quote Quote  
  9. Image
    [Attachment 42614 - Click to enlarge]


    oh ** ***

    but seems WORKS!

    for example: supposing C0056.MXF as a new MXF source like clipA.MXF:

    https://www.dropbox.com/s/2ys3jehrk7jwe3x/C0056.MXF?dl=0

    that have in audio track1 "britney spears" and in audio track 2 "Allegro Ft LV - Someone else"

    using:

    Code:
    ffmpeg.exe -i c0056.MXF -s 1920x1080 -r 25 -vf scale=interl=1,format=pix_fmts=yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=1:rc_lookahead=1:chroma_qp_offset=0:8x8dct=1 -g 100 -bf 2 -crf 22.8 -flags +ildct+ilme -top 1 -c:a ac3 -b:a 320k -ar 48000 -filter_complex "[0:1] [0:2] amerge [aout]" -map 0:0 -map [aout] -aspect 16:9 output.mp4
    finally video as ID 1

    and audio ID 2

    And in output there is only 1 audio track, stereo L+R (Allegro+Britney)

    thanks
    Quote Quote  



Similar Threads

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