So I guess there have been alot of questions about what I am asking. But have anyone found a solution or library that can pause during recording a movie? Or are there any apis available that are stable and can concatanate several mp4 file?
Mp4Parser is java based library that lets you manipulate h264 and aac encoded streams. its not a encoder or decoder. but you can concatenate or trim a stream, switch streams or add streams to mp4 container etc.
For Implementing Pause/resume functionality you can use MediaRecorder for creating new recorded file every time user presses pause(and then resume). so you will have multiple mp4 files that you can then stitch together using Mp4Parser.
Problem with this solution:
so before stitching videos you can cut/trim longest stream to match the other stream using the library. as the library isn't encoder/decoder so you can only cut/trim a whole frame(audio or video). but still, this will reduce the difference between stream lengths. this dropped frames are not always noticeable so you might get away with it.
There are enough examples in the library repository so i'm not posting any code here. Here is another post which i believe has done similar to first step i mentioned(i haven't tried the code mentioned by OP there).