I am having trouble figuring out how to determine if faststart is set on an MP4 video.
I understand that "moov atom" is the data that needs to be located at the beginning of the file for faststart to be enabled, instead of at the end of the file.
I specifically want to use ffmpeg or ffprobe to determine if it has been moved to the beginning or not already.
On a side note, I understand I can run the following command to move it from the end to the beginning (but I want to find out if it is already there):
ffmpeg -i infile.mp4 -map 0 -c:v copy -c:a copy -c:s copy -c:d copy -c:t copy -movflags +faststart outfile.mp4
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.
Method 1: Download the video again from the source If possible, download the video file again from the source, be it from the Internet, CD/DVD, Android, or other devices. Get your video again, and this time, ensure the file is wholly and appropriately downloaded or transferred without interruption.
The moov atom, aka movie atom, defines the timescale, duration, and display characteristics of the movie, as well as sub-atoms containing information for each track in the movie. The optimal location of the moov atom depends on the selected delivery method.
Run
ffmpeg -v trace -i file.mp4 2>&1 | grep -e type:'mdat' -e type:'moov'
This will produce an output like,
[mov,mp4,m4a,3gp,3g2,mj2 @ 000000000036ca40] type:'mdat' parent:'root' sz: 62740 48 65044
[mov,mp4,m4a,3gp,3g2,mj2 @ 000000000036ca40] type:'moov' parent:'root' sz: 2264 62788 65044
Since moov appears second, it is at the end in this example.
On bash-like shells, escape the single quotes:
ffmpeg -v trace -i file.mp4 2>&1 | grep -e type:\'mdat\' -e type:\'moov\'
For Windows, findstr can be used,
ffmpeg -v trace -i file.mp4 2>&1 | findstr /l "type:'moov' type:'mdat'"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With