Re: Fixing mpeg2enc

Andrew Stevens <[email protected]> Mon, 30 Aug 2010 14:29:37 +0200
Newsgroups gmane.comp.video.mjpeg.devel
Message-ID <[email protected]>
On Sun, 2010-08-29 at 09:48 -0700, Steven Boswell II wrote:

> 
> 
> I've been trying to use ffmpeg to encode DVD-grade video from analog
> sources, and no matter how hard I try to push the bitrate or the
> quantization level, or the other parameters that are supposed to
> increase quality, my scenes look blocky.  I've asked the mailing list
> for ideas, but no one seems to know.  (I ended up tangentially helping
> someone ELSE with their mpeg2enc problems. :-)
> 
> ffmpeg does transcoding really well, but stinks at analog-video
> encoding.  When I need to produce a non-MPEG1/2 format (e.g. Flash
> format, for YouTube), I encode the video with mpeg2enc, and then have
> ffmpeg transcode it to the format I want.  That's the only way I've
> been able to get good results out of ffmpeg.
> 
> >If there's really still a niche for mpeg2enc and you can sync me up
> >on the bugs with some nice sample files I'll get it working ...
> >promise!
> 
> I'll start working on demonstration files right now.  But just to get
> your mind working in the right direction:
> 
> [1] MPEG-1 encoding is really broken.  It looks like something's
> overflowing in the DCT conversion (or whatever that step is called).
> I can produce a short clip that generates major artifacts.

MPEG-*1* is still in use?  Cripes!  The DCT is identical for MPEG-1/2.
The difference is that for MPEG-1 coefficients are saturated at   Can
you put a sample where it happens online someplace?  


> 
> 
> [2] MPEG-2 encoding still has that overflow issue with "-q 1".  It
> doesn't happen often, just often enough to make my DVDs look
> unprofessional.  The strange thing is, it looks perfect when I view it
> on my computer -- it just artifacts when played on an actual DVD
> player.  I can provide you with short clips that reproduce the
> problem.

Does the problem also occur if you disable SIMD (MMX support) for
quantization and inverse quantization?  If so, its probably a limitation
imposed by the DVD standard and/or DVD player HW saving msbs in
arithmetic blocks.  If it fails can you put  .iso of failing snippet
online someplace?   

The problem with-only-on-embedded-HW bugs is they're monstrously hard to
pin down without access to a HW development environment / bit-accurate
simulation model.  Its not like you can nail down the offending
macro-block easily :-(  I'd be very tempted to close this bug (not fix
it) my simply flooring q for DVD profiles at 2.  You can easily spend
hours/days ticking forward/backward between DVD player and PC...



> [3] The most-recent bitrate estimation code seriously undershoots the
> target.  The previous code (which, it looks like, I grabbed from CVS
> around March 15, 2005) does a much better job.


I know I know.  It simply is not working properly yet.  In all honesty
I'm tempted to write this off (restore mpeg2encs single-pass
rate-control release) and put effort into ffmpeg.


> [4] The most-recent mplex code seems to have serious trouble with A/V
> sync.  It looks perfect when viewed on my computer, but gets out of
> sync when played on an actual DVD player.  It was especially bad on a
> PAL-format DVD I did a few years ago (most of my analog-video sources
> are NTSC, but I had a friend with a PAL tape that he wanted
> converted.)  Again, the mplex from CVS around March 15, 2005 did a
> better job, though it was still a little out of sync.  (I've been
> using what I call "mpeg2enc-170" and "mplex-170" for a long time now.)

This is kind of weird.  mplex's basic muxing strategy hasn't changed in
years (decades?) unless someone else has fiddled with it.  What kind of
out-sync?   A fixed offset or a steady 'drift'... is there any remux-ing
going on elsewhere in the toolchain -> DVD?

cheers,
  Andrew



------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d