diff -ur mythtv-0.20/libs/libmythtv/recordingprofile.cpp mythtv-0.20.modified/libs/libmythtv/recordingprofile.cpp
--- mythtv-0.20/libs/libmythtv/recordingprofile.cpp	2006-09-05 19:52:38.000000000 -0400
+++ mythtv-0.20.modified/libs/libmythtv/recordingprofile.cpp	2006-10-14 14:33:16.000000000 -0400
@@ -434,6 +434,20 @@
     };
 };
 
+class MPEG4AspectRatio: public CodecParam, public ComboBoxSetting {
+public:
+   MPEG4AspectRatio(const RecordingProfile& parent):
+        CodecParam(parent, "mpeg4aspectratio") {
+        setLabel(QObject::tr("Aspect Ratio"));
+        addSelection("Leave", "Leave");
+        addSelection("4:3", "4:3");
+        addSelection("16:9", "16:9");
+        setValue(0);
+        setHelpText(QObject::tr("Sets the aspect ratio of transcoded files"));
+    };
+};
+
+
 class EncodingThreadCount: public CodecParam, public SliderSetting {
 public:
     EncodingThreadCount(const RecordingProfile& parent):
@@ -581,6 +595,7 @@
         params->addChild(new MPEG4MinQuality(parent));
         params->addChild(new MPEG4QualDiff(parent));
         params->addChild(new MPEG4ScaleBitrate(parent));
+        params->addChild(new MPEG4AspectRatio(parent));
 
         HorizontalConfigurationGroup *hq;
         hq = new HorizontalConfigurationGroup(false, false);
Only in mythtv-0.20.modified/programs/mythbackend: version.cpp
diff -ur mythtv-0.20/programs/mythfrontend/playbackbox.cpp mythtv-0.20.modified/programs/mythfrontend/playbackbox.cpp
--- mythtv-0.20/programs/mythfrontend/playbackbox.cpp	2006-09-09 01:25:45.000000000 -0400
+++ mythtv-0.20.modified/programs/mythfrontend/playbackbox.cpp	2006-10-14 16:33:50.000000000 -0400
@@ -2733,7 +2733,6 @@
                      SLOT(changeProfileAndTranscodeMedium()));
     popup->addButton(tr("Low Quality"), this,
                      SLOT(changeProfileAndTranscodeLow()));
-
     popup->ShowPopup(this, SLOT(doCancel()));
     defaultButton->setFocus();
     
Only in mythtv-0.20.modified/programs/mythfrontend: version.cpp
Only in mythtv-0.20.modified/programs/mythtranscode: orig
diff -ur mythtv-0.20/programs/mythtranscode/transcode.cpp mythtv-0.20.modified/programs/mythtranscode/transcode.cpp
--- mythtv-0.20/programs/mythtranscode/transcode.cpp	2006-08-23 18:20:59.000000000 -0400
+++ mythtv-0.20.modified/programs/mythtranscode/transcode.cpp	2006-10-14 16:44:37.000000000 -0400
@@ -383,11 +383,24 @@
 
     int video_width = nvp->GetVideoWidth();
     int video_height = nvp->GetVideoHeight();
+     
+    if (video_height == 1088) {
+       VERBOSE(VB_IMPORTANT, QString("Unlikely the video height really is 1088, using hacks..."));
+    }
+
     float video_aspect = nvp->GetVideoAspect();
+    VERBOSE(VB_IMPORTANT, QString("Transcode: aspect ratio: %1").arg(video_aspect));
+
     float video_frame_rate = nvp->GetFrameRate();
     int newWidth = video_width;
     int newHeight = video_height;
 
+    /* this allows transcoders to have fixed aspect ratios */
+    float newAspect = video_aspect;
+    /* these elements control the on screen cropping */
+    int crop_top, crop_bottom, crop_left, crop_right;
+    crop_top = crop_bottom = crop_left = crop_right = 0;
+
     kfa_table = new QPtrList<struct kfatable_entry>;
 
     if (fifodir == NULL)
@@ -415,23 +428,62 @@
         }
         else if (profile.byName("transcoderesize")->getValue().toInt())
         {
+            int fudge1080 = (video_height == 1088 ? 8 : 0);
+
             nvp->SetVideoFilters(vidfilters);
             newWidth = profile.byName("width")->getValue().toInt();
             newHeight = profile.byName("height")->getValue().toInt();
 
             // If height or width are 0, then we need to calculate them
             if (newHeight == 0 && newWidth > 0)
-                newHeight = (int)(1.0 * newWidth * video_height / video_width);
+                newHeight = (int)(1.0 * newWidth * (video_height-fudge1080) / video_width);
             else if (newWidth == 0 && newHeight > 0)
-                newWidth = (int)(1.0 * newHeight * video_width / video_height);
+                newWidth = (int)(1.0 * newHeight * video_width / (video_height-fudge1080));
             else if (newWidth == 0 && newHeight == 0)
             {
                 newHeight = 480;
-                newWidth = (int)(1.0 * 480 * video_width / video_height);
+                newWidth = (int)(1.0 * 480 * video_width / (video_height-fudge1080));
                 if (newWidth > 640)
                 {
                     newWidth = 640;
-                    newHeight = (int)(1.0 * 640 * video_height / video_width);
+                    newHeight = (int)(1.0 * 640 * (video_height-fudge1080) / video_width);
+                }
+            }
+            /* hack by Patrick Wagstrom to ensure that aspect ratios are enforced
+             * if this is set to 43 then we crop the picture to fit the aspect ratio */
+            if (vidsetting == "MPEG-4")
+            {
+               const Setting* setting = profile.byName("mpeg4aspectratio");
+                if (setting) {
+                    if (setting->getValue() == "4:3") {
+                        VERBOSE(VB_IMPORTANT, QString("Transcode: Got a 4:3 setting"));
+                        newAspect = 1.333333333333;
+                    } else if (setting->getValue() == "16:9") {
+                        VERBOSE(VB_IMPORTANT, QString("Transcode: Got a 16:9 setting"));
+                        newAspect = 1.777777777777;
+                    } else if (setting->getValue() == "Leave") {
+                        VERBOSE(VB_IMPORTANT, QString("Transcode: got a leave setting"));
+                    } else {
+                        VERBOSE(VB_IMPORTANT, QString("Transcode: unable to get aspect ratio"));
+                    }
+                    /* support for cropping... */
+                    if (abs(newAspect - video_aspect) > 0.01) {
+                        if (abs(video_aspect - 1.77777) < 0.01) {
+                            /* working with 16:9 source -- assume the height is correct */
+                            crop_left = (int)(video_width - (video_height * newAspect))/2;
+                            crop_right = crop_left;
+                            newWidth = (int)(newHeight * newAspect);
+                            /* while we're at it, kill the noise on the top of th screen too */
+                            crop_top = 8;
+                        } else if (abs(video_aspect - 1.33333) < 0.01) {
+                            /* working with 4:3 source -- assume the width is correct */
+                            crop_top = (int)(video_height - (video_width / newAspect))/2;
+                            crop_bottom = crop_top;
+                            newHeight = (int)(newWidth / newAspect);
+                        }
+                    }
+                } else {
+                    VERBOSE(VB_IMPORTANT, QString("Transcode: unable to get aspect ratio"));
                 }
             }
 
@@ -445,6 +497,9 @@
             VERBOSE(VB_IMPORTANT, QString("Resizing from %1x%2 to %3x%4")
                     .arg(video_width).arg(video_height)
                     .arg(newWidth).arg(newHeight));
+            VERBOSE(VB_IMPORTANT, QString("Crop Settings %1 %2 %3 %4")
+                    .arg(crop_left).arg(crop_right)
+                    .arg(crop_top).arg(crop_bottom));
         }
         else  // lossy and no resize
             nvp->SetVideoFilters(vidfilters);
@@ -469,7 +524,7 @@
             SetProfileOption(profile, "mpeg4qualdiff");
             SetProfileOption(profile, "mpeg4optionvhq");
             SetProfileOption(profile, "mpeg4option4mv");
-            nvr->SetupAVCodec();
+           nvr->SetupAVCodec();
         }
         else if (vidsetting == "RTjpeg")
         {
@@ -504,7 +559,8 @@
         nvr->AudioInit(true);
 
         nvr->SetFrameRate(video_frame_rate);
-        nvr->SetVideoAspect(video_aspect);
+        /* update the aspect to the new video aspect */
+        nvr->SetVideoAspect(newAspect);
         nvr->SetTranscoding(true);
 
         outRingBuffer = new RingBuffer(outputname, true, false);
@@ -786,8 +842,15 @@
                                    video_width, video_height);
                     avpicture_fill(&imageOut, frame.buf, PIX_FMT_YUV420P,
                                    newWidth, newHeight);
-                    scontext = img_resample_init(newWidth, newHeight,
-                                                 video_width, video_height);
+
+                    /* fix for problems with 1088 high video frames */
+                    if (video_height == 1088 && crop_bottom < 8) {
+                        crop_bottom = 8;
+                    }
+                    scontext = img_resample_full_init(newWidth, newHeight,
+                                                      video_width, video_height,
+                                                      crop_top,crop_bottom,crop_left,crop_right,
+                                                      0,0,0,0);
                     img_resample(scontext, &imageOut, &imageIn);
                     img_resample_close(scontext);
                 }
@@ -806,10 +869,11 @@
                     (frame.timecode - lasttimecode - (int)vidFrameTime);
             }
 
-            if (video_aspect != nvp->GetVideoAspect())
+            if (newAspect != nvp->GetVideoAspect())
             {
-                video_aspect = nvp->GetVideoAspect();
-                nvr->SetNewVideoParams(video_aspect);
+                // used to check video aspect
+                // video_aspect = nvp->GetVideoAspect();
+                nvr->SetNewVideoParams(newAspect);
             }
 
             if (video_width != nvp->GetVideoWidth() || 
@@ -820,7 +884,7 @@
                 VERBOSE(VB_IMPORTANT, QString("Resizing from %1x%2 to %3x%4")
                         .arg(video_width).arg(video_height)
                         .arg(newWidth).arg(newHeight));
-            }
+           }
 
             if ((video_width == newWidth) && (video_height == newHeight))
             {
@@ -832,8 +896,15 @@
                                video_width, video_height);
                 avpicture_fill(&imageOut, frame.buf, PIX_FMT_YUV420P,
                                newWidth, newHeight);
-                scontext = img_resample_init(newWidth, newHeight,
-                                             video_width, video_height);
+ 
+                /* fix for problems with 1088 high video frames */
+                if (video_height == 1088 && crop_bottom < 8) {
+                    crop_bottom = 8;
+                }
+                scontext = img_resample_full_init(newWidth, newHeight,
+                                                  video_width, video_height,
+                                                  crop_top,crop_bottom,crop_left,crop_right,
+                                                  0,0,0,0);
                 img_resample(scontext, &imageOut, &imageIn);
                 img_resample_close(scontext);
             }

