Lazyman solution is to use the scale filter to conform each input to a desired width x height.
For your proposed solution you can use ffprobe
to determine when size changes occur.
ffprobe -v error -show_entries frame=pkt_pts_time,width,height -select_streams v -of csv=p=0 input.flv
Example output excerpt during width and height change (key_frame, pkt_pts_time, width, height):
0,89.081000,480,640
0,89.281000,480,640
0,89.481000,480,640
1,89.568000,640,480
0,89.592000,640,480
0,89.632000,640,480
1,97.749000,480,640
The size changes will likely occur on key frames which is where you can make the cuts if stream copying is a requirement. If you just want the key frames add the -skip_frame nokey
option.
Then use the segment muxer:
ffmpeg -i input.flv -map 0 -c copy -segment_times 89.568,97.749 -reset_timestamps 1 -f segment output_%03d.flv
Best Answer
I convert video to mp4 using this settings:
bitrate: 2-5 Mbit VBR
audio codec: aac
And it's working.