3

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.

s.ermakovich
  • 2,641
  • 2
  • 26
  • 24

2 Answers2

2

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).

Waldheinz
  • 10,399
  • 3
  • 31
  • 61
  • Accordingly to some benchmarks performed by me, MJPEG will have at least two times higher bitrate than MPEG. But you suggested very interesting solution based on recompression with H.264 as offline task. We don't need to stream video over network in our application. We need to save to local storage with relatively small capacity (netbooks). So, we need to use disk space efficiently during video capturing. And recompression (after captruring is finished) maybe is a good option for us. Thanks for this solution, I will take a look at x264 lib. – s.ermakovich Jul 14 '11 at 08:18
2

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.

Christopher
  • 8,912
  • 3
  • 33
  • 38
  • VP8/WebM probably isn't safe; MPEG-LA is currently trying to form a patent pool and I think it's likely that it'll go the way of WMV9. So really the only "safe" royalty-free format is Theora – kidjan Jul 14 '11 at 06:27
  • Is it true, that codecs like h264/OggTheora/WebM requires a lot of resources (CPU) for real-time compression (even if video frame resolution is low)?. I'm asking because our target environment is relative slow machines (netbooks). – s.ermakovich Jul 14 '11 at 08:23
  • You have to try and bench the available settings for the codecs. x264 may reach real-time. – Christopher Jul 14 '11 at 10:29