2

Several of my albums have their metadata at the end of the files. This is fine until you actually want to stream one of them to a network media player. The player either dumps out or complains.

Thankfully there's a little tool that can suck the data up from the end and inject it at the front. Less good is its syntax. This is the only format it accepts:

qt-faststart <infile.mov> <outfile.mov>

There's no option for passing it a directory. No option for multiple files. No option for in-place fixing.

How can I make a command like this work for my files, assuming I want to handle every file in a directory with the same, given extension?

2 Answers 2

2

I tweaked Oli's response. If these is an error (ie if the MOOV is not at the end of the file), the script above will result in the file being deleted. This version avoids that by mv'ing the tmp file at the end. If the qt-faststart fails, there is no tmp file so the mv fails, too, retailing the original file.

find -iname '*.mp4' -exec sh -c 'echo "{}"; qt-faststart "{}" tmp; mv tmp "{}" ' \;
1

The biggest problem here is not being able to overwrite the same file. We need to move the file out of the way and then write the new one with qt-faststart and then clean up:

find -iname '*m4a' -exec sh -c 'mv "{}" tmp; qt-faststart tmp "{}"; rm tmp' \;

Bish bash bosh, fixed album.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .