bing
tech
leftist
search
bofh
home
prawda
security
links
etext
music
chemistry
feminist
guatemala
home
kaestner
news
study
emu
my stuff
a/v
cooking
Avifile Glue for mpeg2_encode by Adam Williams
Note: you are probably looking for news or
recent patches/tarballs.
The former are to found at the top, right below the toc, the
latter at the bottom of this document. Much of the stuff in between
has to be considered outdated garbage :-)
- Table of Contents
- About
- News
- To Do
- Improvements
- References
- notes
- Precompiled Binaries antiquated
- Known Issues
- Documentation
- Changelog
Coded by Roman Hochleitner (roman at mars tuwien ac at)
and Alexander Oelzant-Faderler (alexander at oelzant priv at) with
help from Josef Schmid and thanks to Sid (Andreas Varga) for
the frames counter and extensive testing against all types
of input sources (including .vobs).
This started as a
simple patch against Adam Williams' heroinewarrior mpeg2_movie to
utilize libavifile by Eugene Smith,
however the project got out of hand and currently supports Romans Nuppelvideo
file format for input and
the MJPEGtools mpeg2enc
YUV4MPEG format for output.
Originally this project's intent was not to become a new package, but only to
provide the previously missing direct avi->mpeg conversion for
the GNU/unix/linux community until the core feature (linking
against libaviplay) was integrated into the main encoder, but this
goal has been abandoned. We currently hope to enable as many encoders
as possible with the avi/nuv/qt-reading functionality.
- since the new toolame-versions
(02h or 02i up) don't have the segfaulting bug anymore, there's no need to
use psy model 1 anymore
- Nuppelvideo
0.5 supported from .7e-pre3 up
- preliminary letterbox-README
- It seems avi2mpegpatch works fine with
libaviplay 0.6 after applying
this small patch to aviplugin.C (integrated as a compile time option
from 7e-pre1 up), Erik I. Bolsø reports
success (small naming/case issues)
- X11/Xvlib.h and X11/Xv.h can
be downloaded since they are the only files needed from the XFree86 4.0
install ... hopefully obsolete soon
- gzipped the .7. patches which were unzipped but had .gz suffixes
- READMEs now available
- We discussed the matter of testfiles. DivX trailers can probably
be found all around the net, so we provide a test Nuppelvideo file
(SAT1 interactive game show).
- It seems we finally found the origin of the source we used:
Andrew Stevens' encoder
that comes with the MJPEGtools
is the basis for the current mpeg encoder of the Heroinewarrior
project and thus also of the avi/nuv-patched version.
There now is a YUVwriter
(made out of spare parts from mpeg2_movie) that produces (or at least
is supposed to produce, it just got ready) YUV-output suitable for
mpeg2enc from the MJPEGtools. exportvideo is a
stripped-down version of the mpeg2_movie tree that contains just the
files necessary for the exportvideo tool.
Dynamic Loading through the glib/gmodule architecture is now
experimentally supported, conditional compilation of the nuv/avi
parts is configurable, too. Don't worry, the pre-linked version
is still the default and works as expected.
- New: versatile audio extractor for
all audio types
- old (more recent patches see above):
roman made a complete
1.5-version with
nuppelvideo for synced recording without framedrops on a
<300Mhz K6 (384x288), so everything current is to be found there
Coming Attractions:
scaling/cutting (new, even more recent patch with letterbox generating
code against the nuppelvideo enabled encoder from roman) works
In addition to the original mpeg2_encode features, the following
have been added:
-D force deinterlace on (1), off (0), auto (-1, default)
-S frame# set start frame
-N frames set number of frames to encode
-G XoutxYout scale to this output geometry
-g WIDTHxHEIGHT+XOFFxYOFF scale from this input window
(negative numbers produce black borders
- try to use multiples of 16)
-Y 0|1|2 YUV4MPEG format version: 0 (old, default), 1 (new)
-a aspectratio used with -Y 1 only
-T timestamptype set timestamptype (1=time,2=framenum)
A severe bug in the B-frame creation has been worked
around which inserted empty frames into mpeg input streams.
- Andrew Stevens' MJPEGtools
provides the original mpeg2enc, some of which was used in the
Heroine project
- Nuppelvideo,
the no-drop recording tool for slower (~ >300 MHz) CPUs and
larger resolutions, derived from RTJpeg
- The Heroinewarrior
project still accounts for much of the framework we wrote our code
into
- libavifile and aviplay - hail Eugene
Kuznetsov aka Eugene Smith (but use the stable versions)
- sampeg-2/4
by Dirk Farin has similar goals, maybe one day he will integrate
libavifile into his encoder (or we might write a YUV4MPEG reader so
the existing tools are applicable ...) (freshmeat entry)
- TooLame for fast
mpeg 2 encoding (warning: psy model 1 (?) seems to have a segfaulting
bug that is triggered every other piece of raw data, workarounds include
using ffmpeg, deleting
4 bytes (1 stereo sample) from the input or using psy model 2)
Producing an MPEG 1 or 2 compatible video stream
from an asf or avi is
easily possible with this patch, however for successful production
of a video clip an audio stream and multiplexing will be necessary.
libavifile comes with a sample program called extractor which reads
500000 bytes of mp3 from a divx, this patch
reads all of it into log2.mp3. Now there is
also a real audio decompressor, try the new version
here! (binary compiled against
0.53)
caveat: version 2 automatically scales to 44100 Hz stereo 16 bps;
upsampling of < 8000 Hz Material doesn't sound particularly good
(I ought to get a better grip of the resampling code from sox I
adapted for this). At least the annoying problem with 48000 kHz
movies most players cannot play should be from the past, the downside
is that this version is quite slow due to the algorithm used.
usage:
avifile_audiodecoder infile.avi outfile.raw
or
avifile_audiodecoder infile.avi "|toolame -b 224 -m s - outfile.mp2"
Unfortunately the plethora of debug output from libavifile makes
it impossible to use stdout directly.
As for the system stream, to our great astonishment the mplexed
system streams grew considerably when we padded them for vcd use.
The culprit was the mplex-hi program (-lo didn't sync or even
play on most players), which used 2048 instead of 2324 for
the sector size. After this minor adjustment vcdpad was content only
to pad the very last sector and leave the movie unharmed otherwise.
To remain at least partly compliant with VCD standards
(and to play the hires-movies on our humble 166MMX pentia)
we decided we had to have B-frames, so we obtained optimum
results using settings of -1 -m 2 -q 30 for hires movies and
-1 -m 2 -q 10 for lo-res cif tv-series. VBR averaged to
about 900 kbps using these settings, which enabled us to
produce (overburned) VCDs of movies up to 96 minutes.
According to roman the .ax codecs (responsible for output quality/
postprocessing) should be disabled (move away from /usr/lib/win32).
Of course this might influence reencoding quality, so YMMV.
- avifile_audiodecoder
- writes raw audio in whatever samplerate and channel settings
the .dll produces, to be fed to toolame or similar
- extractor
- extracts the undecoded audio stream to a file named
"log2.mp3" as is, mostly useful for mp3
divxes (source patch against
libavifile/samples/extractor/extractor.cpp)
- fixed?#include <fourcc.h> required (with libavifile 6 only?)
- some compilation problems (encode only compiles with an additional }
in mpeg2enc.c)
- fixed mpeg2encode ocassionally hangs at the last frame, utilizing
100 % cpu time without harming the stream any further - fixed
in version 2
- fixed (in nuv, too) occasional black frames introduced at avi keyframes? not sure (should be fixed in both dynamic and static versions)
Version 1
- works
- improvements over original mpeg2movie:
- start frame and number of frames to encode are command line
parameters (useful eg for parallel encoding)
- decodes anything libaviplay can read (currently only if it is in
a .asf or .avi-file, since I was too lazy to implement a proper
check)
- produces usable B-frames by buffering frame reads, thus being
able to feed the encoder the frame it needs (no-brainer readpic-patch)
- visible and readable timestamps option for debugging the former
Version 2
- should not hang on last frame any more (stupid while hang)
- mpegs are now seekable (and parallel encodes thus feasible)
Version avi-nuv-scal-dyn (#4)
- As the name suggests, quite a few changes have taken place.
The configure-script has been adopted accordingly. Besides
there have been a few versions bearing that denomination, (then again
previous Nuppelvideo-enabled versions didn't get an entry) so the last
one is assigned #4 and the promise is being made not to do it again
;-)
- Nuppelvideo
Integration: Roman used the RTJpeg sources, an audio grabber and lots
of shared memory to construct a bullet-proof (and most of all pretty
framedrop-proof) capturing program which of course has its own
output format this tool can read
- MJPEGtools mpeg2enc
compatible output: read mpeg (using libmpeg3), quicktime (using
Heroinewarrior code), avi (using libaviplay) or Nuppelvideo
(rtjpeg-spawned) and encode it using Andrew Stevens'
excellent encoder which is far more advanced than Adam Williams'
rip off (it actually produces entirely viewable CBR movies ...)
- When I had a night of time I decided it was time to modularize
the input system ... now there are compile time options for
compiling the nuv-reader or the avi-reader as plugins. Not much sense
yet I admit, but maybe it pays off some time (overall code size
would most certainly be reduced if I unloaded unused plugins, which I
don't (yet) do)
- A scaler has been built in for up/downscaling videos. Since
it only interpolates between four pixels, quality will drop if
you downscale to less than half the original size.
This code can handle out-of-bounds offsets so you can introduce
letterbox-bars, but be warned it'll be a lot of fiddling ;-)
Version 5
- some small bugs have been fixed (like, say, not being able to
decode using libmpeg3 or qt ... :)). There is also
an appropriate usage message for exportvideo:
exportvideo 1.0 (with avi/nuv-patch), 2000/04/04
(C) 1996, MPEG Software Simulation Group
(C) 2001 Roman and Alex (+deinterlace +modules)
Usage: exportvideo [options] <input file> [{outfile.raw|"|encodingprogram"}]
-D force deinterlace on (1), off (0), auto (-1, default)
-S frame# set start frame
-N frames set number of frames to encode
-G XoutxYout scale to this output geometry
-g WIDTHxHEIGHT+XOFFxYOFF scale from this input window
(negative numbers produce black borders
- try to use multiples of 16)
-T timestamptype set timestamptype (1=time,2=framenum)
A -Deinterlace option has been added (mainly to turn Romans
interlacing code off where it was previously turned on by default)
The interesting point is the | ... since libaviplay produces
too much debug output on stdout, it is impossible to use its
stdout, so a pipe hack like the one in avidecoder
had to be used.
Version 6 Wed Apr 4 22:38:01 CEST 2001
- More Bugfixes: configure should work now (again), segfault
on nuppelvideo (which then again shouldn't produce black frames any more)
Version 7 Thu Apr 5 04:31:30 CEST 2001
- auto-scaling is now (re)enabled, specify a geometry for cutting (-g)
and scaling (-G) if this default doesn't suit you
- frame count is correct
- fork waits for kids and should kill them on SIGTERM
- -D for enabling/disabling the deinterlacer roman introduced (actually
present since 4, but not announced :))
Version 7b Tue Apr 24 01:55:13 CEST 2001
- } moved outside #ifdef VIDEO_EXPORT_ONLY due to frequent requests
- READMEs finally included with package
- exportvideo should be makeable now (as opposed to being
a configure time target)
Version 7c Thu Apr 26 00:08:26 CEST 2001
- made #inclusion of <g*.h> and linking of -lg* dependant upon
dynamic compiling (not default), using gtk-config
- configure/Makefile cosmetics (avifile-config)
- IYUV and YV12 seem to produce segfaults instead of Gimages, so
they're commented back out for now; YUY2 is used when available,
RGBA otherwise :-( (would anyone care to try that out with libaviplay
0.6?)
Version 7e-pre1 Wed May 9 03:03:32 CEST 2001
This is just an interim version (and the attempt to get away from
overwriting files again ... it's an addiction ;))
- renamed directories in tgz: mpeg2_movie-1.5-avi-nuv-scal-dyn.version
for the full tree and exportvideo.version for the stripped-down
package
- removed the annoying framenum: debug message from rtjpeg_input.c ;)
- version is now displayed in usage message
- added a configure-switch for avifile 0.6 support (it seems to
work for some people ;)
- replaced mplexhi by romans patched mplexfast version (reads blocks
instead of bytes). still not recommended since the MJPEGtools
mplex is more versatile
- broke everything ;) by introducing aspect ratio calculations (disabled
anyways)
- put linking of -lg* back in since quicktime/libdv seems to need
it (why does that compile although I use --no-firewire?)
0.6?)
Version 7e-pre2 Tue May 15 14:11:02 CEST 2001
- moved the return below the declarations in aspectcode.c. sigh.
Version 7e-pre3 Fri Jun 22 04:00:50 CEST 2001
Version 7e-pre4 Don Jul 5 21:35:04 CEST 2001
Version 7e-pre5 Tue Aug 28 20:35:30 CEST 2001
- included avifile_audiodecoder .02, which now scales to 44100 Hz/16
bit/stereo using the resampling algorithm from sox
Version 7e-pre6 Thu Oct 4 06:21:17 CEST 2001
- YUV4MPEG new format supported
- display aspect ratio (for former) can be passed on the commandline
- new toolame copied to audiomp2 directory (might go away
altogether)
- binary package included (with all libraries: a pita to
download, but runnable everywhere when setting LD_LIBRARY_PATH
to the .bin.-directory)
Version 7e-pre7 Thu Oct 4 17:15:37 CEST 2001
- display aspect ratio switch -a now produces correct
A header element (for new YUV4MPEG output)
Version 7e-pre8 Tue Oct 9 16:29:16 CEST 2001
- dynamic-loading version doesn't have stdout-garbage-bug any more
(closing stdout at the right point helped ...) (configure with
--dynamic --codec-dir=`pwd`/video/codecs or install codecs
in /usr/lib/mpeg2_movie/codecs after compilation)
- sed-oneliner for concatenating files included
- nuv2mpeg-script in contrib (thanks to Leandro Lucarella
(luca at lucarella dot com dot ar))
- yet another YUV4MPEG format (YUV4MPEG2), aspect code now
prudently omitted when 1:1 display aspect ratio seems the only
possible guess (interlace/progressive info omitted too, no point
in inventing nonsense)
- Downloads:
modified: Saturday, 30-Sep-2017 00:13:34 CEST,
retrieved: Saturday, 23-Nov-2024 10:10:38 CET
HTML
4.0?
..
@
!
frames-free pages optimized for use with ©lynx but compatible with any conformant browser