Guest User

Scale or pad second stream to the first one

a guest
Oct 23rd, 2025
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 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. set "img2_scale_w=2.5"
  8.  
  9.  
  10. 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"
  11. echo %HEIGHT%
  12.  
  13. rem This will SCALE second image to the height of the first one
  14. 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%"
  15.  
  16. rem This will PAD second image to the height of the first one
  17. ffmpeg -i "%img1%" -i "%img2%" -filter_complex "[1]scale=w=iw*%img2_scale_w%:h=-1[img2s]; [img2s]pad=w=iw+1:h=%HEIGHT%:x=0:y=0:color=black[img_pad]; [0][img_pad]hstack=inputs=2[out]" -map [out] "%outfile%"
  18. pause
  19.  
Advertisement
Add Comment
Please, Sign In to add comment