Linux: moving moov atom index to the beginning of the file

If you have a streaming server, in my case nginx, and your webmaster is telling you that the movies are not starting to play until the browser have finished buffering it, most likely there is a problem with your video files.
To be more specific, your moov atom index is missing or it is at the end of the file.

If you're on case two, where the moov atom index is at the end of the file, you can fix it in a few ways.
The first way is using ffmpeg:
[root@centos6 ~]# ffmpeg -i movie.mp4 -movflags faststart movie-fixed.mp4
The second one, the preferred  way, is using MP4Box:
[root@centos6 ~]# MP4Box -add movie.mp4 -isma movie-index.mp4

If you need to automate this fixing process, you cand use something like this:
 [root@centos6 ~]# for m in $(ls *.mp4);do MP4Box -add ${m} -isma ${m%%.*}-fixed.mp4

Comments

Popular posts from this blog

JunOS - mount USB stick

Linux: Versioning the /etc/ configurations using 'etckeeper'