[MPlayer-users] Script update

Loren Merritt lorenm at u.washington.edu
Tue Jul 20 22:34:17 CEST 2004


On Tue, 20 Jul 2004, Meino Christian Cramer wrote:
> From: Martin Collins <martin at mkcollins.org>
>
> > >   Why all this "divided by 16". I have no problems watching the
> > >   results with mplayer. Or is there another trick I dont know yet?
> >
> > It's to get the best performance out of the encoder. Your result may
> > be watchable but it could have been smaller/better quality.
>
>   Ah! Got it! Will see, how I can put this into the script without
>   killing the possibility to not follow the "rule of the sixteen" --
>   ...if one wants to...

No! You _always_ encode at resolutions divisible by 16. If you don't want
to crop off the extra lines, then scale to the next lower resolution. If
that changes the aspect ratio, then make it anamorphic.
(with "-lavcopts autoaspect", and/or with mkvmerge (below))
If you're encoding at high bitrates and don't want to lose detail to
downscaling or cropping, then even upscaling is better
(compression efficiency wise) than encoding to non-mod-16 resolutions.

> > If you use -dumpaudio instead then encode the audio using lame or
> > oggenc you can measure the size of the audio and calculate the
> > required video bitrate for any target size.
>
>   May be a very newbie question, but...
>   How ?

  mplayer dvd://42 -alang en -vc null -vo null -ao pcm -aofile foo.wav
  oggenc -q 4 foo.wav

> > It also allows the use of
> > vorbis or other audio codecs not directly supported by mencoder.
>
>   How to playback then?

MPlayer supports everything. It's just mencoder that's limited.

> > use -oac copy on the two video passes, which maintains sync, then mux
>
>   Stop! One moment please...
>
>   Mux? What is "mux" and how can I "mux" something?
>   Container?
>   ...please...what ?

"container" is the file you put video and stuff in. A compressed bitstream
isn't very useful by itself: you need a way to seek, and some headers to
tell you what compression format/resolution/etc it is.

The most common container format, and the only one supported by mencoder,
is AVI (and sorta mpeg). But AVI isn't the best container out there. The
best one IMHO is Matrsoka, (at least until we get around to finalizing
Nut). Matroska supports things like VBR audio (including Vorbis),
multiple audio streams, subtitles, chapters, seeking without an index,
and all with less bitrate overhead than AVI.

"mux" is to put video and audio and metadata into a container file.

To mux:
Compress video to foo.avi (with perhaps -oac copy to maintain sync,
though I've never needed it), and compress audio separately as above.
Then:
  mkvmerge -o foo.mkv -A foo.avi foo.ogg

(With a bunch more optional parameters if you want the other features I
mentioned.)

> > > > This is why I like to see people's scripts; there's always
> > > > something in them that strikes me as bizarre :-) I see now why you
> > > > export all your variables.
> > >
> > >   Yes...äh...why?
> >
> > Opening a new terminal window for each encoding pass is not
> > necessary.
> > I do my encoding in the background while I do something else. Having
> > windows pop up at random could get irritating.

Likewise.
I use "nohup nice +19 my_encode_script &" and forget about it for a day.

>   That's a matter of personal preferences.
>   I will make it switcheable...
>
> > >   But If you another smooth way to feed more than one file into
> > >   mencoder seamlessly I am open for any improvement!
> >
> > It is usually recommended to either encode straight from the dvd
>
>   urks...not with /my/ "drive"... ;)
>
> > or use
> > vobcopy to rip the vobs first or to cat the vobs in to one file before
> > encoding them.
>
>   What is the problem when catting more than one file in comparison
>   with catting one file?
>
>   Does some systems/OSSes hickup?

It depends on the input format. The only problem I've noticed with vobs is
that you don't have the vts_*.ifo when catting, so you can't use -slang
or -alang or -chapter. But really, it's just as easy to use
  mencoder dvd://42 -dvd-device /path/to/vobs/
than
  cat /path/to/vobs/vts_42_*.vob | mencoder -


However, I have yet to find a good way to take multiple avis as input.
Sometimes hqdn3d just doesn't cut it, so I use Avisynth for filtering,
and save the intermediate video to huffyuv. But Wine doesn't support
files bigger than 4GB, avicat is limited to 2GB (doesn't use ODML), and
you can't just
  cat *.avi | mencoder -
(It stops after encoding the first avi.)

I have tried looking into making mencoder take multiple input files, but
haven't made heads or tails of the mess that is mencoder.c

Maybe a libavcodec wrapper for Avisynth is next...

--Loren Merritt




More information about the MPlayer-users mailing list