[MPlayer-users] perfect playback from dvd, jerky from mpg4?
Andres Meyer
andres.meyer at computer.org
Thu Apr 3 00:59:07 CEST 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Problem: jerky playback of encoded movie
configuration:
- - Asus A7N (nforce 415), 512MB, 1.533Ghz Athlon XP
- - Gentoo Linux
- - Radeon 8500, XFree 4.2.2
- - sblive 5.1 (all playback stereo)
alsa9 and sourceforge emu10k1 tested for hwac3. not satisfactory -> tests in
stereo with emu10k1 (works perfectly for dvd playback)
- - yahama hifi ac3 decoder available, not used here
- - mplayer 0.90rc5, compiled for AthlonXP
- - silicon image ide controller, DMA on, Maxtor 160GB HD
setup:
dvd image mounted on loopback interface:
losetup /dev/loop/0 shes_all_that.iso
testruns:
mplayer -vo x11 -zoom -ao oss -dvd 1 -dvd-device /dev/loop/0
- -> perfect playback. cpu on ca. 20%
coding:
Trying to get a perfect movie to the harddisk, including the ac3-track:
nice -18 mencoder -dvd 1 -dvd-device /dev/loop/1 -ovc lavc -vop
crop=708:362:6:58 -alang en,de,fr -oac copy -lavcopts
vcodec=mpeg4:aspect=1.81:vhq:v4mv:vbitrate=2000:vpass=1 -o /dev/null; nice
- -18 mencoder -dvd 1 -dvd-device /dev/loop/1 -ovc lavc -vop crop=708:362:6:58
- -alang en,de,fr -oac copy -lavcopts
vcodec=mpeg4:aspect=1.81:vhq:v4mv:vbitrate=2000:vpass=2 -o
"shes_all_that.avi"
mplayer -vo x11 -zoom -ao oss shes_all_that.avi
- -> good sync, goody audio, but somewhat jerky image playback, cpu on ca. 30%
Anybody got an idea why this is? As a perfect dvd playback seems to be
possible, I believe mplayer can detect the correct parameters, so mencoder
should also. It also rules out software timing detection problems, hardware
display problems and hw hard-disk problems. Is it an encoder problem?
Its just that jerkyness that makes the movie worse than the original,
everything else is perfect.
I also tested with -vop detc but it did not change anything
Any ideas would be appreciated,
Andres
PS: my encoding script
#!/usr/bin/python
#
# mencoder dvd backup script
#
# Andres Meyer, 2003
import os
import re
import sys
import getopt
losetup = "/sbin/losetup"
loopdev = "/dev/loop/1"
usage = "enc.py {{-i | --iso} movie.iso | {-d | --dvd} /dev/dvd} [{-o |
- --output} movie.avi] [{-l | --language} en] [-p | --pretend]\nhint: chmod u+s
/sbin/losetup; modprobe loop; chmod 666 /dev/loop/*\n"
try:
opts, tmp = getopt.getopt(sys.argv[1:], "i:o:l:d:p", ["iso=", "output=",
"language=","dvd=", "pretend"])
except getopt.GetoptError:
print usage
sys.exit(2)
source = None
target = None
lang = "en,de,fr"
pretend = None
for o, a in opts:
if o in ("-i", "--iso"):
cmd = "%s -d %s" % (losetup, loopdev)
os.popen(cmd)
cmd = "%s %s \"%s\"" % (losetup, loopdev, a)
os.popen(cmd)
if target == None:
path, ext = os.path.splitext( a)
target = "%s.avi" % path
source = loopdev
if o in ("-d", "--dvd"):
source = a
if o in ("-o", "--output"):
target = a
if o in ("-l", "--lang"):
lang = a
if o in ("-p", "--pretend"):
pretend = 1
if source == None:
print usage
sys.exit(2)
print "source: %s, target: %s, lang: %s\n" % (source, target, lang)
cx = 10000
cy = 10000
cw = 0
ch = 0
trackNum = 1
cropNum = None
dvdInfo = ""
while cropNum == None:
for minute in range( 20, 30):
cmd = "mplayer -vo null -dvd %s -dvd-device %s -vop cropdetect -ss 00:%s:00
- -frames 12" % (trackNum, source, minute)
print "cmd :%s" % cmd
dvdInfo = os.popen( cmd).read()
cropNum = re.compile( r".*\(-vop crop=(.*):(.*):(.*):(.*)\).*").search(
dvdInfo)
print "*************************************************\n"
print dvdInfo
if cropNum == None:
trackNum = trackNum + 1
if trackNum > 9:
sys.exit("************ error *************\n")
break
x = int( cropNum.group(3))
y = int( cropNum.group(4))
w = int( cropNum.group(1))
h = int( cropNum.group(2))
cx = min( cx, x)
cy = min( cy, y)
cw = max( cw, w)
ch = max( ch, h)
print "**********"
print "Crop=(%s:%s:%s:%s)" % (cw, ch, cx, cy)
resMatch = re.compile( r".*Movie-Aspect is (.*):1.*").search( dvdInfo)
aspect = float( resMatch.group(1))
print "Aspect=%s" % aspect
resMatch = re.compile( r".*VIDEO: MPEG2 (.*)x(.*) \(aspect.*\) (.*) fps
.*").search( dvdInfo)
resX = int( resMatch.group(1))
resY = int( resMatch.group(2))
fps = float( resMatch.group(3))
newAspect = (float(cw) / float(resX))/(float(ch) / float(resY)) * aspect
cmd = "nice -18 mencoder -dvd %s -dvd-device %s -ovc lavc -vop
crop=%s:%s:%s:%s -alang %s -oac copy -lavcopts
vcodec=mpeg4:aspect=%s:vhq:v4mv:vbitrate=2000" % (trackNum, source, cw, ch,
cx, cy, lang, newAspect)
cmd1 = "%s:vpass=1 -o /dev/null" % cmd
cmd2 = "%s:vpass=2 -o \"%s\"" % (cmd, target)
print
print
print "%s; %s" % (cmd1, cmd2)
if pretend == None:
os.popen( cmd1).read()
os.popen( cmd2).read()
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+i2s/sOmBKjmDDSMRAnMDAJ9W/mnfbNWocmsahE3dZZHjM4ujrQCfX/1Q
gqacHwGwFx37eUlBv7KetJU=
=5aDz
-----END PGP SIGNATURE-----
More information about the MPlayer-users
mailing list