Adding "loop" atom to the video header via FFMPEG

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding "loop" atom to the video header via FFMPEG

Vikram Parmar
 Hi,

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

I need to add the term "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

Note: Just opening the video file using any text editor shows the file
header and atoms.

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



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

I tried loads of -loop and stream loop commands.. Nothing is adding the
atom "loop" to my mp4 files

My current command for converting a GIF to MP4 is as follows :

ffmpeg -i giphy9.gif -c:v libx264 -c:a aac -pix_fmt yuv420p -movflags
> +faststart  giphy9_loop.mp4
>

I wish to add some parameter to the above command (or maybe run a separate
command) so that the output mp4 file has that "loop" atom in the header.

Please help!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Adding "loop" atom to the video header via FFMPEG

Moritz Barsnick
On Thu, Jan 11, 2018 at 15:33:43 +0530, Vikram Parmar wrote:
> Is it possible to add some custom atom in the header of a video file?

No, ffmpeg can't add custom or arbitrary atoms.

> I need to add the term "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

That doesn't seem to be a standard atom. I do see mention of a "LOOP"
atom here though:

https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html

> Note: Just opening the video file using any text editor shows the file
> header and atoms.

AtomicParsley is a nice tool for showing atoms and their hierarchies.

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

If those instructions work, they're probably scriptable, and you're
best off with that.

AtomicParsley, while being able to edit atoms, unfortunately doesn't
seem to be able to add arbitrary atoms.

If the atom was some kind of standard, you could modify ffmpeg to add
it (e.g. with an output option similar to the gif muxer's "-loop").

> I wish to add some parameter to the above command (or maybe run a separate
> command) so that the output mp4 file has that "loop" atom in the header.

Someone who knows their way around this fishy atom business ("fishy"
just because I'm too stupid to wrap my head around it) could probably
implement this in ffmpeg in a breeze. Since, from what I found, it's
not even "standard", I doubt it would be accepted for ffmpeg.

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Adding "loop" atom to the video header via FFMPEG

Vikram Parmar
Hey Moritz,

Thanks for the detailed reply...

Any other tools you are aware of which would allow adding of custom atoms?
Those instructions in stackoverflow answer were quite daunting. Woukd
mp4box help in any way? We are using php, would it be possible to
add/modify file headers in php?

Also, there is a "beam" atom too before the "loop" atom, is that too a
custom non standard atom?

Thanks....

On 12 Jan 2018 02:00, "Moritz Barsnick" <[hidden email]> wrote:

> On Thu, Jan 11, 2018 at 15:33:43 +0530, Vikram Parmar wrote:
> > Is it possible to add some custom atom in the header of a video file?
>
> No, ffmpeg can't add custom or arbitrary atoms.
>
> > I need to add the term "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
>
> That doesn't seem to be a standard atom. I do see mention of a "LOOP"
> atom here though:
>
> https://developer.apple.com/library/content/documentation/
> QuickTime/QTFF/QTFFChap2/qtff2.html
>
> > Note: Just opening the video file using any text editor shows the file
> > header and atoms.
>
> AtomicParsley is a nice tool for showing atoms and their hierarchies.
>
> > I do not want to edit the headers via too much calculations, as the
> answer
> > suggests. Is there a simple FFMPEG command to add the atom "loop" to any
> > MP4 files?
>
> If those instructions work, they're probably scriptable, and you're
> best off with that.
>
> AtomicParsley, while being able to edit atoms, unfortunately doesn't
> seem to be able to add arbitrary atoms.
>
> If the atom was some kind of standard, you could modify ffmpeg to add
> it (e.g. with an output option similar to the gif muxer's "-loop").
>
> > I wish to add some parameter to the above command (or maybe run a
> separate
> > command) so that the output mp4 file has that "loop" atom in the header.
>
> Someone who knows their way around this fishy atom business ("fishy"
> just because I'm too stupid to wrap my head around it) could probably
> implement this in ffmpeg in a breeze. Since, from what I found, it's
> not even "standard", I doubt it would be accepted for ffmpeg.
>
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Adding "loop" atom to the video header via FFMPEG

Vikram Parmar
You mentioned the presence of "LOOP" atom in apple docs,
https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html

Could this "loop" be the same thing? If so, how to add this apple movie
atom via ffmpeg?

But the "loop" atom I need would be needed at the start of the file before
the moov atom, I wonder where the apple "LOOP" atom gets headed in the
file...

On 12 Jan 2018 08:15, "Vikram Parmar" <[hidden email]> wrote:

> Hey Moritz,
>
> Thanks for the detailed reply...
>
> Any other tools you are aware of which would allow adding of custom atoms?
> Those instructions in stackoverflow answer were quite daunting. Woukd
> mp4box help in any way? We are using php, would it be possible to
> add/modify file headers in php?
>
> Also, there is a "beam" atom too before the "loop" atom, is that too a
> custom non standard atom?
>
> Thanks....
>
> On 12 Jan 2018 02:00, "Moritz Barsnick" <[hidden email]> wrote:
>
>> On Thu, Jan 11, 2018 at 15:33:43 +0530, Vikram Parmar wrote:
>> > Is it possible to add some custom atom in the header of a video file?
>>
>> No, ffmpeg can't add custom or arbitrary atoms.
>>
>> > I need to add the term "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
>>
>> That doesn't seem to be a standard atom. I do see mention of a "LOOP"
>> atom here though:
>>
>> https://developer.apple.com/library/content/documentation/Qu
>> ickTime/QTFF/QTFFChap2/qtff2.html
>>
>> > Note: Just opening the video file using any text editor shows the file
>> > header and atoms.
>>
>> AtomicParsley is a nice tool for showing atoms and their hierarchies.
>>
>> > I do not want to edit the headers via too much calculations, as the
>> answer
>> > suggests. Is there a simple FFMPEG command to add the atom "loop" to any
>> > MP4 files?
>>
>> If those instructions work, they're probably scriptable, and you're
>> best off with that.
>>
>> AtomicParsley, while being able to edit atoms, unfortunately doesn't
>> seem to be able to add arbitrary atoms.
>>
>> If the atom was some kind of standard, you could modify ffmpeg to add
>> it (e.g. with an output option similar to the gif muxer's "-loop").
>>
>> > I wish to add some parameter to the above command (or maybe run a
>> separate
>> > command) so that the output mp4 file has that "loop" atom in the header.
>>
>> Someone who knows their way around this fishy atom business ("fishy"
>> just because I'm too stupid to wrap my head around it) could probably
>> implement this in ffmpeg in a breeze. Since, from what I found, it's
>> not even "standard", I doubt it would be accepted for ffmpeg.
>>
>> Moritz
>> _______________________________________________
>> ffmpeg-user mailing list
>> [hidden email]
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> [hidden email] with subject "unsubscribe".
>
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Adding "loop" atom to the video header via FFMPEG

Vikram Parmar
I tried using some AtomicParslet commands

e.g AtomicParsley giphy9.mp4 --meta-uuid "beam" text "loop"

But it doesn't add stuff like its needed as shown in the stackoverflow
article

Some help please...

On Fri, Jan 12, 2018 at 8:18 AM, Vikram Parmar <[hidden email]>
wrote:

> You mentioned the presence of "LOOP" atom in apple docs,
> https://developer.apple.com/library/content/documentation/
> QuickTime/QTFF/QTFFChap2/qtff2.html
>
> Could this "loop" be the same thing? If so, how to add this apple movie
> atom via ffmpeg?
>
> But the "loop" atom I need would be needed at the start of the file before
> the moov atom, I wonder where the apple "LOOP" atom gets headed in the
> file...
>
> On 12 Jan 2018 08:15, "Vikram Parmar" <[hidden email]> wrote:
>
>> Hey Moritz,
>>
>> Thanks for the detailed reply...
>>
>> Any other tools you are aware of which would allow adding of custom
>> atoms? Those instructions in stackoverflow answer were quite daunting.
>> Woukd mp4box help in any way? We are using php, would it be possible to
>> add/modify file headers in php?
>>
>> Also, there is a "beam" atom too before the "loop" atom, is that too a
>> custom non standard atom?
>>
>> Thanks....
>>
>> On 12 Jan 2018 02:00, "Moritz Barsnick" <[hidden email]> wrote:
>>
>>> On Thu, Jan 11, 2018 at 15:33:43 +0530, Vikram Parmar wrote:
>>> > Is it possible to add some custom atom in the header of a video file?
>>>
>>> No, ffmpeg can't add custom or arbitrary atoms.
>>>
>>> > I need to add the term "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
>>>
>>> That doesn't seem to be a standard atom. I do see mention of a "LOOP"
>>> atom here though:
>>>
>>> https://developer.apple.com/library/content/documentation/Qu
>>> ickTime/QTFF/QTFFChap2/qtff2.html
>>>
>>> > Note: Just opening the video file using any text editor shows the file
>>> > header and atoms.
>>>
>>> AtomicParsley is a nice tool for showing atoms and their hierarchies.
>>>
>>> > I do not want to edit the headers via too much calculations, as the
>>> answer
>>> > suggests. Is there a simple FFMPEG command to add the atom "loop" to
>>> any
>>> > MP4 files?
>>>
>>> If those instructions work, they're probably scriptable, and you're
>>> best off with that.
>>>
>>> AtomicParsley, while being able to edit atoms, unfortunately doesn't
>>> seem to be able to add arbitrary atoms.
>>>
>>> If the atom was some kind of standard, you could modify ffmpeg to add
>>> it (e.g. with an output option similar to the gif muxer's "-loop").
>>>
>>> > I wish to add some parameter to the above command (or maybe run a
>>> separate
>>> > command) so that the output mp4 file has that "loop" atom in the
>>> header.
>>>
>>> Someone who knows their way around this fishy atom business ("fishy"
>>> just because I'm too stupid to wrap my head around it) could probably
>>> implement this in ffmpeg in a breeze. Since, from what I found, it's
>>> not even "standard", I doubt it would be accepted for ffmpeg.
>>>
>>> Moritz
>>> _______________________________________________
>>> ffmpeg-user mailing list
>>> [hidden email]
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>
>>> To unsubscribe, visit link above, or email
>>> [hidden email] with subject "unsubscribe".
>>
>>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Adding "loop" atom to the video header via FFMPEG

Moritz Barsnick
On Fri, Jan 12, 2018 at 16:57:12 +0530, Vikram Parmar wrote:

Please try to avoid top-posting.

> >> Any other tools you are aware of which would allow adding of custom
> >> atoms? Those instructions in stackoverflow answer were quite daunting.

I'm not aware, but I'm no expert. In my humble opinion, they should
exist. You need to google yourself though.

> >> Woukd mp4box help in any way?

I don't know.

> >>  We are using php, would it be possible to add/modify file headers
> >> in php?

If PHP can do anything that scripting can do, it might be able to
achieve the same thing the Stackoverflow entry suggests.

> > You mentioned the presence of "LOOP" atom in apple docs,
> > https://developer.apple.com/library/content/documentation/
> > QuickTime/QTFF/QTFFChap2/qtff2.html
> >
> > Could this "loop" be the same thing? If so, how to add this apple movie
> > atom via ffmpeg?

I don't think so. From my understanding, atom names are case sensitive,
so "loop" != "LOOP".

> I tried using some AtomicParslet commands
>
> e.g AtomicParsley giphy9.mp4 --meta-uuid "beam" text "loop"
>
> But it doesn't add stuff like its needed as shown in the stackoverflow
> article

I tried that too, but I believe those are not top-level atoms you can
add. As I said, AtomicParsley does not seem to be able to add arbitrary
atoms.

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".