[MEncoder-users] h264/aac segfaults on encode, part of encoding lost when reencode to matroska or MP4

Miroslav Rovis m.rovis at inet.hr
Wed Nov 3 03:16:33 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, folks!
I recently upgraded my Gentoo box and now I often get incomplete encodes.

myBox  # mencoder --version
MEncoder SVN-r30554-4.3.4
myBox  # mkvmerge  --version
mkvmerge v4.3.0
(I'll also try v4.4.0 as soon as it'll be there for Gentoo)
The old better working set has these versions installed:
myBox # mencoder  --version
MEncoder SVN-r29796-4.3.4
myBox # mkvmerge  --version
mkvmerge v2.9.9
The MP4Box are same on my old and new Gentoos:
myBox # MP4Box -version
MP4Box - GPAC version 0.4.5

If anything else, any other information, is of importance with this
issue, tell me, I'll post the versions.

The profile in ~me/.mplayer/mencoder.conf I use for encoding is
usually similar to:

[x264_p1]
profile=x264_p1
profile-desc="x264_p1"
ovc=x264=1
x264encopts=pass=1:slow_firstpass:bitrate=900:bframes=1:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=125
vf=harddup
oac=faac=1
faacopts=br=192:mpeg=4:object=2
channels=2
srate=48000
ofps=25

[x264_p2]
profile=x264_p2
profile-desc="x264_p2"
ovc=x264=1
x264encopts=pass=2:slow_firstpass:bitrate=900:frameref=3:bframes=1:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=125
vf=harddup
oac=faac=1
faacopts=br=192:mpeg=4:object=2
channels=2
srate=48000
ofps=25

The command I issue is akin to this:

myBox # do_x264.sh VIDEO.ts  some_number
where  some_number is the seconds to skip (option -ss in man mplayer)
or in simple cases
myBox # do_x264.sh VIDEO.ts 0
(where skip is 0 sec)

with the script /usr/local/bin/do_x264.sh reading;

#!/bin/bash
# Script /usr/local/bin/do_x264.sh
v1=`echo $1 | cut -d '.' -f1`
echo  "\$v1: $v1"
v1_p=${v1}_p
echo  "\$v1_p: $v1_p"
ext=`echo $1 | cut -d '.' -f2`
echo  "\$ext: $ext"
mencoder -ss $2 $v1.$ext -o ${v1_p}1.avi -profile x264_p1
mencoder -ss $2 $v1.$ext -o ${v1_p}2.avi -profile x264_p2

(I usually add one or two a little more sophisticated suppliments to
this for cropping and more, if somene finds this useful, I can post
those.)
All the above worked just great for a huge mileage untill the upgrade.
Upon the upgrade, I first noticed that the matroska made from the
encodes produced by the above method, could not be played on my four
or six months older same Gentoo system (still sitting as it was cloned
onto another box). Just a little noise video and audio and exit.
I believe I'll have to get back to that later or in the next post, if
I hopefully find someone either with similar problem or willing to
help solve this issue for the community.
As short digression, I dedicated time to learn to encode matroska from
avi files gotten with methods as above or other, back when I was
advised on this list on avi and mp4 and mkv or in connection, and that
was after the joint successful workaround that some other of us found
on how to encode VHS with mencoder (there was the sync issue that made
most of us almost quit trying), all of that I believe can easily be
found mostly on mencoder's list and some on mplayer's. Yes, I remember
now, the hints were on mp4, but I settled for mkv and got best results
with it until the recent upgrade.

I am currently stuck with an incomplete encode that I fail to
understand the causes of.

Nearly three hours of video, but the encode ended with a segfault and
only a little more than two hours could successfully be encoded to
matroska with:
mkvmerge -o VIDEO.mkv VIDEO_p2.avi
(The procedure described further above gives VIDEO_p2.avi after second
pass)
The rest is still there though, and I can watch all the stretch of
almost an hour that could not be encoded to matroska, with:
mplayer -forceidx VIDEO_p2.avi

The thing is, trying to encode to mp4 with:
MP4Box -aviraw video VIDEO_p2.avi
which gives VIDEO_p2_video.h264
MP4Box -aviraw audio VIDEO_p2.avi
which gives VIDEO_p2_audio.raw
mv -iv VIDEO_p2_audio.raw VIDEO_p2_audio.aac
MP4Box -add  VIDEO_p2_video.h264  -add  VIDEO_p2_audio.aac  VIDEO.mp4
gave a similar nearly 1 hour short mp4.

The sync is also not quite right toward the last stretches of mp4 or
mkv encodes.

The following somewhat complicates the issue, but it needs to be told.
The alternative is reencoding all of this and posting when it is done,
which is about half a day from now (old and slow system). I do intend
to do that as well probably, but read on.
With my old install, I could any time Ctrl-C the encodes with my
do_x264.sh script during the first encode. The divx2pass.log and
divx2pass.log.mbtree would be perfect for the second pass to complete
faultlessly.
With the new upgraded version this is, possibly, not anymore the case,
although I am not sure.
I'm saying that because I did issue a Ctrl-C and got the second pass
encode to start, on the VIDEO.ts file.
Likewise, with the old system, I could easily encode to matrska the
whole length of any VIDEO_p2.avi files that mencoder segfaulted on
leaving them with incomplete index (if I understand well). Those
VIDEO_p2.avi files that on playing with with command:
 mplayer -osdlevel 3 VIDEO_p2.avi
would show the time length of the video always 0:00 and not the really
encoded length.

Pls., if anyone is listening in, what other information do I need to
provide to look into solving these issues?

Folks, I know this is incomplete. But I need feedback to learn what
more is needed to identify the problem...
And I am reencoding, without issuing and Ctrl-C.
No rush. Until solved I am pretty blocked in my work.
Thanks for looking into this!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzQxf0ACgkQ5NaGZVDan0qoNwCguAJi/gPjSyHvrhOgBbIMi1fe
x1QAnj1RqCF7FRgEQGExjP+kgBYV/Mzw
=ujzY
-----END PGP SIGNATURE-----



More information about the MEncoder-users mailing list