[MEncoder-users] x264 questions

Peter Cordes peter at cordes.ca
Sun Nov 25 00:15:08 CET 2007


On Sat, Nov 24, 2007 at 04:19:23PM -0400, Peter Cordes wrote:
> On Wed, Nov 07, 2007 at 05:54:21PM -0700, Loren Merritt wrote:
> > On Tue, 6 Nov 2007, Rich Felker wrote:
> > > On Tue, Nov 06, 2007 at 11:01:40AM -0800, RC wrote:
> > >> On Tue, 6 Nov 2007 13:50:25 -0500
> > >> Rich Felker <dalias at aerifal.cx> wrote:
> > >>
> > >>> Nope, nothing was fixed. The files will still be horribly broken.
> > >>> Someone just removed that option without asking me while I was away
> > >>
> > >> ------------------------------------------------------------------------
> > >> r23976 | michael | 2007-07-31 10:28:47 -0700 (Tue, 31 Jul 2007) | 5
> > >> lines
> > >>
> > >> get rid of this idiotic
> > >> i_certify_that_my_video_stream_does_not_use_b_frames muxer_lavf can now
> > >> generate correct files with b frames as long as the timestamps provided
> > >> to it are correct (they should be with lavc encoding, expect trouble
> > >> with stream copy though)
> > >
> > > Hmm, since when does mencoder use the timestamps at all??? AFAIK it
> > > does not... Can anyone confirm that this works? If so then mencoder is
> > > nowhere near as broken as we expect it to be, but I'm quite
> > > doubtful...
> > 
> > ~> mencoder -ovc lavc -of lavf -lavfopts format=mp4 in.avi -o out.mp4
> > Works.
> > 
> > ~> mencoder -ovc lavc -lavcopts vmax_b_frames=1 -of lavf -lavfopts format=mp4 in.avi -o out.mp4
> > Horribly broken. mplayer -demuxer mp4 can't even decode it, let alone 
> > check timestamps. -demuxer lavf and ffplay work. MP4Box can't parse it.
> > 
> > ~> mencoder -ovc lavc -lavcopts vmax_b_frames=1 -of lavf -lavfopts format=mkv in.avi -o out.mkv
> > Works, including correct timestamps.
> > 
> > ~> mencoder -ovc x264 -x264encopts qp=20:bframes=1 -of lavf -lavfopts format=mp4 in.avi -o out.mp4
> > Wrong timestamps. mplayer plays it anyway.
> > 
> > ~> mencoder -ovc x264 -x264encopts qp=20:bframes=1 -of lavf -lavfopts format=mkv in.avi -o out.mkv
> > Wrong timestamps. mplayer plays it anyway.
> 
>  With mkv output, I found that the output of the first pass plays ok in vlc.
> But now that I've tried it again, it doesn't seem to be working for me.
> 
>  Output of second (and later) passes play with the frames in the wrong
> order, so everything jitters back and forth.  This is like what you get with
> raw .264 output played back by mplayer.  The first pass plays smoothly, but
> later passes play out of order.
> 
>  I'm going to try using mkvextract to get raw .264, then
> MP4Box -new -flat ...
> mkvmerge ...

 It works, but you have to use --raw, otherwise mkvextract says:
mkvextract tracks ../foo.pass2.mkv 1:foo.264 2:foo.ac3
Error: Track 1 with the CodecID 'V_MPEG4/ISO/AVC' is missing the "codec
private" element and cannot be extracted.

 What's in the CodecPrivate, anyway?  The frame rate, the PAR?

mkvextract tracks ../s2d3e2.try3.pass2.mkv --raw 1:foo.264 2:foo.ac3
Extracting track 1 with the CodecID 'V_MPEG4/ISO/AVC' to the file 'foo.264'. Container format: raw data
Extracting track 2 with the CodecID 'A_AC3' to the file 'foo.ac3'. Container format: Dolby Digital (AC3)

MP4Box -new -flat -fps 23.976023976 -add foo.264 foo.mp4
AVC-H264 import - frame size 608 x 400 at 23.9760 FPS
Import results: 66464 samples - Slices: 881 I 22741 P 42842 B - 1 SEI - 835 IDR
        Stream uses B-slice references - max frame delay 2
	Saving foo.mp4: Flat storage
	
# I could have taken the ac3 from the mplayer output mkv, and avoided
# mkvextracting it, since in this example I'm not transcoding it.
mkvmerge foo.mp4 foo.ac3 -o foo.mkv

foo.mkv seems to be ok.  vlc plays it ok, except with noticeably worse
quality than when mplayer or xine plays it.  There is blockiness that jumps
flickers around.  Like maybe frames aren't using the right reference frames.
Hmmm.

 totem/gstreamer plays it all jerky, like only every 2nd or third frame is
displayed at all.  Maybe it's not decoding b frames.  Maybe the frames it
skips are the same ones that vlc decodes with the wrong reference frame.


 So -of lavf -o foo.mkv is a total washout for mencoder with x264 and
bframes with b_pyramid.

 Maybe mp4 will work better...


-- 
#define X(x,y) x##y
Peter Cordes ;  e-mail: X(peter at cor , des.ca)

"The gods confound the man who first found out how to distinguish the hours!
 Confound him, too, who in this place set up a sundial, to cut and hack
 my day so wretchedly into small pieces!" -- Plautus, 200 BC



More information about the MEncoder-users mailing list