Split videos into segments using ffmpeg

2019-06-10 00:05发布

问题:

I have 10000 videos and I want to split each video into five segments

I know previously how to segment video using ffmpeg but I do not know how to use it with a large number of videos

the names of videos are: 1.avi, 2.avi, 3.avi, ....... ....., 10000.avi

I want to use for loop with ffmpeg can you please help me?!!!!

回答1:

I found the solution

@echo off
FOR /L %%G IN (1,1,10000) DO (
 ffmpeg -i "C:\video-splitter-master\%%G.avi" -vcodec copy -acodec copy -ss 0:00:00 -t 0:00:02 "C:\video-splitter-master\%%Greem1.avi"
 ffmpeg -i "C:\video-splitter-master\%%G.avi" -vcodec copy -acodec copy -ss 0:00:00 -t 0:00:03 "C:\video-splitter-master\%%Greem2.avi"
 ffmpeg -i "C:\video-splitter-master\%%G.avi" -vcodec copy -acodec copy -ss 0:00:00 -t 0:00:04 "C:\video-splitter-master\%%Greem3.avi"
 ffmpeg -i "C:\video-splitter-master\%%G.avi" -vcodec copy -acodec copy -ss 0:00:00 -t 0:00:05 "C:\video-splitter-master\%%Greem4.avi"
 ffmpeg -i "C:\video-splitter-master\%%G.avi" -vcodec copy -acodec copy -ss 0:00:00 -t 0:00:06 "C:\video-splitter-master\%%Greem5.avi"

 )
 pause


标签: video ffmpeg