Well, MP4 is only the video container format. Typically video inside of MP4 files is MPEG or H.264 encoded.
That said, encoding video in the browser is certainly possible. There is a relatively mature H.264 decoder called broadway.js. It was made using emscripten by compiling the C source to JS. I'm sure the same could be done for an encoder.