Need some background to address your question properly
Container:
A file that contains one or more data files, typically audio or video streams, but also subtitles, chapters etc. Examples of containers are AVI, MP4. MKV, ASF etc.
Codec:
A compression format used to encode an individual multimedia data stream, which may or may not be held in a container, for example H264 & WMV9 for video, MP3 and AAC for audio
Examples:
An AVI file might
contain two components, a video stream using the DivX
codec, and an audio stream using the MP3
codec
Or an MKV file might contain three components, a video stream using the x264 codec, an audio stream using the AAC codec, and chapter list
There is naming confusion, especially in the MPEG family, where the short container and codec names are used inconsistently. E.g. MP3 refers to an audio
codec, but MP4 to a
container type. Also WMV is strictly a
codec, but is often used to mean the ASF
container type.
However, setting those issues aside, you should see from the examples that the container has no real effect on file size or playback quality. It's just the bag you put your data in. Choice of container is made purely on compatibility and flexibility. So the question you mean to ask is: what codec (compression format) should I use for my audio / video data? Then you can package your compressed data in a container that suits your purpose.
As noted by mister_playboy, a full discussion of the relative merits of different codecs is far, far, far too detailed to get into here and you should research that elsewhere. However, the better rippers here are currently using H264 (the x264 implementation) as a video compression codec and AAC (the Nero implementation) for audio. But even within these specific codecs there are a myriad of settings that can vastly improve/reduce file size and quality. Consider using
MeGUI or Akiba-Online's own
MeguIV to encode using H264/AAC/MP3 and contain with MKV/MP4.
If you
really don't care about filesize, then there are lossless compression schemes, for example H264 lossless. This encodes your media without any change from the source. However bear in mind that an hour of lossless 30fps video uses about 40Gb.