How to encode with MPEG4

Dec 7, 2014 at 2:37 PM
I downloaded the sample from the website, and I can encode with MotionJpeg. But I could not encode with MPEG4 like X264, DivX and Xvid (I have installed the encoder of them yet), and it said that "no compatible MPEG-4 found"(for DivX and X264) or "divided zero"(for Xvid). So what should I do next? Does it need to initialize the encoder first or do any other things? Thanks!
Dec 8, 2014 at 2:20 PM
Most probably, you're running in 64 bits. You can find a note in comments to Mpeg4VideoEncoderVcm:
    /// 64-bit support is limited, as there are no 64-bit versions of Microsoft and DivX codecs, 
    /// and Xvid can produce some errors.
I could not get rid of this Divide by Zero error when using 64-bit Xvid. So far, the only reliable 64-bit MPEG-4 codec one can use with SharpAvi is x264vfw. Which seems not installed on your system.

There are separate 32-bit and 64-bit installers for this codec. Look for 64-bit binaries here:
Dec 9, 2014 at 5:37 AM
Edited Dec 9, 2014 at 5:40 AM
Thank you for your help! But there are some warmings when it used x264vfw after recording like this:

x264vfw [warning]: Few frames probably would be lost. Ways to fix this:
x264vfw [warning]: - if you use VirtualDub or its fork than you can enable 'VirtualDub Hack' option
x264vfw [warning]: - you can enable 'File' output mode
x264vfw [warning]: - you can enable 'Zero Latency' option

In fact, there are some frames lost with motionjpeg and x264. With the increasing of width and height, frames would be lost more. Is it over the largest size of the encoded display resolution?
Dec 9, 2014 at 7:50 AM
Edited Dec 9, 2014 at 7:53 AM
Just do as the warning says - enable 'Zero Latency' option in x264vfw settings. Run Configure x264vfw64 for that. FYI, a note about this is also written in the same comments.

I did not see any frame loss when using Motion JPEG encoder. And it can't be, as it encodes frames one by one independently. Frame drops (still picture effect) with x264vfw at the beginning of videos vanish after setting the above option.
Frame rate of videos produced by the sample app is 10 fps.

There is no any resolution limit built in the library.