sannies / mp4parser

A Java API to read, write and create MP4 files
Apache License 2.0
2.76k stars 566 forks source link

Add some custom atom in the header of a MP4 video file? #298

Open charlizesmith opened 6 years ago

charlizesmith commented 6 years ago

Hi,

Is it possible to add some custom atom in the header of a MP4 video file?

I need to add the terms "beam" and "loop" in the header of MP4 files before the "moov" atom.

More information can be found here :

https://stackoverflow.com/questions/44893316/whatsapp-video-as-gif-sharing-on-android-programatically

I do not want to edit the headers via too much calculations, as the answer suggests. Is there a simple way to add the atom "loop" to any MP4 files?

How does one go about using your library, and adding a custom atom to any MP4 file?

Use Case :-

WhatsApp does a smart thing. Their animated GIFs are actually MP4 files (which contain this atom "loop"), and the MP4 files which it wants to treat as videos in their UI, they do not add that "loop" atom. We wish to do something similar.

Any help would be truly appreciated!