resize of wide source results in wide black border in output (N800)

Bug #453582 reported by Andrew Jorgensen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Arista Transcoder
In Progress
Undecided
Unassigned

Bug Description

I transcoded a 16:9 720x480 source (.ogv) using the N800 profile. The end result was excellent (thanks for the awesome software!!!) except that the video has large black borders on the sides. On the device this results in a black border around the entire screen.

Revision history for this message
Andrew Jorgensen (ajorg) wrote :
Revision history for this message
Andrew Jorgensen (ajorg) wrote :
Revision history for this message
Andrew Jorgensen (ajorg) wrote :

The output size is 462x224 instead of 400x224 like the profile says it should be. I'm wondering if this has something to do with aspect ratio calculations. It does seem that the output file has square pixels, and we know that a 16:9 720x480 has pixels which are taller than they are wide.

Revision history for this message
Andrew Jorgensen (ajorg) wrote :

I poked around in the code a bit and found the parts in transcoder.py where the videobox stuff is calculated. Commenting out the videobox lines results in a output at 398x224.

Moving the subsequent pixel-aspect-ratio lines above the videobox calculations results in 400x224 but it adds an ugly green vertical bar on the right side.

Revision history for this message
Andrew Jorgensen (ajorg) wrote :

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

            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
            if owidth > wmax:
                width = wmax
                height = int((float(wmax) / owidth) * oheight)
            if height > hmax:
                height = hmax
                width = int((float(hmax) / oheight) * owidth)

            # 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
            if width % 2:
                width += 1
            if height % 2:
                height += 1

Changed in arista:
status: New → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.