loops - Batch Programming Looping? -
i'm not expert in batch programming, skill in c\c++. i'm not sure how go really.
i've got bunch of videos video1.mp4, video2.mp4 (that's not actual names, have numbers indicating beginning , end)
basically have ffmpeg
command can use convert of these aspect ratio of 16:10 looks this:
"ffmpeg -i "section 1 video 1.mp4" -aspect 16:10 outsection 1 video 1.mp4" "ffmpeg -i "section 1 video 2.mp4" -aspect 16:10 outsection 1 video 2.mp4" "ffmpeg -i "section 2 video 1.mp4" -aspect 16:10 outsection 2 video 1.mp4"
now instead of writing command on , on again, there anyway me substitute numbers actual variables? know section 1 ends @ video 27 , section 2 ends @ video 26 , on. need loop run 165 times don't need write command 165 times.
or beyond scope of capability of mere batch program?
well, of course batch can it, real question can handle framing question correctly?
here's 3 ways - ffmpeg
command echoed. remove echo
activate.
@echo off setlocal enabledelayedexpansion :: way first /l %%a in (1,1,27) /l %%b in (1,1,27) ( if exist "section %%a video %%b.mp4" echo ffmpeg -i "section %%a video %%b.mp4" -aspect 16:10 "outsection %%a video %%b.mp4" ) echo ============================== :: way second /l %%a in (1,1,27) /l %%b in (1,1,27) ( set /a total=%%a+%%b if !total! leq 28 echo ffmpeg -i "section %%a video %%b.mp4" -aspect 16:10 "outsection %%a video %%b.mp4" ) echo ============================== :: way third %%i in ("section * video *.mp4") ( echo ffmpeg -i "%%i" -aspect 16:10 "out%%i" ) echo ==============================
now - question here - sure ffmpeg
line? seems me you've omitted quotes around output filename.
and other question can count? if have say, 27 videos in section 1, 26 in 2 , on, have 27+26+25...3+2+1 videos convert - , 378 according calculation - , more importantly, batch - not 165.
Comments
Post a Comment