Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 5th July 2015, 10:17   #1  |  Link
NyaR
Registered User
 
Join Date: Nov 2012
Posts: 10
[x /H264]: moov atom at the front of the file (Fast Start)

Hi all,

I am working with Avisynth, megui, and h264 to create the ultimate quality presets for YouTube.

YouTube's suggestion is to put
Quote:
moov atom at the front of the file (Fast Start)
I've looked around but cannot find a method to achieve this in h264/x264.

Please assist if there is a command line I can use in h264 / x264 to put moove atom to the front of file.

Thank you.
NyaR is offline   Reply With Quote
Old 5th July 2015, 10:26   #2  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
That's usually done at the muxing stage. Did you confirm that MeGUI isn't doing this already?

http://forum.doom9.org/showthread.php?t=168601
sneaker_ger is offline   Reply With Quote
Old 5th July 2015, 15:10   #3  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
You can think of the moov atom is something like the global "index table" of the MP4 file. It can be located at the beginning of the file (before mdat atom) or at the end of the file (after mdat atom).

For local file playback it doesn't matter much, but for streaming (progressive download) you want to have the moov atom at the beginning of the file - for obvious reasons.

However, x264 will append the frames to the MP4 file as they are encoded. And, since the exact size of each frame cannot be known before they have actually been encoded, the index (moov atom) will be written last, at the end of the file.

So you cannot make x264 output an MP4 file with moov atom at the beginning. At least not directly. But you can achieve this easily with a tool like MP4Box or AtomicParsley!

Code:
mp4box.exe -add c:\Temp\input.mp4 c:\Temp\output.mp4
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 5th July 2015 at 15:23.
LoRd_MuldeR is offline   Reply With Quote
Old 5th July 2015, 22:28   #4  |  Link
NyaR
Registered User
 
Join Date: Nov 2012
Posts: 10
Thanks for helping me out sneaker_ger and LoRd_MuldeR.

As it stands I am using Sony Vegas to output a .avi with Debugmode frameserver. Then I grab that .avi Megui and create an AVS for it and put the same .avi as the audio input. Then MeGUI muxes the two together into an mp4 - and it already puts moov atom to front!

I never attempted to put moov atom to front so I figured it wasn't. By using mp4box.exe -info I was able to find that it is.

I will post back here in a month or two with a guide for the ultimate presets once I am certain they are complete
NyaR is offline   Reply With Quote
Old 9th July 2015, 16:18   #5  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,752
Quote:
Originally Posted by LoRd_MuldeR View Post
For local file playback it doesn't matter much, but for streaming (progressive download) you want to have the moov atom at the beginning of the file - for obvious reasons.
...unless the file is on a server that supports byterange requests, in which case many players will still work correctly.

Which is dangerous, because the file might look like it's fine with some server/player combinations, and work horribly with others. Making Fast Start all the more important, since just having the file work in progressive download doesn't mean it'll always work.

This was such a huge problem 5-20 years ago. Fortunately we now have adaptive streaming with fragmented mp4 and moof headers for commercial content delivery.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Reply

Tags
h264, x264

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:39.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.