for example: Trim(0, last.FrameCount)
but now I would like do this:
ChangeFPS( please avisynht use the source ramerate )
what command do this? thanks
+ Reply to Thread
Results 1 to 18 of 18
-
-
Think about what you're asking. It's already the "last" or source framerate. So it does nothing
ChangeFPS(last.framerate)
If you have other variables, like "clipA" , then it might change the value to clipA's framerate. So if you called original, original source "clipA" you could use
ChangeFPS(clipA.framerate) -
Code:
LoadCPlugin("v:\automazioneclip\core\yadif.dll") vid=FFVideoSource("C:\Users\Administrator\Desktop\Nuova cartella (22)\2canali.flv") aud=FFAudioSource("C:\Users\Administrator\Desktop\Nuova cartella (22)\2canali.flv") audioDub(vid,aud) ConvertAudioTo16Bit() ConvertToYUY2(interlaced=true)
I have try with
vid=FFVideoSource("C:\Users\Administrator\Desktop\ Nuova cartella (22)\2canali.flv").ChangeFPS(last.framerate)
or
vid=FFVideoSource("C:\Users\Administrator\Desktop\ Nuova cartella (22)\2canali.flv").ChangeFPS(vid.framerate)
or
vid=FFVideoSource("C:\Users\Administrator\Desktop\ Nuova cartella (22)\2canali.flv")
ChangeFPS(last.framerate)
but seems it get me an error when opening the avs, what is the correct sintax? thanks -
THERE IS NO LAST, THERE IS NOTHNIG
THERE IS NO VID, THERE IS NOTHING
THERE IS NO LAST, ONLY VID
That's just sad.
-Edit- you can't call a variable until after you've initialised it, not during, and that's the least of your problems. -
I should have a input file (C0003.mxf) that is NTSC 30 fps interlaced
I would like convert to 25 interlaced
Can anyone tell me if this script is correct?
Or in this case (interlace HD input --> interlaced SD output) what is the correct script to do a properly conversion? thanks
Code:Import("C:\Program Files\AviSynth\plugins\IcResize.avsi") LoadCPlugin("v:\automazioneclip\core\yadif.dll") FFVideoSource("v:\ntsc\c0003.mxf") ChangeFPS(30) aud=FFAudioSource("v:\ntsc\c0003.mxf") audioDub(aud) ConvertAudioTo16Bit() ConvertToYUY2(interlaced=true) ColorMatrix(mode="Rec.709->Rec.601") yadif(1,1) IResize(720,576) AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave() yadif(1,1) SmoothFPS2(50000,1000) AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave() AssumeFPS(25)
-
I think "the cat" might be asking about "last" as the previous video produced by a previous script ? ? Batch processing, is it not? Sometime it's really difficult to tell when you're trying to communicate with a cat.
This code from the earlier post makes no change in the framerate of "vid":
Code:vid=FFVideoSource("C:\Users\Administrator\Desktop\Nuova cartella (22)\2canali.flv") aud=FFAudioSource("C:\Users\Administrator\Desktop\Nuova cartella (22)\2canali.flv") audioDub(vid,aud)
As poisondeathray says, if you want to refer to the framerate of another video, you have to tell Avisynth where that other video is located and you have tell Avisynth to open that video. If you are trying to run scripts that match several incoming videos to the framerate of another video, you can have a reference video which has the framerate that you want. You can give that reference video a name such as "RefVid". Use code like this:
Code:RefVid=FFVideoSource("path to reference video with desired framerate\video_name") vid=FFVideoSource("C:\Users\Administrator\Desktop\Nuova cartella (22)\2canali.flv") aud=FFAudioSource("C:\Users\Administrator\Desktop\Nuova cartella (22)\2canali.flv") audioDub(vid,aud) # <----- the video created by this line of code is now known as "last" ChangeFPS(last, RefVid)
Code:AssumeFPS(last, RefVid, sync_audio=true)
Last edited by LMotlow; 2nd Nov 2014 at 09:58.
- My sister Ann's brother -
Interaced HD => interlaced SD was covered about 16 times in your previous threads, with many different options. I suggest you go look. I'm sick of writing the same thing
There is no "correct" way of doing it. They all have pros/cons.
I already mentioned this , but you're probably using the most dangerous , most unprofessional method. Blindly using optical flow (smoothFPS2) to generate "new frames" in a batch script is a recipe for disaster. It's too prone to artifacts. Unless you plan to manually go frame by frame and edit it later - doesn't make sense for batch. You're a lot safer with duplicates or blends for QC check with the broadcaster -
It is wrong. There was just a thread yesterday explaining you don't use yadif with iresize
.
.
.
WTF?
.
.
yadif(1,1)
IResize(720,576)
AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
.
.
yadif(1,1)
SmoothFPS2(50000,1000)
AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
WTF????!?!?!?!
I Give up..... -
yes :=) I'm a cat
Code:Import("C:\Program Files\AviSynth\plugins\IcResize.avsi") LoadCPlugin("v:\automazioneclip\core\yadif.dll") RefVid=FFVideoSource("v:\c0090.avi") # <----- the video created by this line of code is now known as "a pal target cat" vid=FFVideoSource("V:\ntsc\C0004.MXF") # <----- the video created by this line of code is now known as "my ntsc yellow cat" aud=FFAudioSource("V:\ntsc\C0004.MXF") # <----- the video created by this line of code is now known as "my ntsc yellow cat" audioDub(vid,aud) # <----- the video created by this line of code is now known as "last" AssumeFPS(last, RefVid, sync_audio=true) ConvertAudioTo16Bit() ConvertToYUY2(interlaced=true) ColorMatrix(mode="Rec.709->Rec.601") yadif(1,1) IResize (720,576) AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave() AssumeFPS(25)
this do a PERFECT ntsc --> pal mycat conversionLast edited by marcorocchini; 2nd Nov 2014 at 12:53.
-
Don't kid yourself. There is no such thing as "perfect" NTSC->PAL (or vice-versa).
Scott -
Yadif before IResize???????????????? I thought this guy should learn something after a...... month or more?
-
-
-
Cats don't need/use Yadif. Cats don't need/use IResize. Cats don't need/use ffmpeg. Cats don't need/use AVISynth. Cats don't need/use batch files.
Yet you do.
Therefore: you are not a cat, but seemingly an internet troll.
Maybe you don't realize this, but your continued antics are gradually alienating, antigonizing and repelling the very people who you are wanting to assist you (and who would be capable of helping).
Scott -
YES cat, you are in right
but there is anhother problem at the "initial": when I open a .mxf file in avisynth - in some files - seems that fps is not the correct fps
for example this:
https://www.dropbox.com/s/gjfks4k4pr3y55k/C0036.mxf?dl=0
In virtualdub I open directly the C0036.mxf (with the ffmpeg plugin for virtualdub) and it recognize all correctly
But if I do:
FFVideoSource("v:\C0036.mxf")
in avisynth ----> virtualdub show:
this is a big problem when treating files with "strange" framerate or in framerate conversions, and keeping audio etc..
Because I'm a cat I'm not able to solve the problem, but your fps script (slightly modifyed by me) [in your megascript], seems to be useful to get correct FPS when treating source that have to be FPS-changed
Resultant is: correct number of frames, correct FPS (outputted in %RealFPS%) also when the only FFVideoSource(input.mxf) pass to virtualdub the wrong fps
so that the line AssumeFPS(last, %RealFPS%) correct the problem
Code:@rem unless otherwise specified for debugging reasons turn echo off @if "%EMode%"=="" Set EMode=ON @ECHO %EMode% @ECHO off xcopy /y v:\automazioneclip\system\morgan\m3jpegHD.dll c:\windows\system32 xcopy /y v:\automazioneclip\system\morgan\MMIJG32.dll c:\windows\system32 xcopy /y v:\automazioneclip\system\morgan\m3jpegSD.dll c:\windows\system32 xcopy /y v:\automazioneclip\system\x264VFW.dll c:\windows\system32 xcopy /y v:\automazioneclip\system\pvmjpg40.dll c:\windows\system32 xcopy /y v:\automazioneclip\system\morgan\MMIJG30.dll c:\windows\system32 xcopy /y v:\automazioneclip\system\morgan\m3jpSD.INI c:\windows xcopy /y v:\automazioneclip\system\morgan\m3jpHD.ini c:\windows if exist c:\windows\SysWOW64 xcopy /y v:\automazioneclip\system\morgan\m3jpegHD.dll c:\windows\SysWOW64 if exist c:\windows\SysWOW64 xcopy /y v:\automazioneclip\system\morgan\MMIJG32.dll c:\windows\SysWOW64 if exist c:\windows\SysWOW64 xcopy /y v:\automazioneclip\system\morgan\m3jpegSD.dll c:\windows\SysWOW64 if exist c:\windows\SysWOW64 xcopy /y v:\automazioneclip\system\morgan\MMIJG30.dll c:\windows\SysWOW64 if exist c:\windows\SysWOW64 xcopy /y v:\automazioneclip\system\x264VFW.dll c:\windows\SysWOW64 if exist c:\windows\SysWOW64 xcopy /y v:\automazioneclip\system\pvmjpg40.dll c:\windows\SysWOW64 md c:\windows\spvideo xcopy /y v:\automazioneclip\system\wavdest.ocx c:\windows\spvideo xcopy /y v:\automazioneclip\system\SamplesDropper.ocx c:\windows\spvideo xcopy /y v:\automazioneclip\system\SP_audio.ocx c:\windows\spvideo xcopy /y v:\automazioneclip\system\dv_grabber.ocx c:\windows\spvideo xcopy /y v:\automazioneclip\system\SP_video.ocx c:\windows\spvideo regsvr32 /s c:\windows\spvideo\wavdest.ocx regsvr32 /s c:\windows\spvideo\SamplesDropper.ocx regsvr32 /s c:\windows\spvideo\SP_audio.ocx regsvr32 /s c:\windows\spvideo\dv_grabber.ocx regsvr32 /s c:\windows\spvideo\SP_video.ocx regedit /s v:\automazioneclip\system\VDreg.reg regedit /s v:\automazioneclip\system\PICreg.reg regedit /s v:\automazioneclip\system\drivers.reg cls SetLocal DisableDelayedExpansion Set "EXTLIST=*.*" Set "DoPop=0" Set "ARGLVL=0" Set "FileName-DQ=" Set VD_LOC="v:\automazioneclip\VirtualDub\vdub.exe" 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 NOT EXIST "v:\automazioneclip\system\empty.wav" ( echo v:\automazioneclip\system\empty.wav not Found! pause ) Set /a Count+=1 Set "FOUNDLVL=%STARTLVL%" SetLocal DisableDelayedExpansion if exist "%~dpn1.wav" ( set "Audio=%~dpn1.wav" ) else ( set "Audio=v:\automazioneclip\system\empty.wav") 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 ) for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdub\FFProbe -hide_banner -loglevel fatal -pretty -select_streams v:0 -show_streams "%~1"') DO ( if "%%~g"=="duration_ts" set "NumberOfFrame=%%~h") echo the variabile T_Company_Name assume this value "%T_Company_Name%" echo the variabile T_Product_Name assume this value "%T_Product_Name%" echo the variabile T_Product_Version assume this value "%T_Product_Version%" echo the variabile TIMECODE assume this value "%TIMECODE%" echo the variabile Frame_Rate assume this value "%Frame_Rate%" echo the variabile V_Width assume this value "%V_Width%" echo the variabile V_Height assume this value "%V_Height%" echo the variabile V_PAR assume this value "%V_PAR%" set /a "forVirtualDubAddRangeWhenDoubleFrameRate"=%NumberOfFrame%/2 echo the variabile NumberOfFrame assume this value "%NumberOfFrame%" so half is echo "%forVirtualDubAddRangeWhenDoubleFrameRate%" rem #### SEARCH for durations: advanced #### Set AUCount=0; Set VDCount=0; Set STCount=0; Set "V_Number_Of_Frames=" for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdub\FFProbe -hide_banner -loglevel fatal -pretty -show_format -show_streams "%~1" 2^>^&1') DO ( CALL :Process_Item "%%~g" "%%~h" ) if "%V_Time_Base%"=="" ( echo ERROR: V_Time_Base not found, impossibile rilevare il FrameRate pause) if NOT "%V_Time_Base%"=="" ( for /F "tokens=1,2 delims=/" %%g in ("%V_Time_Base%") do ( set "V_Time_Base_Denom=%%~g" set /a "V_Time_Base_Num=%%~h*10000" ) ) if "%V_Frame_Rate%"=="" ( echo ERROR: V_Frame_Rate, impossibile rilevare il FrameRate pause) if NOT "%V_Frame_Rate%"=="" ( for /F "tokens=1,2 delims=/" %%g in ("%V_Frame_Rate%") do ( set /a "V_Frame_Rate_Pure=%%~g" set "V_Frame_Rate_Denom_cat=%%~h*100" set /a "V_Frame_Rate_Num=%%~g*10000" set "V_Frame_Rate_Denom=%%~h" ) ) if "%V_Number_Of_Frames%"=="" Set /a "V_Number_Of_Frames=V_Duration/((V_Time_Base_Num/V_Time_Base_Denom)/(V_Frame_Rate_Num/V_Frame_Rate_Denom))" set /a "FPSforVirtualdubX2=%V_Number_Of_Frames%" set /a "FPSforVirtualdubdiv2=%V_Number_Of_Frames%/2" set "FPSforVirtualdub=%V_Number_Of_Frames%" rem #### calculate realFPS with 2 fps calculators echo WScript.Echo Eval^(WScript.Arguments^(0^)^)>"%~dp1FPScalculator1.vbs" echo Result=Replace^(Result,",","."^)>>"%~dp1FPScalculator1.vbs" echo WScript.Echo Result>>"%~dp1FPScalculator1.vbs" IF NOT "%V_Frame_Rate_Pure%"=="" IF NOT "%V_Frame_Rate_Denom%"=="" for /f %%n in ('cscript //nologo "%~dp1FPScalculator1.vbs" "%V_Frame_Rate_Pure%/%V_Frame_Rate_Denom%"') do (set RealFPS2temp=%%n) echo %RealFPS2temp%>"%~dp1RealFPS2temp.txt" v:\automazioneclip\system\fart.exe "%~dp1RealFPS2temp.txt" , "." set /p RealFPS2=<"%~dp1RealFPS2temp.txt" echo Numerator = WScript.Arguments^(0^)>"%~dp1FPScalculator2.vbs" echo Denom = WScript.Arguments^(1^)>>"%~dp1FPScalculator2.vbs" echo Result=Numerator/Denom>>"%~dp1FPScalculator2.vbs" echo WScript.Echo Result>>"%~dp1FPScalculator2.vbs" echo Result=Replace^(Result,",","."^)>>"%~dp1FPScalculator2.vbs" echo WScript.Echo Result>>"%~dp1FPScalculator2.vbs" echo Result=Round^(Numerator/Denom,2^)>>"%~dp1FPScalculator2.vbs" echo Result=Replace^(Result,",","."^)>>"%~dp1FPScalculator2.vbs" echo WScript.Echo Result>>"%~dp1FPScalculator2.vbs" setlocal ENABLEDELAYEDEXPANSION set fcount=1 IF NOT "%V_Frame_Rate_Pure%"=="" IF NOT "%V_Frame_Rate_Denom%"=="" FOR /F "tokens=* USEBACKQ" %%F IN (`cscript /nologo "%~dp1FPScalculator2.vbs" %V_Frame_Rate_Pure% %V_Frame_Rate_Denom%`) DO (set var!fcount!=%%F set /a fcount=!fcount!+1 ) rem echo %var1% rem echo %var2% rem echo %var3% echo %var2%>"%~dp1RealFPStemp.txt" endlocal set /p RealFPS=<"%~dp1RealFPStemp.txt" echo RealFPS is %RealFPS% echo RealFPS2 is %RealFPS2% if exist "%~dp1FPScalculator1.vbs" del "%~dp1FPScalculator1.vbs" if exist "%~dp1FPScalculator2.vbs" del "%~dp1FPScalculator2.vbs" if exist "%~dp1RealFPStemp.txt" del "%~dp1RealFPStemp.txt" if exist "%~dp1RealFPS2temp.txt" del "%~dp1RealFPS2temp.txt" if "%V_Width%"=="" ( echo ERROR: Video Width NOT FOUND! pause goto :eof ) if "%V_Height%"=="" ( echo ERROR: Video Height NOT FOUND! pause goto :eof ) if "%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% IF exist "%DestFolder%\unicodefile.txt" DEL "%DestFolder%\unicodefile.txt" IF exist "%DestFolder%\mediainfo.txt" DEL "%DestFolder%\mediainfo.txt" Set "TokenS=0" Set "isMXF=0" IF "%~x1"==".MXF" Set "TokenS=1" IF "%~x1"==".mxf" Set "TokenS=1" If "%TokenS%"=="1" Set "isMXF=1" 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") 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") 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" 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:"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") 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" 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%" 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") if "%isMXF%"=="1" if "%HDformat%"=="1" if "%Ch_Sub422%"=="yes" if "%PROGRESSIVE%"=="1" if "%doubleframrate%"=="1" (set "mxfHD422progressiveDoubleFrameRate=1") if "%fullHDinterlace%"=="1" (CALL :Make_File_HD2SDinterlace "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") if "%fullHDProgressive%"=="1" (CALL :Make_File_HD2SDProgressive "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") if "%mxfHD422progressiveDoubleFrameRate%"=="1" (CALL :Make_File_mxfHD422progressivemode50fps "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") if "%MXFXDCAM35or25_50fps_Progressive%"=="1" (CALL :Make_File_MXFXDCAM35or25_50fps_Progressive "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") if "%IMX%"=="1" (CALL :Make_File_IMX "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") if "%MXFXDCAMHQorSP25fpsinterlaced%"=="1" (CALL :Make_File_MXFXDCAMHQorSP25fpsinterlaced "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") if "%MXFXDCAMHQorSP25fpsProgressive%"=="1" (CALL :Make_File_MXFXDCAMHQorSP25fpsProgressive "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") if "%dvcam%"=="1" (CALL :Make_File_dvcam "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") rem *** check FOR GOPRO Set "TokenS=0" Set "MP4GOPRO=0" set "GoPROAVC=0" Set "gopro50fps=0" Set "gopro25fps=0" Set "gopro47fps=0" Set "goproProgressive=0" Set "gopro1920=0" Set "gopro1080=0" Set "GOpro1920x1080=0" IF "%~x1"==".MP4" Set "TokenS=1" IF "%~x1"==".mp4" Set "TokenS=1" If "%TokenS%"=="1" Set "isMP4=1" IF "%isMP4%"=="1" (v:\automazioneclip\virtualdub\mediainfo.exe "%CD%\%~n1.mp4" dumpinfo:unicodefile.txt TYPE unicodefile.txt>mediainfo.txt) findstr /c:"Title : GoPro AVC" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "GoPROAVC=1") if "%ismp4%"=="1" if "%Goproavc%"=="1" (set "MP4gopro=1") findstr /c:"Frame rate : 50.000 fps" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "gopro50fps=1") findstr /c:"Frame rate : 25.000 fps" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "gopro25fps=1") findstr /c:"Scan type : Progressive" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "goproProgressive=1") findstr /c:"Width : 1 920 pixels" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "gopro1920=1") findstr /c:"Height : 1 080 pixels" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "gopro1080=1") IF "%gopro1920%"=="1" IF "%gopro1080%"=="1" set "GOpro1920x1080=1" rem IF "%MP4gopro%"=="1" (CALL :MP4gopro_process "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") rem *** check FOR Generic Progressive or Interlaced 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 "%CD%\%~n1.avi" dumpinfo:unicodefile.txt TYPE unicodefile.txt>mediainfo.txt) findstr /c:"Codec ID : MJPG" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "AVImjpeg=1") if "%AVImjpeg%"=="1" (CALL :Make_File_AVImjpeg "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") rem *** redirect to generic PROGRESSIVE procedure IF "%ScanTypeProgressive%"=="1" if not "%AVImjpeg%"=="1" IF NOT "%MP4________________________gopro%"=="1" if not "%MXFXDCAM35or25_50fps_Progressive%"=="1" if not "%MXFXDCAMHQorSP25fpsProgressive%"=="1" if not "%fullHDinterlace%"=="1" if not "%fullHDProgressive%"=="1" if not "%mxfHD422progressiveDoubleFrameRate%"=="1" if not "%MXFXDCAMHQorSP25fpsinterlaced%"=="1" if not "%IMX%"=="1" CALL :Make_File_generic_PROGRESSIVE "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1" rem *** redirect to generic NON-PROGRESSIVE procedure (interlaced mbaaf ..) IF NOT "%ScanTypeProgressive%"=="1" if not "%AVImjpeg%"=="1" IF NOT "%MP4_____________________gopro%"=="1" if not "%MXFXDCAM35or25_50fps_Progressive%"=="1" if not "%MXFXDCAMHQorSP25fpsProgressive%"=="1" if not "%fullHDinterlace%"=="1" if not "%fullHDProgressive%"=="1" if not "%mxfHD422progressiveDoubleFrameRate%"=="1" if not "%MXFXDCAMHQorSP25fpsinterlaced%"=="1" if not "%IMX%"=="1" CALL :Make_File_generic_INTERLACED "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1" IF exist "%DestFolder%\unicodefile.txt" DEL "%DestFolder%\unicodefile.txt" IF exist "%DestFolder%\mediainfo.txt" DEL "%DestFolder%\mediainfo.txt" echo FATTO echo. echo --------------------------------------------- echo. EndLocal goto :eof :Process_Item <item_field> <item_data> color if "%~2"=="N/A" goto :eof if "%~1"=="[/STREAM]" ( set "CType=" goto :eof ) if "%~1"=="[/FORMAT]" ( set "CType=" goto :eof ) if "%~1"=="[FORMAT]" ( set "CType=FORMAT" goto :eof ) if "%~1"=="index" Set "cur_index=%~2" if "%~1"=="codec_name" Set "cur_codec=%~2" if "%~1"=="codec_type" ( if "%~2"=="audio" ( set /a AUCount+=1 set "CType=audio" ) if "%~2"=="video" if NOT "%cur_codec%"=="mjpeg" ( Set /a VDCount+=1 set "CType=video" ) if "%~2"=="subtitle" ( Set /a STCount+=1 set "CType=subtitle" ) goto :eof ) if "%CType%"=="FORMAT" ( if "%~1"=="TAG:company_name" set "T_Company_Name=%~2" if "%~1"=="TAG:product_name" set "T_Product_Name=%~2" if "%~1"=="TAG:product_version" set "T_Product_Version=%~2" if "%~1"=="TAG:timecode" set "TIMECODE=%~2" goto :eof ) if "%CType%"=="video" ( if %VDCount% GTR 1 ( echo Multiple Video Streams!!!! pause ) if "%~1"=="time_base" set "V_Time_Base=%~2" if "%~1"=="r_frame_rate" set "V_Frame_Rate=%~2" if "%~1"=="duration_ts" set "V_Duration=%~2" if "%~1"=="width" set "V_Width=%~2" if "%~1"=="height" set "V_Height=%~2" if "%~1"=="sample_aspect_ratio" set "V_PAR=%~2" if "%~1"=="nb_frames" set "V_Number_Of_Frames=%~2" goto :eof ) goto :eof :MP4gopro_process <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME> color d cls echo *** ____ MP4gopro ____ to MorganMJPEG AVI SD 720x576 interlacciato 25 fps using Avisynth+Virtualdub *** timeout /t 4 rem *** TRY to test if input file have or not audio *** if exist "%WorkFolder%\TESTonly.wav" del "%WorkFolder%\TESTonly.wav" v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -ss 00:00:00 -t 00:00:10 -filter_complex "[0:1] volume=1.5" "%WorkFolder%\TESTonly.wav" for %%v in ("TESTonly.wav") do ( if %%~zv LSS 128 ( del "%WorkFolder%\TESTonly.wav" ) ) Set "TokenS=0" Set "audioInsideFileExist=0" if exist "%WorkFolder%\TESTonly.wav" set "audioInsideFileExist=1" del "%WorkFolder%\TESTonly.wav" IF "%audioInsideFileExist%"=="1" set "AudioFile=%4" IF NOT "%audioInsideFileExist%"=="1" set AudioFile="v:\automazioneclip\system\empty.wav" echo PROCESSING %4 if not "%FPSforVirtualdub%"=="0" (set /a "newFPSforVirtualdub=%FPSforVirtualdub%-1") else (set "newFPSforVirtualdub=0") echo FrameCount %newFPSforVirtualdub% rem ***Make The .vcf Script File*** 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^(0x6a6d7674,0,10000,0^)^;>>%1 echo VirtualDub.video.SetCompData^(28,"TUpQRxgAAAAAAAAAAgAAAAgAAAACAAAAAQAAAA=="^)^;>>%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_SD.avi"^);>>%1 echo VirtualDub.Close^(^);>>%1 rem ***Make The .avs Script File*** echo Import^("C:\Program Files\AviSynth\plugins\IcResize.avsi"^)>%2 echo vid=FFVideoSource^(%4^)>>%2 echo aud=FFAudioSource^(%4^)>>%2 echo left = GetChannel^(aud, 1^)>>%2 echo right = GetChannel^(aud, 1^)>>%2 echo both=mergechannels^(left, right^)>>%2 echo audioDub^(vid,both^)>>%2 echo ConvertAudioTo16Bit^(^)>>%2 echo ConvertToYUY2^(interlaced=false^)>>%2 rem echo ColorYUV^(levels="PC->TV"^)>>%2 rem echo ColorYUV^(gamma_y=-7, gamma_u=-7, gamma_v=-7^)>>%2 echo LanczosResize^(720,576^)>>%2 if "%gopro50fps%"=="1" echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave().Trim^(0,%newFPSforVirtualdub%^)>>%2 if "%gopro50fps%"=="1" echo AssumeFPS^(25^)>>%2 if NOT "%gopro50fps%"=="1" echo SmoothFPS2^(50000,1000^)>>%2 if NOT "%gopro50fps%"=="1" echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave().trim^(0,%newFPSforVirtualdub%^)>>%2 if NOT "%gopro50fps%"=="1" echo AssumeFPS^(25^)>>%2 echo processing source file %4 rem ***Call VirtualDub*** if NOT EXIST %VD_LOC% ( echo Um, where the hell is VirtualDubMod? pause ) %VD_LOC% /min %2 /s %1 for %%v in ("%DestFolder%\\%~n1_SD.avi") do ( if %%~zv LSS 128 ( echo ERROR!!! Extra Small File Size Detected!!! pause ) ) v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG v:\automazioneclip\core\ffmpeg.exe -y -i "%~dp1%~n1.avs" -filter_complex "[0:1] volume=1.5" -c:a pcm_s16le "%~dp1%~n1_SD.wav" DEL "%DestFolder%\*.ffindex" DEL "%~dp1%~n1.vcf" DEL "%~dp1%~n1.avs" 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_SD.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_SD.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 goto :eof :Make_File_generic_INTERLACED <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME> echo inizio routine GENERIC INTERLACED GENERIC INTERLACED GENERIC INTERLACED GENERIC INTERLACED GENERIC INTERLACED GENERIC INTERLACED GENERIC INTERLACED GENERIC INTERLACED GENERIC INTERLACED GENERIC INTERLACED GENERIC INTERLACED GENERIC INTERLACED color e timeout /t 2 findstr /c:"Frame rate mode : Variable" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "variableFrameRate=1") rem *** TRY to test if input file have or not audio *** if exist "%~dp1TESTonly.wav" del "%~dp1TESTonly.wav" v:\automazioneclip\core\ffmpeg.exe -y -i %4 -ss 00:00:00 -t 00:00:10 -af "pan=stereo:c0=c0:c1=c1,volume=1.5" -c:a pcm_s16le -ar 48000 "%~dp1TESTonly.wav" for %%v in ("%~dp1TESTonly.wav") do ( if %%~zv LSS 128 ( del "%~dp1TESTonly.wav" ) ) Set "TokenS=0" Set "audioInsideFileExist=0" if "%isMXF%"=="1" if exist "%WorkFolder%\TESTonly.wav" set "audioInsideFileExist=1" if exist "%WorkFolder%\TESTonly.wav" del "%WorkFolder%\TESTonly.wav" IF "%audioInsideFileExist%"=="1" set "AudioFile=%4" IF NOT "%audioInsideFileExist%"=="1" set AudioFile="v:\automazioneclip\system\empty.wav" Set "genericProgressive=0" Set "genericInterlaced=0" Set "Morgan1088=0" v:\automazioneclip\virtualdub\mediainfo.exe %4 dumpinfo:unicodefile.txt TYPE unicodefile.txt>mediainfo.txt findstr /c:"Scan type : Progressive" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "genericProgressive=1") findstr /c:"Scan type : Interlaced" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "genericInterlaced=1") findstr /c:"Frame rate : 50.000 fps" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "genericFPS50=1") findstr /c:"Frame rate : 25.000 fps" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "genericFPS25=1") findstr /c:"Scan type : MBAFF" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "MBAAF=1") findstr /c:"Original height : 1 088 pixels" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "Morgan1088=1") findstr /c:"Width : 1 920 pixels" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "generic1920=1") findstr /c:"Height : 1 080 pixels" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "generic1080=1") findstr /c:"Width : 720 pixels" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "generic720=1") findstr /c:"Width : 576 pixels" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "generic576=1") findstr /c:"Width : 608 pixels" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "generic608=1") findstr /c:"Commercial name : IMX" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "IMX=1") Set "TokenS=0" IF "%generic1920%"=="1" Set "TokenS=1" IF "%generic1080%"=="1" Set "TokenS=1" IF "%TokenS%"=="1" Set "generic1920x1080=1" Set "TokenS=0" IF "%generic720%"=="1" Set "TokenS=1" IF "%generic576%"=="1" Set "TokenS=1" IF "%TokenS%"=="1" Set "generic720x576=1" Set "TokenS=0" IF "%generic720%"=="1" Set "TokenS=1" IF "%generic608%"=="1" Set "TokenS=1" IF "%TokenS%"=="1" Set "genericIMX=1" echo PROCESSING %4 echo *** from various format to MorganMJPEG AVI SD 720x576i@25fps using Avisynth+Virtualdub *** rem ***Make The .vcf Script File*** 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^(0x6a6d7674,0,10000,0^);>>%1 echo VirtualDub.video.SetCompData^(28,"TUpQRxgAAAAAAAAAAgAAAAgAAAACAAAAAQAAAA=="^);>>%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_gen_SD.avi"^);>>%1 echo VirtualDub.Close^(^);>>%1 rem #### Make The .AVS Script File #### echo Import^("C:\Program Files\AviSynth\plugins\IcResize.avsi"^)>%2 echo LoadCPlugin("v:\automazioneclip\core\yadif.dll")>>%2 echo vid=FFVideoSource^(%4^)>>%2 echo aud=FFAudioSource^(%AudioFile%^)>>%2 echo audioDub^(vid, aud^)>>%2 IF not "%RealFPS%"=="" echo AssumeFPS^(last, %RealFPS%^)>>%2 echo ConvertAudioTo16Bit^(^)>>%2 echo ConvertToYUY2^(interlaced=true^)>>%2 if "%dvcam%"=="1" echo ReverseFieldDominance^(^)>>%2 IF "%Morgan1088%"=="1" echo crop^(0,0,1920,1080^)>>%2 IF "%V_Q%"=="IMX" echo crop^(0,32,0,0^)>>%2 IF "%V_Q%"=="HD" echo colorMatrix^(mode="Rec.709->Rec.601"^)>>%2 echo yadif^(1,1^)>>%2 echo SmoothFPS2^(50000,1000^)>>%2 echo AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()>>%2 echo assumefps^(25^)>>%2 echo Trim^(0, last.FrameCount-1^)>>%2 rem *** extract audio passed by avisynth *** Set "TokenS=0" IF "%~x4"==".MXF" Set "TokenS=1" IF "%~x4"==".mxf" Set "TokenS=1" IF "%TokenS%"=="1" Set "is_a_MXF_File=1" v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i "%~dp1%~n1.avs" -af "pan=stereo:c0=c0:c1=c1,volume=1.5" -c:a pcm_s16le -ar 48000 "%~dp1%~n1_gen_SD.wav" rem ################################## provare ad usare questa stringa sottostante nel caso l'audio passato da avisynth abbia problemi, magari provare a togliere il parametro -ac 2 rem v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:1] volume=1.5" -ac 2 -c:a pcm_s16le -ar 48000 "%~dp1%~n1_ffmpegaltro_SD.wav" for %%v in ("%~dp1%~n1_gen_SD.wav") do ( if %%~zv LSS 128 ( echo ERROR!!! Extra Small File Wav Size Detected!!! timeout /t 5 del "%DestFolder%\%~n1_gen_SD.wav" ) ) rem ***Call VirtualDub*** if NOT EXIST %VD_LOC% ( echo Um, where the hell is VirtualDubMod? pause ) %VD_LOC% /min %2 /s %1 for %%v in ("%DestFolder%\\%~n1_gen_SD.avi") do ( if %%~zv LSS 128 ( echo ERROR!!! Extra Small File Size Detected!!! pause ) ) v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_gen_SD.avi" -u MJPG -d MJPG if exist timecodes.txt del timecodes.txt DEL "%DestFolder%\*.ffindex" DEL "%~dp1%~n1.vcf" rem DEL "%~dp1%~n1.avs" v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_gen_SD.avi" -u MJPG -d MJPG 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_gen_SD.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_gen_SD.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 IF NOT "%audioInsideFileExist%"=="1" echo attenzione_sembra_nessun_audio>"%~dp1%~n1ATTENZIONE_AudioNonEsistente_o_AudioNonTrovatoConProceduraStandard.txt" timeout /t 1 goto :eof goto :eof :Make_File_AVImjpeg <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME> cls echo *** from AVI MJPEG input file to MorganMJPEG AVI SD 720x576i@25fps using Avisynth+Virtualdub *** timeout /t 4 Set "Morgan1088=0" v:\automazioneclip\virtualdub\mediainfo.exe %4 dumpinfo:unicodefile.txt TYPE unicodefile.txt>mediainfo.txt findstr /c:"Original height : 1 088 pixels" "mediainfo.txt" IF NOT ERRORLEVEL 1 (set "Morgan1088=1") if exist "%~dpn1.wav" copy "%~dpn1.wav" "%~dpn1_SD.wav" if exist "%~dpn1ch3ch4.wav" copy "%~dpn1.wav" "%~dpn1ch3ch4_SD.wav" if not exist "%~dpn1.wav" copy "v:\automazioneclip\system\empty.wav" "%~dpn1_SD.wav" if not exist "%~dpn1ch3ch4.wav" copy "v:\automazioneclip\system\empty.wav" "%~dpn1ch3ch4_SD.wav" rem ***Make The .vcf Script File*** 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^(0x6a6d7674,0,10000,0^);>>%1 echo VirtualDub.video.SetCompData^(28,"TUpQRxgAAAAAAAAAAgAAAAgAAAACAAAAAQAAAA=="^);>>%1 echo VirtualDub.video.filters.Clear^(^);>>%1 echo VirtualDub.video.filters.Add^("deinterlace"^);>>%1 echo VirtualDub.video.filters.instance[0].Config^(0,1,1^);>>%1 echo VirtualDub.video.filters.Add^("resize"^);>>%1 echo VirtualDub.video.filters.instance[1].Config^(720,576,0,4,3,0,320,240,4,3,0,135,1,0x000000^);>>%1 echo VirtualDub.video.filters.Add^("interlace"^);>>%1 echo VirtualDub.video.filters.instance[2].Config^(0, 0^);>>%1 echo VirtualDub.audio.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_SD.avi"^);>>%1 echo VirtualDub.Close^(^);>>%1 rem ***Make The .avs Script File*** echo Import("C:\Program Files\AviSynth\plugins\IResize.avsi")>%2 echo AVIsource^(%4^)>>%2 echo ConvertToYUY2^(interlaced=true^)>>%2 IF "%Morgan1088%"=="1" echo crop^(0,0,1920,1080^)>>%2 echo src = last >>%2 echo src = src.width==720^&^&src.height==608?src.crop^(0,32,0,0^):src >>%2 echo src = src.width^>720 ^|^| src.height^>608?src.ColorMatrix^(mode="Rec.709->Rec.601"^): src >>%2 echo src.width!=720 ^|^| src.height!=576 ? src.IResize^(720,576^): src >>%2 if "%Frame_Rate%" == "50/1" echo AssumeTFF^(^).SeparateFields^(^).SelectEvery^(4,0,3^).Weave^(^) >>%2 echo AssumeFPS^(25^)>>%2 echo processing source file %4 rem ***Call VirtualDub*** if NOT EXIST %VD_LOC% ( echo Um, where the hell is VirtualDubMod? pause ) %VD_LOC% /min %2 /s %1 for %%v in ("%DestFolder%\\%~n1_SD.avi") do ( if %%~zv LSS 128 ( echo ERROR!!! Extra Small File Size Detected!!! pause ) ) v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG DEL "%DestFolder%\*.ffindex" DEL "%DestFolder%\*.VCF" DEL "%DestFolder%\*.avs" v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG IF exist "%DestFolder%\unicodefile.txt" DEL "%DestFolder%\unicodefile.txt" IF exist "%DestFolder%\mediainfo.txt" DEL "%DestFolder%\mediainfo.txt" goto :eof :GetTargetName color Set "FileName=" Set /p FileName=InputFileName .mxf .mp4 or .avi or InputFolder - INVIO per convertire tutto (EXIT esce): rem Add or remove double-quotes if necessary if NOT DEFINED FileName ( Set "FileName-DQ=" goto :DQSkip ) Set "FileName-DQ=%FileName:"=%" if NOT DEFINED FileName-DQ ( Set "FileName=" Set "FileName-DQ=" goto :DQSkip ) if EXIST "%FileName-DQ%" ( if "%FileName-DQ%"=="%FileName-DQ: =%" ( Set "FileName=%FileName-DQ%" ) else ( Set FileName="%FileName-DQ%" ) ) :DQSkip 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
-
this is my source NTSC HD 1920x1080 interlaced "30" fps
https://www.dropbox.com/s/scno3zjczncabq9/C0004.MXF?dl=0
I try to do a proper conversion to PAL 720x576 interlaced using the disputed SmoothFPS2
with this script (generate by the batch)
Code:LoadCPlugin("v:\automazioneclip\core\yadif.dll") vid=FFVideoSource("V:\ntsc\C0004.MXF") aud=FFAudioSource("V:\ntsc\C0004.MXF") audioDub(vid, aud) AssumeFPS(last, 29.97002997003) ConvertAudioTo16Bit() ConvertToYUY2(interlaced=true) colorMatrix(mode="Rec.709->Rec.601") yadif(1,1) SmoothFPS2(50000,1000) AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave() assumefps(25) Trim(0, last.FrameCount-1)
The Line
Code:AssumeFPS(last, 29.97002997003)
and is for to get the same FPS and lenght like opening it directly in virtualdub, in this case 29,97 fps / 35,37 seconds
Seems to me that the "best" resize is the resize of virtualdub: so open this .avs and encode in virtualdub using filter
1)deinterlace
2)resize
3)interlace
result seems to me very good, but there some distortion, slightly attenuated, but not solved modifyng the SmoothFPS2.avsi this way:
Code:function SmoothFPS2(clip source, int num, int den) { super = MSuper(source, pel=2, hpad=0, vpad=0, rfilter=4) backward_1 = MAnalyse(super, chroma=false, isb=true, blksize=32, searchparam=3, plevel=0, search=3, badrange=(-24)) forward_1 = MAnalyse(super, chroma=false, isb=false, blksize=32, searchparam=3, plevel=0, search=3, badrange=(-24)) backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, searchparam=1, search=3) forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, searchparam=1, search=3) backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=4, searchparam=0, search=3) forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=4, searchparam=0, search=3) MBlockFps(source, super, backward_3, forward_3, num, den, mode=0)}