Can anybody suggest a good codec for real-time video compression? Here is a list of key requirements:
- Must be represented as DirectShow video compression filter
- Royalty-free
- Good quality/bitrate output comparable to the DivX on relatively low resolutions (640x480 max)
- Fast and resources-efficient for real-time compression
- Compatibility with some popular format (like MPEG-4) for wide support in different video players
I mentioned DivX and I think it is a very good codec, but if I understand correctly it is not royalty-free and you need to pay DivX Inc if you want to integrate their codec into your software.
Most codecs work out of the box under directshow, so that should not be a problem.
But most 'current' codecs are not royalty free. Too repeat this, h264 even when you use x264 is not royalty free. You have to pay for the encoder a certain amount. In this vain Xvid is in the same boat. The only codecs which are really royalty free are VP4 (OggTheora) and VP8 (WebM). Neither enjoys much support outside enthusiast PC video users.
Real-Time compression is not a target of current generation of codecs, on the other hand, especially x264 was optimized for fast, low-latency encoding if you supply the right parameters. You have to check, if your target platform provides enough performance for real-time encoding with this codec.
NB: There are many commercial h264/MPEG4/MPEG2 codec implementations by several vendors. Maybe one of them fits your needs.
Afaik, ffdshow includes a MJPEG encoder, which might be a good fit for you needs. If you need better compression ratio, you can convert to h264 (e.g. using x264) as an offline task (or you have a very capable computer which can encode to h264 directly).