VideoHelp Forum




+ Reply to Thread
Results 1 to 15 of 15
  1. Hi,


    I have this backgroud HD 1920x1080
    Image
    [Attachment 86464 - Click to enlarge]


    now I would add with alpha channel
    the foto portait this:

    Image
    [Attachment 86465 - Click to enlarge]


    so that this is added in the background and in key.

    How can I do with ffmpeg or avisynty? many thanks

    the final show have to be HD 1920 1080 16:9
    Last edited by marcorocchini; 5th Apr 2025 at 10:57.
    Quote Quote  
  2. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Do i understand you have a video of the background and you wish the image overlaid on top? What do you mean by alpha channel?
    Quote Quote  
  3. Overlay(background, foreground, x=???, y=???)

    http://www.avisynth.nl/index.php/Overlay
    Quote Quote  
  4. Hi, the poor cat need help

    possible, if possible with ffmpeg

    this is a selfie of me in portrait

    Image
    [Attachment 86507 - Click to enlarge]


    and this is my background

    Image
    [Attachment 86509 - Click to enlarge]


    Simple a need one output.jpg with the background + (centered) mecat.jpg overlayed
    so that the edges of my photo above and below completely cover the frame leaving space only on the sides (ffmpeg with -2 with or eight?)

    target result should be 1920x1080 16:9

    how can I do?
    Quote Quote  
  5. Code:
    clip1=ImageSource("C:\Users\Administrator\Desktop\Nuova cartella (4)\ALL_Background_1\mecatBKGRND_1.JPG")
    clip2=ImageSource("C:\Users\Administrator\Desktop\Nuova cartella (4)\ALL_Orig_JPG_HD\mecat.jpg")
    Overlay(clip1, clip2, x=540, y=0)

    but is there a way to tell to avisynth that have consider x = (?) so that everything go to the center?

    and how can I tell to avisynth it have to output as YUV and ever in RGB?
    Quote Quote  
  6. Originally Posted by marcorocchini View Post
    but is there a way to tell to avisynth that have consider x = (?) so that everything go to the center?
    It's simple algebra.

    Originally Posted by marcorocchini View Post
    and how can I tell to avisynth it have to output as YUV and ever in RGB?
    ConvertTo...()

    You know all this stuff already. Just use your head a little.
    Quote Quote  
  7. Code:
    It's simple algebra.
    yes , but i'm a cat inside a batch

    is there a way to tell to avisynth that have to locate image on the center even if portrait o landscape and that it have to be resize at least to the corner of the frame?
    Quote Quote  
  8. Originally Posted by marcorocchini View Post
    is there a way to tell to avisynth that have to locate image on the center even if portrait o landscape and that it have to be resize at least to the corner of the frame?
    Yes. Again, it's just some simple logic and algebra.
    Quote Quote  
  9. ok thanks, but I'm a Limited B***n C*t

    what I can do.

    Howerver if there is a way to tell to avisynth that should automatically center my foreground image with alwais resizing and covering as much of the frame as possible, starting from the center of the screen, whether it is a portrait, landscape or square image
    Quote Quote  
  10. I wonder: is it possible to place the foreground image so that it placed started from the center of the frame and cover all the area possible of the frame?
    Quote Quote  
  11. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    You ought to already understand this, but I will mention it anyway...


    Just like when sizing/scaling to a display that has a different aspect ratio, if you are trying to overlay 2 images/videos, and they are different in aspect ratio from each other, you must compromise SOMETHING!

    This is true if, for example, you are overlaying a portrait-oriented image over a landscape-oriented background. Just like you mentioned.

    You must either:
    1. Stretch (one or the other, depending on your needs), to match aspect ratio & size.
    2. Zoom & crop (one or the other), to match aspect ratio & size.
    3. Leave as is, & crop if necessary, and leave empty elements and/or bars in the area where they do not match size.
    4. A mixture of the 3.
    5. You could also stretch non-linearly (where you might have no or little stretching in the center, but more stretching towards the edges).

    Pick your poison.


    Scott
    Quote Quote  
  12. Here's how you would center the foreground image over a background image (pillarboxing):

    Say you have a background image that is background.width pixels wide, and you want to overlay a foreground image that is foreground.width pixels wide. When background.width is wider than foreground.width you know you will need (background.width-foreground.width) pixels of pillarboxing. If you want the foreground image centered on the background image you want half the pillarboxing one the left and half on the right. So you would use (background.width-foreground.width)/2 as the X position for the Overlay.
    Code:
    Overlay(background, foreground, x=(background.width-foreground.width)/2)
    For example if your background image is 1920x1080, and the foreground image is 608x1080, then the x position to center the overlay is (1920-608)/2, or 656. You will get 656 pixels of background on the left, 608 pixel of the foreground image in the center, then 656 pixels of the background on the right.
    Quote Quote  
  13. Image
    [Attachment 86537 - Click to enlarge]


    Code:
    :staticImageOnly <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    echo entered in staticImageOnly routine
    
    
    if exist stringaNomeFile.txt del stringaNomeFile.txt
    if exist stringaNomeFile2.txt del stringaNomeFile2.txt
    
    echo processing %~n1
    echo "%~n1_">stringaNomeFile.txt
    TYPE stringaNomeFile.txt>stringaNomeFile2.txt
    
    
    
    \fart.exe -i stringaNomeFile2.txt "\"" ""
    \fart.exe stringaNomeFile2.txt " " --remove
    \fart.exe stringaNomeFile2.txt : --remove
    \fart.exe stringaNomeFile2.txt / --remove
    \fart.exe stringaNomeFile2.txt \ --remove
    \fart.exe stringaNomeFile2.txt ^ --remove
    \fart.exe stringaNomeFile2.txt @ --remove
    \fart.exe stringaNomeFile2.txt $ --remove
    \fart.exe stringaNomeFile2.txt % --remove
    \fart.exe stringaNomeFile2.txt & --remove
    \fart.exe stringaNomeFile2.txt ( --remove
    \fart.exe stringaNomeFile2.txt = --remove
    \fart.exe stringaNomeFile2.txt + --remove
    \fart.exe stringaNomeFile2.txt ; --remove
    \fart.exe stringaNomeFile2.txt [ --remove
    \fart.exe stringaNomeFile2.txt ] --remove
    \fart.exe stringaNomeFile2.txt { --remove
    \fart.exe stringaNomeFile2.txt } --remove
    \fart.exe stringaNomeFile2.txt "\>" --remove
    \fart.exe stringaNomeFile2.txt < --remove
    \fart.exe stringaNomeFile2.txt * --remove
    \fart.exe stringaNomeFile2.txt # --remove
    \fart.exe stringaNomeFile2.txt ù --remove
    \fart.exe stringaNomeFile2.txt à --remove
    \fart.exe stringaNomeFile2.txt è --remove
    \fart.exe stringaNomeFile2.txt ! --remove
    \fart.exe stringaNomeFile2.txt . --remove
    \fart.exe stringaNomeFile2.txt , --remove
    \fart.exe stringaNomeFile2.txt - --remove
    
    
    set /p fileNameClean=<stringaNomeFile2.txt
    
    if exist stringaNomeFile.txt del stringaNomeFile.txt
    if exist stringaNomeFile2.txt del stringaNomeFile2.txt
    
    if exist tmp.ps1 del tmp.ps1
    
    rem MASSIMO A 31 **********
    
    echo $InStuff = @(>tmp.ps1
    echo      '%fileNameClean%'>>tmp.ps1
    echo       )>>tmp.ps1
    echo  $MaxLen = 31>>tmp.ps1
    echo  $MaxIndex = $MaxLen ^- ^1>>tmp.ps1
    echo  $InStuff ^|>>tmp.ps1
    echo      ForEach-Object {>>tmp.ps1
    echo          -join $_[0..$MaxIndex]>>tmp.ps1
    echo          }>>tmp.ps1
    
    if exist outputStringMaxLenght37Char.txt del outputStringMaxLenght37Char.txt
    
    Powershell.exe -executionpolicy remotesigned -File tmp.ps1>outputStringMaxLenght37Char.txt
    
    if exist tmp.ps1 del tmp.ps1
    
    
    \fart.exe -i outputStringMaxLenght37Char.txt "\"" --remove
    set /p outputStringMaxLenght37Char=<outputStringMaxLenght37Char.txt
    if exist outputStringMaxLenght37Char.txt del outputStringMaxLenght37Char.txt
    echo file finale assume %outputStringMaxLenght37Char%
    
    
    
    
    
    
    
    
    
    powershell -command New-Item -ItemType Directory -Force -Path %outputStringMaxLenght37Char%
    
    
    echo outputStringMaxLenght37Char assume %outputStringMaxLenght37Char%
    
    if not exist "%outputStringMaxLenght37Char%" echo tuttavia la cartella %outputStringMaxLenght37Char% non viene generata
    md "%outputStringMaxLenght37Char%"
    if exist "%outputStringMaxLenght37Char%" echo ora generata
    
    
    
    	for /f "tokens=1,2 delims=^=" %%g in ('\ffprobe64bit333.exe -hide_banner -loglevel fatal -pretty -select_streams v:0 -show_streams -show_entries stream^=codec_type^,r_frame_rate^,width^,height^,display_aspect_ratio^,duration_ts^,sample_aspect_ratio:stream_disposition^=:format_tags^=timecode^,company_name^,product_name^,product_version^,com.android.capture.fps %4 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:com.android.capture.fps" set "TAG_RealFrameRate=%%~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"=="display_aspect_ratio" set "V_DAR=%%~h"
                     if "%%~g"=="duration_ts" set "NumberOfFrame=%%~h"
    		 if "%%~g"=="codec_type" if "%%~h"=="audio" set /a AUCount+=1
                     
    	) 
    
    
    
    
    
    echo V_PAR assume %V_PAR%
    echo V_DAR assume %V_DAR%
    
    echo proporzione %V_PAR%/%V_DAR%
    
    
    
            set "quotientImage=0"
            set "necessarioImagingFuzzy=0"
       
            Set /a "quotientImage=%V_Width%/%V_Height%
            echo quotientImage assume %quotientImage%
    
    
    
            if %quotientImage% LSS 1 Set "necessarioImagingFuzzy=1" & echo necessarioImagingFuzzy
    
    echo necessarioImagingFuzzy assume %necessarioImagingFuzzy%
    
    IF "%necessarioImagingFuzzy%"=="0" echo la immagine e' piu larga che lunga
    IF "%necessarioImagingFuzzy%"=="1" echo la immagine e' piu lunga che larga
    
    
    
    
    
    
    rem SET "_INPUT_FILE=%~n1%~x1"
    
    
    set landscape=0
    set portrait=0
    set square=0
    
    for /F "delims=" %%I in ('\ffprobe64bit2022.exe -v error -select_streams v:0 -show_entries stream^=width -of default^=noprint_wrappers^=1:nokey^=1 %4 2^>^&1') do set /A "CTRL_WIDTH=%%I"
    echo Width is: [%CTRL_WIDTH%]
    
    for /F "delims=" %%I in ('\ffprobe64bit2022.exe -v error -select_streams v:0 -show_entries stream^=height -of default^=noprint_wrappers^=1:nokey^=1 %4 2^>^&1') do set /A "CTRL_HEIGHT=%%I"
    echo Height is: [%CTRL_HEIGHT%]
    echo.
    IF %CTRL_WIDTH% GTR %CTRL_HEIGHT% set landscape=1
    IF %CTRL_WIDTH% LSS %CTRL_HEIGHT% set portrait=1
    IF %CTRL_WIDTH% EQU %CTRL_HEIGHT% set square=1
    
    
    
    
    
    
    
    
    
    set HValue=-2
    set WValue=-2
    IF "%necessarioImagingFuzzy%"=="1" set HValue=6000
    IF NOT "%necessarioImagingFuzzy%"=="1" set WValue=6000
    
    
    
    
    rem if exist "%fileNameClean%_BACKGROUND1.JPG" del "%fileNameClean%_BACKGROUND1.JPG"
    
    echo t4 assume %4
    
    if exist generaBackground.avs del generaBackground.avs
    if exist generaBackground2.avs del generaBackground2.avs
    if exist generaBackground3.avs del generaBackground3.avs
    if exist "%CD%\TGAREF.TGA"  del "%CD%\TGAREF.TGA" 
    if exist "%CD%\TGAREF.TGA.lwi"  del "%CD%\TGAREF.TGA.lwi"
    
    
    rem \ffmpeg2019.exe -y -i %4 -vf format=bgra -c:v targa -frames:v 1 -rle 0 "%CD%\TGAREF.TGA" 
    
    
    
    if exist realINPUTfilename33.txt del realINPUTfilename33.txt
    rem SET Quoted="%CD%\TGAREF.TGA"
    
    SET Quoted=%4
    
    
    FOR /F "delims=" %%I IN (%Quoted%) DO SET FileNameUnquoted=%%I
    echo %FileNameUnquoted%>realINPUTfilename33.txt
    set /p newINPUTfilename5=<realINPUTfilename33.txt
    echo newINPUTfilename5 assume %newINPUTfilename5%
    if exist realINPUTfilename33.txt del realINPUTfilename33.txt
    xcopy /y "\generaBackground.avs" "%cd%"
    xcopy /y "\generaBackground2.avs" "%cd%"
    xcopy /y "\caricaImmagine.avs" "%cd%"
    xcopy /y "\caricaImmagine2.avs" "%cd%"
    xcopy /y "\caricaImmagine3.avs" "%cd%"
    
    xcopy /y "\generaBackground3.avs" "%cd%"
    
    \fart.exe -q "%cd%\generaBackground.avs" ###SpaceForInputFileName### "%newINPUTfilename5%"
    
    
    \fart.exe -q "%cd%\generaBackground3.avs" ###SpaceForInputFileName### "%newINPUTfilename5%"
    \fart.exe -q "%cd%\generaBackground2.avs" ###SpaceForInputFileName### "%newINPUTfilename5%"
    
    
    
    \fart.exe -q "%cd%\caricaImmagine.avs" ###SpaceForInputFileName### "%newINPUTfilename5%"
    \fart.exe -q "%cd%\caricaImmagine2.avs" ###SpaceForInputFileName### "%newINPUTfilename5%"
    
    \fart.exe -q "%cd%\caricaImmagine3.avs" ###SpaceForInputFileName### "%newINPUTfilename5%"
    
    
    
    
    
    if exist "%cd%\%outputStringMaxLenght37Char%\*.*" del /F /Q "%cd%\%outputStringMaxLenght37Char%\*.*"
    
    
    rem *********************************************************************************************************************
    if exist reportFile.txt del reportFile.txt
    \FFPEG771\ffmpeg.exe -y -i caricaImmagine2.avs 2>reportFile.txt |  echo reportFile.txt
    set "erroreMancanzaMod2=0"
    findstr /I /c:"Cannot convert if width isn't mod2" "reportFile.txt"
    IF NOT ERRORLEVEL 1 (set "erroreMancanzaMod2=1") 
    echo erroreMancanzaMod2 assume %erroreMancanzaMod2%
    
    
    rem if "%erroreMancanzaMod2%"=="1" \fart.exe -i caricaImmagine2.avs "ImageReader" "#ImageReader"
    if "%erroreMancanzaMod2%"=="1" \fart.exe -i caricaImmagine2.avs "#clip=ImageSource" "clip=ImageSource"
    if "%erroreMancanzaMod2%"=="1" \fart.exe -i caricaImmagine2.avs "#cropV=int" "cropV=int"
    if "%erroreMancanzaMod2%"=="1" \fart.exe -i caricaImmagine2.avs "#clip=clip" "clip=clip"
    if "%erroreMancanzaMod2%"=="1" \fart.exe -i caricaImmagine2.avs "#return" "return"
    
    
    rem ********* detect TGA extension routine **********************************
    
    
    set "extensionFile="
    set "isTGA_CTRL=0"
    set "look_for_extension=tga"
    for %%a in ("%~nx4") do set "extensionFile=%%~xa"
    echo extensionFile assume %extensionFile%
    
    if /i ".%look_for_extension%"=="%extensionFile%" set "isTGA_CTRL=1"
    if "%isTGA_CTRL%"=="1" \fart.exe -i caricaImmagine2.avs "ImageSource" "FFImageSource"
    
    
    
    
    
    
    if exist reportFile.txt del reportFile.txt
    rem *********************************************************************************************************************
    
    
    
    
    rem genera background_1 **********************************************************************************
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_1.JPG" del "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_1.JPG"
    \ffmpeg2025\ffmpeg.exe -an -hide_banner -v 16 -loglevel fatal -y -i "%cd%\generaBackground.avs" -filter_complex [0:v]split=2[IN_TGA][IN_BACK];[IN_TGA]null[OUT_TGA];[IN_BACK]zscale=w=1920:h=1080:f=spline36:r=1:d=0,eq=brightness=-0.1,avgblur=19,zscale=w=1920:h=1080:f=1:r=1:d=1[OUT_BACK] -map [OUT_TGA] -pix_fmt bgra -frames:v 1 -f image2 -update 1 -c:v targa -rle 0 "%outputStringMaxLenght37Char%_TGA_ALPHA4null.TGA"  -map [OUT_BACK] -frames:v 1 -f image2 -update 1 -c:v mjpeg -q:v 1 -huffman 1 -intra_matrix 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_1.JPG"
    
    
    
    
    if exist "%outputStringMaxLenght37Char%_TGA_ALPHA4null.TGA" del "%outputStringMaxLenght37Char%_TGA_ALPHA4null.TGA"
    rem *************************************************************************************************************
    
    
    
    rem genera background_2 **********************************************************************************
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_2.JPG" del "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_2.JPG"
    \ffmpeg2025\ffmpeg.exe -an -hide_banner -v 32 -stats -loglevel fatal -y -i caricaImmagine2.avs -filter_complex [0:v]split=2[IN_TGA][IN_BACK];[IN_TGA]null[OUT_TGA];[IN_BACK]zscale=w=1920:h=1080:f=spline36:r=1:d=0,eq=brightness=-0.1,avgblur=19,zscale=w=1920:h=1080:f=1:r=1:d=1[OUT_BACK] -map [OUT_TGA] -pix_fmt bgra -frames:v 1 -f image2 -update 1 -c:v targa -rle 0 "%outputStringMaxLenght37Char%_TGA_ALPHA4null.TGA"  -map [OUT_BACK] -frames:v 1 -f image2 -update 1 -c:v mjpeg -q:v 1 -huffman 1 -intra_matrix 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_2.JPG"
    if not exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_2.JPG" echo non riuscito a generare BACKGROUND_2.JPG
    if not exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_2.JPG" \ffmpegOCT2024.exe -an -hide_banner -v 32 -stats -loglevel fatal -y -i %4 -vf zscale=w=480:h=270:f=spline36:r=1:d=0,eq=brightness=-0.1,avgblur=19,zscale=w=1920:h=1080:f=1:r=1:d=1 -frames:v 1 -f image2 -update 1 -c:v mjpeg -q:v 1 -huffman 1 -intra_matrix 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_2.JPG"
    if exist "%outputStringMaxLenght37Char%_TGA_ALPHA4null.TGA" del "%outputStringMaxLenght37Char%_TGA_ALPHA4null.TGA"
    rem *************************************************************************************************************
    
    
    rem genera background_3 **********************************************************************************
    echo deve generare BACKGROUND_3.JPG
    
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_3.JPG" del "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_3.JPG"
    \ffmpeg2025\ffmpeg.exe  -an -hide_banner -v 16 -loglevel fatal -y -i "%cd%\generaBackground3.avs" -filter_complex [0:v]split=2[IN_TGA][IN_BACK];[IN_TGA]null[OUT_TGA];[IN_BACK]zscale=w=1920:h=1080:f=spline36:r=1:d=0,eq=brightness=-0.1,avgblur=19,zscale=w=1920:h=1080:f=1:r=1:d=1[OUT_BACK] -map [OUT_TGA] -pix_fmt bgra -frames:v 1 -f image2 -update 1 -c:v targa -rle 0 "%outputStringMaxLenght37Char%_TGA_ALPHAnull.TGA"  -map [OUT_BACK] -frames:v 1 -f image2 -update 1 -c:v mjpeg -q:v 1 -huffman 1 -intra_matrix 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_3.JPG"
    if exist "%outputStringMaxLenght37Char%_TGA_ALPHAnull.TGA" del "%outputStringMaxLenght37Char%_TGA_ALPHAnull.TGA"
    
    rem *************************************************************************************************************
    
    
    
    if not exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_2.JPG" echo terzo tentativo per Background_2
    if not exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_2.JPG" \ffmpegOCT2024.exe -an -hide_banner -v 32 -stats -loglevel fatal -y -i %4 -vf zscale=w=480:h=270:f=spline36:r=1:d=0,eq=brightness=-0.1,avgblur=19,pad="width=ceil(iw/2)*2:height=ceil(ih/2)*2" -frames:v 1 -f image2 -update 1 -c:v mjpeg -q:v 1 -huffman 1 -intra_matrix 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_2.JPG"
    if not exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_2.JPG" \ffmpegOCT2024.exe -an -hide_banner -v 32 -stats -loglevel fatal -y -i %4 -vf scale=w=380:h=321,eq=brightness=-0.2,avgblur=22,scale=1920:1080 -frames:v 1 -f image2 -update 1 -c:v mjpeg -q:v 1 -huffman 1 -intra_matrix 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_2.JPG"
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    rem genera TGA con canale ALPHA ****************************************************************************
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" del "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA"
    rem \ffmpegOCT2024.exe  -an -y -i %4 -vf zscale=w=%WValue%:h=%HValue%:f=spline36:r=full:d=ordered:in_range=tv:out_range=pc,colormatrix=bt470bg:bt709 -frames:v 1 -f image2 -update 1 -c:v targa -rle 0 "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%TgA_LPHA_A.TGA"
    
    rem primo tentativo per generare la TGA con ALPHA ******
    \FFPEG771\ffmpeg.exe -an -y -i %4 -vf zscale=w=%WValue%:h=%HValue%:f=spline36:r=full:d=ordered:in_range=full:out_range=limited,colormatrix=bt470bg:bt709,colorspace=bt709:iall=bt601-6-625:fast=0 -color_range 2 -colorspace 5 -color_primaries 1 -color_trc 7 -frames:v 1 -f image2 -update 1 -c:v targa -rle 0 -pix_fmt bgra "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA"
    
    echo WValue assume %WValue%
    echo HValue assume %HValue%
    echo necessarioImagingFuzzy assume %necessarioImagingFuzzy%
    
    if not exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" echo primo tentativo TGA fallito
    
    
    rem ******************************************
    
    IF "%necessarioImagingFuzzy%"=="1" set "HValue5=-2
    IF "%necessarioImagingFuzzy%"=="1" set "WValue5=1080"
    IF NOT "%necessarioImagingFuzzy%"=="1" set "HValue5=1920"
    IF NOT "%necessarioImagingFuzzy%"=="1" set "WValue5=-2"
    if "%square%"=="1" set HValue5=-2
    if "%square%"=="1" set WValue5=1080
    echo HValue5 assume %HValue5%
    echo WValue5 assume %WValue5%
    
    
    
    echo WValue5 assume %WValue5%
    echo HValue5 assume %HValue5%
    
    
    rem secondo tentativo per generare la TGA con ALPHA *****
    \FFPEG771\ffmpeg.exe -an -y -i %4 -vf scale=%WValue%:%HValue%:in_range=full:out_range=limited,colormatrix=bt470bg:bt709,colorspace=bt709:iall=bt601-6-625:fast=0 -sws_flags lanczos+accurate_rnd -color_range 2 -colorspace 5 -color_primaries 1 -color_trc 7 -frames:v 1 -f image2 -update 1 -c:v targa -rle 0 -pix_fmt bgra "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC2.TGA"
    rem *****************************************************
    
    
    
     
    echo per generare le TGA alpha 6000x6000 viene usata per primo tentativo in successione %WValue% e %HValue%
    echo per generare le TGA alpha 6000x6000 viene usata per secondo tentativo in successione %WValue% e %HValue%
    if not exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" echo primo tentativo TGA fallito
    if not exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC2.TGA" echo secondo tentativo TGA fallito
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC2.TGA" echo secondo tentativo TGA6000 ok
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" echo primo tentativo TGA6000 ok 
    
    
    
    
    ECHO landscape assume %landscape% il file originale
    ECHO portrait assume %portrait% il file originale
    ECHO square assume %square% il file originale
    echo CTRL_WIDTH assume %CTRL_WIDTH%
    echo CTRL_HEIGHT assume %CTRL_HEIGHT%
    
    
    set Sottrazione1=0
    set Sottrazione2=0
    set maggioritario1=0
    set maggioritario2=0
    
    set /a "Sottrazione1=1920-%CTRL_WIDTH%"
    set /a "Sottrazione2=1080-%CTRL_HEIGHT%"
    echo sottrazione1 assume %Sottrazione1%
    echo sottrazione2 assume %Sottrazione2%
    
    
    IF %Sottrazione1% GTR %Sottrazione2% set maggioritario1=1
    IF %Sottrazione1% LSS %Sottrazione2% set maggioritario2=1
    
    echo maggioritario1 assume %maggioritario1%
    echo maggioritario2 assume %maggioritario2%
    echo CTRL_WIDTH assume %CTRL_WIDTH%
    echo CTRL_HEIGHT assume %CTRL_HEIGHT%
    
    
    rem **** se esiste la prima procedura e la seconda e se maggioratorio2 allora rinomina la prima per destinazione ****
    set tokens=0
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC2.TGA" if "%maggioritario2%"=="1" set tokens=1
    if "%tokens%"=="1" ren "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" "%outputStringMaxLenght37Char%MovingPICT.TGA"
    set tokens=0
    
    
    
    rem **** se esiste la prima procedura e la seconda e se maggioratorio1 allora rinomina la seconda per destinazione ****
    set tokens=0
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC2.TGA" if "%maggioritario1%"=="1" set tokens=1
    if "%tokens%"=="1" ren "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC2.TGA" "%outputStringMaxLenght37Char%MovingPICT.TGA"
    set tokens=0
    
    
    
    
    rem **** se esiste la prima procedura ma non la seconda allora rinomina direttamente la prima per destinazione ****
    set tokens=0
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" if NOT exist if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC2.TGA" set tokens=1
    if "%tokens%"=="1" ren "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" "%outputStringMaxLenght37Char%MovingPICT.TGA"
    set tokens=0
    
    
    
    rem **** se esiste la seconda procedura ma non la prima allora rinomina direttamente la seconda per destinazione ****
    set tokens=0
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC2.TGA" if NOT exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" set tokens=1
    if "%tokens%"=="1" ren "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC2.TGA" "%outputStringMaxLenght37Char%MovingPICT.TGA"
    set tokens=0
    
    
    rem ***** se ancora esistono entrambi sceglie solo la prima *********************************
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC2.TGA" ren "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" "%outputStringMaxLenght37Char%MovingPICT.TGA"
    
    
    
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA" del "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC1.TGA"
    if exist "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC2.TGA" del "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPIC2.TGA"
    
    
    
    
    
    rem ************************************************************************************************************
    
    
    
    cls
    ECHO portrait assume %portrait% il file originale
    ECHO landscape assume %landscape% il file originale
    ECHO square assume %square% il file originale
    
    
    
    
    rem ******************************************************************************************************************************************
    
    Set X=0
    Set Y=0
    
    for /F "delims=" %%I in ('\ffprobe64bit2022.exe -v error -select_streams v:0 -show_entries stream^=width -of default^=noprint_wrappers^=1:nokey^=1 "%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%JPG_HD.JPG" 2^>^&1') do set /A "CTRL_WIDTH7=%%I"
    echo Width is: [%CTRL_WIDTH7%]
    
    for /F "delims=" %%I in ('\ffprobe64bit2022.exe -v error -select_streams v:0 -show_entries stream^=height -of default^=noprint_wrappers^=1:nokey^=1 "%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%JPG_HD.JPG" 2^>^&1') do set /A "CTRL_HEIGHT7=%%I"
    echo Height is: [%CTRL_HEIGHT7%]
    
    echo CTRL_WIDTH7 assume %CTRL_WIDTH7%
    echo CTRL_HEIGHT7 assume %CTRL_HEIGHT7%
    
    
    set /a Sottrazione1_7=((1920-%CTRL_WIDTH7%)/2)
    set /a Sottrazione2_7=((1080-%CTRL_HEIGHT7%)/2)
    
    echo sottrazione1_7 assume %Sottrazione1_7%
    echo sottrazione2_7 assume %Sottrazione2_7%
    
    
    set X=%Sottrazione1_7%
    set Y=%Sottrazione2_7%
    
    
    echo LoadPlugin(".\AviSynth\BestSource\BestSource.dll")>"TmpSum.avs"
    echo clip1=BSVideoSource("%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_1.JPG")>>"TmpSum.avs"
    echo clip2=BSVideoSource("%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%JPG_HDprocParallel.TGA")>>"TmpSum.avs"
    echo Overlay(clip1, clip2, x=%X%, Y=%Y%)>>"TmpSum.avs"
    echo ConvertBits(8, dither=0)>>"TmpSum.avs"
    
    
    \FFPEG771\ffmpeg.exe -an -y -i "TmpSum.avs" -frames:v 1 -f image2 -update 1 -c:v targa -rle 0 "%cd%\ALL_OVERLAY\%outputStringMaxLenght37Char%.TGA"
    
    xcopy /y "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_1.JPG" "%cd%\ALL_OVERLAY\%outputStringMaxLenght37Char%"
    xcopy /y "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_2.JPG" "%cd%\ALL_OVERLAY\%outputStringMaxLenght37Char%"
    xcopy /y "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_3.JPG" "%cd%\ALL_OVERLAY\%outputStringMaxLenght37Char%"
    xcopy /y "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%MovingPICT.TGA" "%cd%\ALL_OVERLAY\%outputStringMaxLenght37Char%"
    
    
    
    
    if exist "TmpSum.avs" del "TmpSum.avs"
    
    
    
    
    
    
    if exist *.ffindex del *.ffindex
    
    
    
    
    
    
    
    for %%a in ("%~nx4") do set "FileEXT5=%%~xa"
    if not exist "%cd%\ALL_Background_2\tempImageProcessing" md "%cd%\ALL_Background_2\tempImageProcessing"
    echo _>"%cd%\ALL_Background_2\tempImageProcessing\%~n1%FileEXT5%.txt"
    
    
    
    
    
    REM ******************************************************************************************************
    
    
    CLS
    IF EXIST "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_1TESTTESTESTESTESTESTESTESTE.TGA" DEL "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_1TESTTESTESTESTESTESTESTESTE.TGA"
    echo 11111111
    ECHO %HValue5% %WValue5%
    
    \FFPEG771\ffmpeg.exe -an -y -i "%cd%\caricaImmagine3.avs" -vf zscale=w=%HValue5%:h=%WValue5%:f=spline36:r=1:d=0:in_range=full:out_range=full,colormatrix=bt470bg:bt709,colorspace=bt709:iall=bt601-6-625:fast=0,pad="width=ceil(iw/2)*2:height=ceil(ih/2)*2,eq=brightness=0.1" -color_range 2 -colorspace 5 -color_primaries 1 -color_trc 7 -frames:v 1 -f image2 -update 1 -c:v targa -rle 0 -pix_fmt bgra "%cd%\%outputStringMaxLenght37Char%\%outputStringMaxLenght37Char%BKGRND_1TESTTESTESTESTESTESTESTESTE.TGA"
    PAUSE
    
    
    
    rem ***EXIT_SPACE***
    
    
    
    
    goto :eof
    Quote Quote  



Similar Threads

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