Java – Use mp4parser to resize mp4 videos

Use mp4parser to resize mp4 videos… here is a solution to the problem.

Use mp4parser to resize mp4 videos

I’m trying to figure out how to resize/scale mp4 videos using mp4parser in Android apps. After googling and looking at the mp4parser source code and examples, I’m still not sure how to do it.

Does mp4parser have some built-in methods?

If not, can I get the raw video data and resize it myself using mp4parser? (A link to an example would be great if possible).

Notes:

mp4parser website https://code.google.com/p/mp4parser/

I’m willing to consider using a different library than mp4parser, but I want something similar to the LGPL license. In other words, I’m willing to provide library source code and give credit when it deserves, but I’d rather not be forced to make my source code public. (This application will eventually be sold on the market).

I need this feature to attach 2 files with different resolutions together (shot from front camera and rear camera).

I have successfully attached 2 files of the same resolution using mp4parser.

I’m still new to video editing.

While I’ve relied on StackOverflow for years, this is the first question I asked. Please be gentle about the correct way to ask questions here, and I’m happy to accept constructive criticism.

Solution

mp4parser will not be able to do this. To rescale the video, you must decode each frame, rescale, and then re-encode. FFMPEG (libavformat, libavcodec, swscale) can do this. As for LGPL compatibility, you may be able to implement it for some, but not all, codecs. I’m assuming you’re looking for the LGPL to include this is a commercial application? If so, you must also license the codec. For example, x264 is free/open source software. However, distributing the videos it creates may require you to pay MPEG-LA fees.

Related Problems and Solutions