Author Topic: [Request] Option to position the moov atom at the beginning of .mp4 (h264 codec)  (Read 13418 times)

Rocky_4r

  • Newbie
  • *
  • Posts: 3
if you are working on the h264 codec for avidemux 2.6, could you please also add an option to the mp4 container to place the moov atom in front of the file so the file can be streamed on html5 / flash players on websites?

check this article from adobe to undestand the atom moov.

http://www.adobe.com/devnet/video/articles/mp4_movie_atom.html

I copied out the paragraph which speaks about moov atom positioning:

Quote
Importance of moov atom location

As I mentioned earlier, positioning the moov atom at the beginning of the file structure expedites the playback experience and access to the data payload for decoding and presentation by the client player. This is especially true for progressive delivery, where the moov atom data must be received before playback will begin.

However, another vital reason for having the moov atom at the beginning relates to the file, server, and CDN relationship in RTMP streaming. When the user requests a video asset via RTMP, Flash Media Server checks for availability of the asset on the local cache. If FMS does not locate the asset locally, it then requests the asset via a local service while leveraging HTTP cache hierarchy. This is a crucial point: initially, Flash Media Server requests a "range" at the beginning of the file to get the table of contents. If FMS sees that the metadata is stored at the end of the file, it then requests a range at the end of the file where metadata is stored, and then it requests the file from the beginning again. Since range requests are not cacheable, and because they can overlap, this process of back-and-forth requests may cause rebuffering. This is especially true if the user is watching video randomly or in small segments instead of the entire video from start to finish, as it's never cached in its entirety. Therefore, always encoding or muxing files with the moov atom at the beginning is recommended to avoid rebuffering caused by moov atom location.

to make a mp4 video (h264 codec) streamable at the moment i have to use JAMB.

download it here: http://yamb.unite-video.com/download.html
how to / tutorial (only in german language - use a translator for other languages): http://videoencoding.websmith.de/encoding-praxis/win-yamb-metadaten.html

all this tool does, is repacking mp4 files and placing the moov atom in front of the file.

Thank you for your work. Avidemux is one of the best video editing tools.
« Last Edit: June 09, 2011, 03:48:14 PM by Rocky_4r »

mean

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10971
If you select mp4v2 and use the "optimize for streaming" option (on by default),
the atom will be placed in front

Rocky_4r

  • Newbie
  • *
  • Posts: 3
oh, i am very sorry. i didn't saw that.

thx for your help.

Rocky_4r

  • Newbie
  • *
  • Posts: 3
sorry for doubleposting.

just wanted to let you know, that there may be an issue with the repacking of a mp4 video in avidemux 2.6... i know its a experimental release, but maybe it helps you to find a bug...

My sourcevideo just works fine and is made with avidemux 2.5  (.mp4 --> h.264 / AAC)
I wanted to repack it with avidemux 2.6 (mp4v2 --> Copy / Copy) to move the moov atom.

The video shows fine on vlc media player, but when i want to stream it, some frames (in the middle of the video) are mixed up (you see first frame 3 and 4 and the the video jumps back to frame 1 and 2 and at the end it continues with frame 5 and 6). This looks funny, but its obviously not intended.

I repacked the original sourcevideo with Yamb and there were no problems streaming the video.

I tried this twice and both videos i made with avidemux 2.6 mixed some frames (in the middle of the video). but only when streamed. when you watch the video on vlc on your local computer it is perfect.

this sounds strange to me.

i am no expert, but could this be an issue with the moov atom or mp4v2 muxer?

Agent_007

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3163
Quote
i am no expert, but could this be an issue with the moov atom or mp4v2 muxer?
You can narrow down the problem by doing one file with optimize for streaming and other without it. Then open both of them and compare.
I am away between 15th of May - 15th of June. (yes, I am playing D3)

Perepandel

  • Newbie
  • *
  • Posts: 2
If you select mp4v2 and use the "optimize for streaming" option (on by default),
the atom will be placed in front

Hi and sorry for reviving this old post.

I registered just to ask this. I've tried Avidemux 2.6.1, both 32 and 64 bit, as well as 2.6.2 nightly for Windows, searched in every place and couldn't find this option. The only one available when I select "mp4v2 muxer" and click on "configure" is "Add ipod metadata", which I tried but does nothing for my purposes.

I have to manually use ffmpeg on each video to first remux it without recompressing and get a valid moov atom, then use qt-faststart to move it to the beginning of the file...

sp00n

  • Newbie
  • *
  • Posts: 6
This post shows up on the first page on Google when searching for "avidemux move atom moov", so it seems like an adequate place to ask:
I too cannot find the "optimize for streaming" option when selecting the MP4v2 output format, the only thing that's there is the iPod option, but that does nothing. Is there any switch to flip or special version to install? I currently have 2.6.7 x64.
The older 2.5.6-1 version of AviDemux doesn't even have the MP4v2 option.

mean

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10971
It should be done by default EXCEPT on windows where it does not work

sp00n

  • Newbie
  • *
  • Posts: 6
It should be done by default EXCEPT on windows where it does not work
Good to know. Are there any intentions to make this the default in windows as well?

For the time being I've found QTIndexSwapper 2 to be the easiest solution to move the atom data. But it would be nice to not have to use another program to do the task.