crop filter
You can use four crop filters in one command:
ffmpeg -i input -filter_complex "[0]crop=iw/2:ih/2:0:0[tl];[0]crop=iw/2:ih/2:ow:0[tr];[0]crop=iw/2:ih/2:0:oh[bl];[0]crop=iw/2:ih/2:ow:oh[br]" -map "[tl]" topleft.mp4 -map "[tr]" topright.mp4 -map "[bl]" bottomleft.mp4 -map "[br]" bottomright.mp4
bitstream filter
A bitstream filter is different than a normal filter. A normal filter requires decoding and encoding. A bitstream filter operates on the encoded stream data, and performs bitstream level modifications without performing decoding.
The h264_metadata and hevc_metadata bitstream filters can edit the window cropping offsets in the SPS for H.264 and H.265/HEVC. What this means is that it can change these values without needing to re-encode the video. The file size will remain the same but the player will crop the video according to the crop values you set.
Example for H.264 320x240 input:
ffmpeg -i input.mp4 -bsf:v h264_metadata=crop_right=160:crop_bottom=120 -c copy topleft.mp4 -bsf:v h264_metadata=crop_left=160:crop_bottom=120 -c copy topright.mp4 -bsf:v h264_metadata=crop_right=160:crop_top=120 -c copy bottomleft.mp4 -bsf:v h264_metadata=crop_left=160:crop_top=120 -c copy bottomright.mp4
These fields are set in pixels. Note that some sizes may not be representable if the chroma is subsampled (it basically means you should only use even values for your typical video).
To script this you can use ffprobe
to get the width and height.