I modified the code a bit more, moving the pixel-aspect stuff up to the owidth calculation at the top of that section. This makes things work correctly except for the mysterious green line.
I think the way to solve the green line bit is to add one pixel to the videobox instead of to the height or width when the dimensions are odd.
code snippet follows (I commented out the videobox stuff because it causes this green line thing and it's probably not appropriate for many devices (including the N800)).
# =================================================================
# Calculate video width/height and add black bars if necessary
# =================================================================
wmin, wmax = self.preset.vcodec.width
hmin, hmax = self.preset.vcodec.height
I modified the code a bit more, moving the pixel-aspect stuff up to the owidth calculation at the top of that section. This makes things work correctly except for the mysterious green line.
I think the way to solve the green line bit is to add one pixel to the videobox instead of to the height or width when the dimensions are odd.
code snippet follows (I commented out the videobox stuff because it causes this green line thing and it's probably not appropriate for many devices (including the N800)).
# ======= ======= ======= ======= ======= ======= ======= ======= ======= == ======= ======= ======= ======= ======= ======= ======= ======= == vcodec. width vcodec. height
# Calculate video width/height and add black bars if necessary
# =======
wmin, wmax = self.preset.
hmin, hmax = self.preset.
owidth, oheight = self.info. videowidth, self.info. videoheight
if self.info. videocaps[ 0].has_ key("pixel- aspect- ratio") :
owidth = int(owidth * float(self. info.videocaps[ 0]["pixel- aspect- ratio"] ))
width, height = owidth, oheight
# Scale width / height down
width = wmax
height = int((float(wmax) / owidth) * oheight)
height = hmax
width = int((float(hmax) / oheight) * owidth)
if owidth > wmax:
if height > hmax:
# Add any required padding
vbox = ""
# if width < wmin and height < hmin:
# wpx = (wmin - width) / 2
# hpx = (hmin - height) / 2
# vbox = "videobox left=%i right=%i top=%i bottom=%i ! " % \
# (-wpx, -wpx, -hpx, -hpx)
# elif width < wmin:
# px = (wmin - width) / 2
# vbox = "videobox left=%i right=%i ! " % (-px, -px)
# elif height < hmin:
# px = (hmin - height) / 2
# vbox = "videobox top=%i bottom=%i ! " % (-px, -px)
# FIXME Odd widths / heights seem to freeze gstreamer
width += 1
height += 1
if width % 2:
if height % 2: