[MPlayer-users] ANNOUNCE: mencoder - 3-pass encoding

Arpi arpi at thot.banki.hu
Sat Jan 26 23:52:01 CET 2002


Hi,

I've implemented 3-pass encoding (is it a good name for it?) into mencoder.
What's it?

first pass:
   - encode/convert/copy audio
   - do PTS correction (keep A-V sync), calc frame skip/repeats (-ovc frameno)

second pass:
   - encode video (pass 1) -> create divx4.log

third pass:
   - copy audio from file (frameno.avi) created at first pass
   - encode vbr video (pass 2) using divx4.log from second pass

Why is it good?
- encode audio only once
- after first pass, you'll know exactly how many bytes required for audio
  and avi headers/index. so you can calculate accurate bitrate value for video!
  it's easy:  (total_cd_disk_space-first_pass_filesize)/total_time/125 (kbits)

How to use?
first pass:
  rm frameno.avi  # <= important!
  mencoder [your options and filename] -ovc frameno -o frameno.avi
  [now calculate the bitrate for video from file size and time]

second pass:
  mencoder [your options and filename] -nosound -pass 1

third pass:
  mencoder [your options and filename] -oac copy -pass 2

As you see, it's a bit tricky.
Mencoder checks for file named frameno.avi, and if found, it will use audio
track from this file and use video skip/dup control from its special video track.
This file must have video fourcc and format FrNo. (made by -ovc frameno)
(each video chunk contains only the number of input video frame)

Your next question:
why doesn't do mencoder all of these automatically, i none step?
Answer:
too hard to implement now.
use the force, source or shell. i prefer small script for this job.


A'rpi / Astral & ESP-team

--
mailto:arpi at thot.banki.hu
http://esp-team.scene.hu




More information about the MPlayer-users mailing list