[MEncoder-users] What's wrong with this script (encoding x264 in mkv-container)

R.L. Horn lists at eastcheap.org
Tue Mar 24 21:56:57 CET 2009

On Mon, 23 Mar 2009, snacky at ikaruga.co.uk wrote:

> I hope someone will correct me if I'm wrong, but the only immediate
> difference I can see is that `ls *.mpg` will break if your filenames have
> spaces in them, while "*.mpg" will work just fine either way.

You're not wrong (except, possibly, where especially stupid shells are 
concerned).  Moreover, depending on the locale settings, you might end up 
with question marks in place of special characters.

Rather than `ls *.mpg`, something like the following should be used:

   ls -N -1 *.mpg | tr '\n' '\0' | xargs -0 mencoder [mencoder options]

which isn't quite bulletproof but should at least work for UTF-8 or 
single-byte-encoding filenames without newlines.

More information about the MEncoder-users mailing list