avtools: move buffer management code from avconv to cmdutils.