Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect if "faststart" has been applied to video

Tags:

video

ffmpeg

When running "qt-faststart" on an MP4, you're essentially taking the meta data from the back and placing it at the front of the file. In my case, so Flash can properly start playing the video before it's fully done loading.

I have a large number of videos that I'm running through a shell script to encode overnight. When I upload, however, I won't necessarily know in my final folder of videos (on the server) have "qt-faststart" run on it.

My goal is to find the straggler videos and run qt-faststart on them manually, but I'll need a way to compile a list. Is there any way to check for this meta data information with PHP or something? Wondering how I can tell if a video has already had qt-faststart run on it or not.

like image 607
Will Ashworth Avatar asked Jul 11 '11 23:07

Will Ashworth


2 Answers

mediainfo -f file.mp4 | grep IsStreamable

or

ffprobe  -v debug file.mp4  2>&1 | grep seeks 

and

0 seeks

means "faststart" has been applied.

like image 176
user1133275 Avatar answered Oct 17 '22 22:10

user1133275


It shouldn't do any harm to run qt-faststart more than once, it will be a no-op the second time. So the easiest solution is to always run qt-faststart.

For more precise control, I would use the Python translation of qt-faststart: https://github.com/danielgtaylor/qtfaststart

It has functions that examine the atoms in an MP4 file, it shouldn't be too hard to use them to determine whether they need to be reordered.

like image 8
Nathan Whitehead Avatar answered Oct 17 '22 20:10

Nathan Whitehead