Hi
only a catbe 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
but I need to signal in a enviroment variable onlyCode: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%
- if is rectangular
- if is wider than long
- if is square
How can I do?![]()
+ Reply to Thread
Results 1 to 4 of 4
-
-
@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
colorLast edited by JN-; 3rd Feb 2025 at 20:00.
Similar Threads
-
aspect ratio converter
By rw1954 in forum Video ConversionReplies: 23Last Post: 26th May 2022, 19:00 -
Aspect Ratio Conversion
By rw1954 in forum Newbie / General discussionsReplies: 1Last Post: 25th May 2022, 19:56 -
Graphic Aspect Ratio
By biferi in forum Newbie / General discussionsReplies: 1Last Post: 8th Jun 2021, 13:51 -
MPEG aspect ratio 4:3 -> 16.9
By SmurfRecorder in forum Video ConversionReplies: 8Last Post: 15th May 2021, 15:30 -
Aspect Ratio
By wks in forum Newbie / General discussionsReplies: 10Last Post: 1st May 2020, 14:57