0

I deal with the processing and uniqueness of 9:16 videos.

I need to make the video take on a random zoom value to increase it in scale and crop it accordingly at the edges.

I need to make a random value from +1% to +10%. From the original 100%

The command I have, it only changes the zoom to +30%.

@echo off
setlocal enabledelayedexpansion

for %%G in (*.mp4) do (
    set "video_file=%%G"

    set /a "random_int=!RANDOM! %% 401 + 100"
    set "trim_start=!random_int:~0,-2!.!random_int:~-2!"

    echo Processing "!video_file!" with trimming start by !trim_start! seconds

    set "output_file=!video_file:.mp4=_zoomed.mp4!"

    ffmpeg -i "!video_file!" -vf "crop=iw/1.3:ih/1.3" -c:v libx264 -crf 23 -preset medium -c:a copy "!output_file!"

    if ERRORLEVEL 1 (
        echo Error processing "!video_file!"
    ) else (
        echo Successfully processed "!video_file!"

        ren "!output_file!" "!video_file!"
    )
)

pause
3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Jun 21 at 13:48
  • Since this involves ffmpeg, you may also get good answers on the VIdeo Production stack. video.stackexchange.com/questions/tagged/ffmpeg
    – Theodore
    Commented Jun 21 at 13:58
  • You don't seem to use the variables you created trim_start or random_int at any part of the ffmpeg command... Commented Jun 21 at 15:30

0

You must log in to answer this question.

Browse other questions tagged .