VideoHelp Forum




+ Reply to Thread
Results 1 to 4 of 4
  1. Hi

    only a cat be patient, thanks

    I'm in a batch and I need to determine if image is rectangular or if it is wider than long.
    Or even square.

    at the moment I have this incomplete routine

    Code:
    	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%
    but I need to signal in a enviroment variable only

    - if is rectangular
    - if is wider than long
    - if is square

    How can I do?
    Quote Quote  
  2. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    @echo off
    cls
    color 0A
    SETLOCAL EnableDelayedExpansion

    REM Drag and drop input file.

    SET "_INPUT_FILE=%~n1%~x1"

    for /F "delims=" %%I in ('ffprobe -v error -select_streams v:0 -show_entries stream^=width -of default^=noprint_wrappers^=1:nokey^=1 "%_INPUT_FILE%" 2^>^&1') do set /A "_WIDTH=%%I"
    echo Width is: [%_WIDTH%]

    for /F "delims=" %%I in ('ffprobe -v error -select_streams v:0 -show_entries stream^=height -of default^=noprint_wrappers^=1:nokey^=1 "%_INPUT_FILE%" 2^>^&1') do set /A "_HEIGHT=%%I"
    echo Height is: [%_HEIGHT%]
    echo.
    IF %_WIDTH% GTR %_HEIGHT% SET _ASPECT=Landscape& echo It's Landscape.
    IF %_WIDTH% LSS %_HEIGHT% SET _ASPECT=Portrait& echo It's Portrait.
    IF %_WIDTH% EQU %_HEIGHT% SET _ASPECT=Square& echo It's Square.
    echo.
    echo Aspect is %_ASPECT%.
    echo.
    pause
    color
    Last edited by JN-; 3rd Feb 2025 at 20:00.
    Quote Quote  
  3. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    Your welcome
    Quote Quote  



Similar Threads

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