I need to use MediaCodec without the MediaExtractor and I\'m reading the file using a FileInputStream. Currently it is not working, it is showing a greenish scrambled image
I'm assuming you're reading a raw H.264 elementary stream and not an MP4 file.
It looks like you're feeding fixed-size blocks of data to the decoder. That doesn't work. You need to put a single access unit into each buffer.