Reputation: 1
I have a video called 1.mp4
I want to extract 17+17= 34 total clips from this video with one FFmpeg command
Each clip should have a unique name like 1a 1b 1c 1d and so on.
17 clips will have a 1920x1080 dimension and remaining 17 will have 720x720 dimension
I will appreciate if someone can help me to do this. It will save my several hours.
Upvotes: -2
Views: 2153
Reputation: 133863
Adapt this shortened example for 2+2 outputs:
ffmpeg -i input.mp4 -filter_complex
"[0:v]trim=start=0:end=3,setpts=PTS-STARTPTS,split[va1][vb1];
[0:v]trim=start=5:end=10,setpts=PTS-STARTPTS,split[va2][vb2];
[0:a]atrim=start=0:end=3,asetpts=PTS-STARTPTS,asplit[aa1][ab1];
[0:a]atrim=start=5:end=10,asetpts=PTS-STARTPTS,asplit[aa2][ab2];
[va1]scale=700:700:force_original_aspect_ratio=increase,crop=700:700[700_1];
[va2]scale=700:700:force_original_aspect_ratio=increase,crop=700:700[700_2];
[vb1]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920[1920_1];
[vb2]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920[1920_2]"
-map "[700_1]" -map "[aa1]" 1a.mp4
-map "[700_2]" -map "[aa2]" 1b.mp4
-map "[1920_1]" -map "[ab1]" 2a.mp4
-map "[1920_2]" -map "[ab2]" 2b.mp4
[va1]
, are arbitrary and you can use whatever label names you prefer.These filters are used:
Upvotes: 2