ffmpeg will do it. You can either compile it from source, available here. Or more likely, download a precompiled binary for Macs from here. I don't use Macs so I can't vouch for the binary source.
You will have to use the trim, crop and scale filters in a filterchain to accomplish what you want.
The actual corresponding command for your pseudo command would be
ffmpeg -i input -vf "trim=20:40, setpts=PTS-STARTPTS, crop="'if(gte(a*sar,4/3),4*ih/3*sar,iw)':'if(gte(a*sar,4/3),ih,3*iw*sar/4)'", scale=320x240, setsar=1" -c:v libx264 -an output.mp4
You can find the (terse) explanation for all the parameters at the ffmpeg documentation site, but here's a quick run-through, in order:
-i input - Specify the input file.
-vf - this indicates a video filter follows, or a chain of them (separated by commas). If there are multiple filters specified in sequence, then each filter in a chain works on the output generated by the previous filter in the chain. The first filter works, of course, on the original input.
trim=20:40 - trims the video by retaining from the 21st to the 40th second
setpts=PTS-STARTPTS - video is a sequence of images displayed in time, so the frames of a video stream have timestamps associated with them for playback purposes. PTS is presentation timestamp. This clause generates new timestamps for the trimmed video stream so that the first frame of the trimmed stream has PTS of 0 (seconds) and all subsequent frames are accordingly offset as well (I've simplified a bit here).
crop="'if(gte(a*sar,4/3),4*ih/3*sar,iw)':'if(gte(a*sar,4/3),ih,3*iw*sar/4)'" - in short, this crops the input video to 4:3, but based on the input video's effective display ratio, so that the cropped image doesn't contain any blank padding. Video can contain "non-square" pixels so that a 100x100 image with pixel aspect (SAR) 2.5 will effectively display as 250x100 and SAR 0.5 will display as 50x100. My expression evaluates the effective input ratio and sets the output crop window accordingly.
scale=320x240 - scale to the stated resolution
setsar=1 - the crop and scale filters effectively produced a square pixel output, so the SAR metadata should be set as 1 to overwrite the original SAR so that players don't distort the image during playback.
-c:v libx264 - this says, use x264 to encode the video stream. There are many parameters that can be specified in addition , but by itself, it will use the default settings.
-an - leave audio out of the output. If you want to leave the corresponding audio in. replace this by
-af "atrim=20:40, asetpts=PTS-STARTPTS" -c:a aac -strict -2