Guest User

Scale or pad second stream to the first one

a guest
Oct 23rd, 2025
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3.  
  4. set "img1=%~1"
  5. set "img2=%~2"
  6. set "outfile=%~dp1%~n1_tit.jpg"
  7.  
  8. for /f "tokens=5 delims==_" %%i in ('ffprobe -v error -of flat^=s^=_ -select_streams v:0 -show_entries stream^=height "%img1%"') do set "HEIGHT=%%i"
  9. echo %HEIGHT%
  10.  
  11. rem This will SCALE second image to the height of the first one
  12. rem ffmpeg -i "%img1%" -i "%img2%" -filter_complex "[1][0]scale=-1:h=ref_h[img2s]; [0][img2s]hstack=inputs=2[out]" -map [out] "%outfile%"
  13.  
  14. rem This will PAD second image to the height of the first one
  15. ffmpeg -i "%img1%" -i "%img2%" -filter_complex "[1]pad=w=iw+1:h=%HEIGHT%:x=0:y=0:color=black[img_pad]; [0][img_pad]hstack=inputs=2[out]" -map [out] "%outfile%"
  16. pause
  17.  
Advertisement
Add Comment
Please, Sign In to add comment