Is there a video container which is able to handle segments of different video quality (or even size)?
If the only difference is bitrate, then any container which accepts variable bitrate streams, will fulfill your requirement e.g. MP4, MKV..etc

Step 1 is to encode your segments, ideally using the same encoder, to different bitrates with all other parameters being the same e.g. via ffmpeg,

ffmpeg -ss 0 -t 5 -i input.mp4 -b:v 1000k seg1.mp4

ffmpeg -ss 5 -t 7 -i input.mp4 -b:v 3000k seg2.mp4

ffmpeg -ss 12 -i input.mp4 -b:v 500k seg3.mp4


Step 2 is to use ffmpeg to concat the encoded segments in copy mode, using the concat demuxer.

Prepare a text file

file 'seg1.mp4'
file 'seg2.mp4'
file 'seg3.mp4'


and then

ffmpeg -f concat -i list.txt -c copy joined.mp4




Clips with different properties, like resolution, can be joined together as well into one MP4, but compatibility across media players is iffy, and ffmpeg won't do it reliably at present, anyway.