I have tried running CameraToMpegTest sample on Android 4.3 emulator. As you'd have realized by now, it's not going to work as it is, and some fixes are required.
Implement getparameter properly in SoftAVCEncoder (in case of MIME type - "video/avc") for parameters like width, height, colour format. Otherwise your MediaFormat is not configured properly, and createInputSurface would fail. (I am not sure why this doesn't cause any problem when running H.264 encoding using Mediarecorder)
Fix the EGL attributes
Most importantly, if you're trying to execute this code in Activity context, make sure you don't block onFrameAvailable callback (final void join() Blocks the current Thread (Thread.currentThread()) until the receiver finishes its execution and dies.)