Changes between Version 3 and Version 4 of HowToCheckIfFaststartIsEnabledForPlayback


Ignore:
Timestamp:
Nov 6, 2021, 3:03:47 AM (5 years ago)
Author:
Pascal S
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowToCheckIfFaststartIsEnabledForPlayback

    v3 v4  
    77This '''How to''' applies to '''H.264/MP4''' files only but will probably work with '''H.264/MOV''' files too.
    88
    9 Streaming web sites recommend to upload videos with Fast Start enabled. It allows video playback to begin before the file has been completely downloaded.
     9Streaming web sites recommend to upload videos with Fast Start enabled. This allows video playback to begin before the file has been completely downloaded.
    1010
    1111Why ?
    1212
    13 Normally, a MP4 file has all the metadata about all packets stored at the end of the file, unless it has been created by adding the '''-movflags faststart''' option to the ffmpeg command line. In this latter case, an atom named "moov" is moved at the beginning of the MP4 file during the ffmpeg second pass.
     13Normally, a MP4 file has all the metadata about all packets stored at the end of the file, in data units named atoms. The "mdat" atom is located before the "moov" atom. If the file is created by adding the '''-movflags faststart''' option to the ffmpeg command line, the "moov" atom is moved at the beginning of the MP4 file during the ffmpeg second pass. By using this option, the "moov" atom is located before the "mdat" atom.
    1414
    15 Therefore, the location of the "moov" atom in an existing MP4 file (begining or end) helps to check if Fast Start is enabled or not for this file.
    16 
    17 Another atom named "mdat" may also help. If the "moov" atom is located before the "mdat" atom then the file is enabled for Fast Start playback.
     15In other words, the file is enabled for Fast Start playback only when the "moov" atom is located before the "mdat" atom.
    1816
    1917== Prerequisites ==
     
    3432pause
    3533}}}
    36 This batch file searches only the first occurence of either "mdat" atom or "moov" atom (i.e. grep -m 1) within each MP4 file in the current directory. The output listing contains two lines for each file :
     34This batch file searches the first occurence of either "mdat" atom or "moov" atom within each MP4 file in the current directory. The output listing contains two lines for each file :
    3735* the MP4 file name
    38 * the first atom found (either "moov" or "mdat")
    39 
    40 When a MP4 file is enabled for Fast Start playback, the "moov" atom is printed within the second line. If not, it is the "mdat" atom.
     36* the name of the first atom found (either "moov" or "mdat")
    4137
    4238The drawback of this batch file is that it can take a while to run when scanning hundreds of MP4 files.
     
    4440== Alternate method ==
    4541
    46 An alternate method is to truncate the MP4 files before scanning. If the moov atom is not in the
    47 first 4K bytes, the file is not fast start ready.
     42An alternate method is to truncate the MP4 files before scanning. If the "moov" atom is not located in the first 4K bytes, then Fast Start is not enabled.
    4843{{{
    4944@echo off
     
    5146for /F "delims=µ" %%i in ('dir /b /on *.mp4') do (
    5247echo %%i
    53 head -c 4096 "%%i" >temp.mp4
    54 ffmpeg -v trace -i temp.mp4 NUL 2>"%%i.txt"
     48head -c 4096 "%%i" >TEMP.mp4
     49ffmpeg -v trace -i TEMP.mp4 NUL 2>"%%i.txt"
    5550grep -L -m 1 -e "type:'moov'" "%%i.txt" >>OUTPUT.txt
    5651del "%%i.txt"
    5752)
    58 del temp.mp4
     53del TEMP.mp4
    5954pause
    60 exit
    6155}}}
    62 The OUTPUT.txt file contains the list of MP4 files that are NOT fast start ready.
     56The OUTPUT.txt file contains the list of MP4 files that are not enabled for Fast Start playback.