I have found a lot of examples on how to encode video with MediaCodec, but all of them have to create a input surface. It is possible to encode video without a input surface? A code example will be a great help, thank you!
Yes, you can also configure it to use a normal YUV color as input format, and manually fill the input buffers with data in this format. One example of this is https://android.googlesource.com/platform/cts/+/jb-mr2-release/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java - see the encodeDecodeVideoFromBuffer, selectColorFormat and generateFrame methods.