codeblog code is freedom — patching my itch

July 13, 2008

zooming in Xine

Filed under: Blogging,Multimedia,Ubuntu — kees @ 11:34 pm

I use Xine to watch DVDs. In the past I’ve encountered “full screen” (4:3) DVDs that carried a wide-screen (16:9) image. This means there were black bars on the top and bottom of the video frame. When watching this sort of video on a 16:9 monitor, you end up with a full border of black surrounding the image. I have encountered this much more frequently when recording standard definition TV that contains wide-screen video. For example, many music videos on MTV have a wide aspect, but are displayed with top/bottom bars in the 4:3 standard definition frame:

16:9 displayed in 4:3 with black top/bottom bars

Displayed on a 16:9 monitor, in Xine:

16:9 within 4:3 on a 16:9 display resulting in black border

In MythTV, there is a “zoom” function that zooms the video, matching the width of the frame to the width of the display. This ends up cropping the top and bottom black bars, allowing the zoom to fit to the width of the frame:

zoomed to 16:9, cropping unneeded 4:3 bars

I have been unable to find such a feature in either Xine or MPlayer. A weekend ago I ran into another DVD doing the wide-screen-in-4:3 trick, and wrote a patch to Xine to create a zoom post-processing filter. Now I can start Xine like this:

xine --disable-post --post zoom path/to/video

And Ctrl-Alt-Shift-P will let me enable-disable post processing. In my case, I’ll be mapping the VPProcessEnable to the same lirc button I use for zooming in MythTV.

© 2008 – 2015, Kees Cook. This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 License.
CC BY-SA 4.0


  1. If you running compiz you can enable the “zoom” plugin then use ctrl-mousewheel to zoom in and out. Works pretty sweet (and the scaling gets done on the gpu).

    Comment by Adam — July 14, 2008 @ 3:56 am

  2. “crop” & “expand” options in mplayer package do a rather good job too :)

    Comment by pierre — July 14, 2008 @ 8:00 am

  3. The real goal I have is to do this with a single remote-control button via LIRC. I’m using Xine, MPlayer, and MythTV in full-screen mode on a TV so compiz and non-automate-able command lines aren’t an option. MPlayer’s crop tool cannot be enabled/disabled on the fly, and Xine’s “ZoomIn” (ctrl-z) only operates in 1% increments. I have an “okay” solution for MPlayer that runs “cropdetect” the first time a video is displayed, and the results are stored for the following runs, which get a “crop” commandline. But there are still non-functional corner-cases.

    Comment by kees — July 14, 2008 @ 10:30 am

  4. If I’m not mistaken about what you’re trying to do, the “e” and “w” keys in mplayer are probably useful to you.

    Comment by Paulus — August 9, 2008 @ 1:48 am

  5. @Paulus @mod

    yea ‘w’& ‘e’ will do it in mplayer – default keybindings with mplayer use panscan whereas smplayer frontend keybindings use zoom for ‘w’ and ‘e’ by default.
    on command line -panscan #(from 0 to 1)
    zoom works nicer if you have video encoded w/ the blackbars.

    defiantly essential knowledge for :
    find ‘looney tunes’ | shuf -n 6 | mplayer -fs -panscan .6 -playlist –

    Comment by ortango — December 8, 2010 @ 3:08 pm

Powered by WordPress