Crop multimedia with tk's place

With some tricks, you may display a multimedia (video) inside a frame and crop/pan its contents interactivelly. Here is my recipe:

1- Create a regular frame with the desired viewport size, and place/pack/grid-it somewhere.

  pack [frame .f -width 400 -height 400]

2- Create the container frame, where the mplayer will be displayed. Place it in its parent window.

  frame .f.mp -container 1
  place .f.mp -x 0 -y 0 -anchor nw

3- Exec mplayer with at least the -zoom and -wid options. Change dogville.avi for the name of your media to play.

  exec mplayer -vo x11 -vop scale=720:480,eq -zoom -wid [winfo id .f.mp] dogville.avi &

4- Adjust both -relwidth and -relheight to something above 1.0 and also change -x and -y to select the cropping region.

  place config .f.mp -relheight 2.5 -relwidth 2.5 -x -150 -y -300

You may then issue other "place confg" commands to change -x and -y, to change your viewport. Of course, by changing the other frame size, you may also change the size of the viewport. I have used this is a jukebox which displays a full screen video (with a song playing, of course) which may be captured into a small square frame in place of one CD cover. -- Rildo Pragana