From owner-freebsd-multimedia Tue Mar 30 5:52:33 1999 Delivered-To: freebsd-multimedia@freebsd.org Received: from vulture.dmem.strath.ac.uk (vulture.dmem.strath.ac.uk [130.159.232.158]) by hub.freebsd.org (Postfix) with ESMTP id 318F914E05 for ; Tue, 30 Mar 1999 05:52:15 -0800 (PST) (envelope-from jen@vulture.dmem.strath.ac.uk) Received: from vulture.dmem.strath.ac.uk (localhost [127.0.0.1]) by vulture.dmem.strath.ac.uk (8.8.8/8.8.8) with ESMTP id OAA15477 for ; Tue, 30 Mar 1999 14:51:48 +0100 (BST) (envelope-from jen@vulture.dmem.strath.ac.uk) Message-ID: <3700D6F4.59484E52@vulture.dmem.strath.ac.uk> Date: Tue, 30 Mar 1999 14:51:48 +0100 From: Jennifer Clark X-Mailer: Mozilla 4.5 [en] (X11; I; FreeBSD 2.2.7-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: multimedia@freebsd.org Subject: Re: off topic - video compression .avi -> .mov Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Hi, I've been asked to contribute to this thread (by a colleague on this list) since I did exactly what is stated in the topic a few days ago. Here's how :-) My plan was to extract every frame of a soundless AVI file, perform some simple image processing on each frame, then compress the individual frames into a mpeg file. The first step prove to be tricky; I had initially hoped that xanim (from the graphics directory in ports) would have an option to output individual frames as ppm files, for example, but this did not appear to be the case. A bit of searching on the web, however, turned up a patch to xanim that allows you to do exactly this. You can download the patch from here: http://www4.informatik.uni-erlangen.de/~jnweiger/mpeg/mpeg.html It says the patch is for xanim 2.70.64, but it seemed to work ok on 2.70.7.0. There is also a patch for extracting audio on this page, although I have not used it. Using the patched xanim, I extracted all the individual frames as ppm files, which I further processed with the NetPBM package, also in /usr/ports/graphics. The processing was fairly simple; each frame was cropped, gamma corrected, sharpened, then scaled to an appropriate size. I only came across one problem in this, that the netpbm program pnmnlfilt, which can be used as a sharpening filter, bombed out with a floating point exception. The problem was traced to the part of the code which sets up the filter; essentially, it would attempt to set up a filter to cope with images of greater than 8 bits per colour component per pixel depth, which would result in it trying to use scaled integers greater than INT_MAX or less than INT_MIN. A modification to only allow images with a maximum of 8 bits per colour component fixed the problem. I have a patch available for this if anyone wishes it. Once I had batch processed all the individual frames with netpbm, I used the program mpeg2encode from ports/graphics/mpeg2codec to convert all the frames into an mpeg 1 movie. The scripts necessary to do this appear complex, but using the examples in /usr/X11R6/share/mpeg2/ as templates makes the exercise fairly trivial. While I have not compressed audio into an mpeg video stream before, this does appear possible, using /ports/graphics/mplex and /ports/audio/mpegaudio. If anyone has any more questions on this, please email me directly as I am not currently subscribed to this mailing list. -- Jennifer Clark http://telepresence.dmem.strath.ac.uk http://www.crmjewellery.co.uk http://www.furniturenet.co.uk To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message