mltframework / mlt

MLT Multimedia Framework
https://www.mltframework.org
GNU Lesser General Public License v2.1
1.5k stars 322 forks source link

affine filter cuts off the bottom 1px of the video #471

Open ziyunfei opened 5 years ago

ziyunfei commented 5 years ago

image

<?xml version="1.0" encoding="utf-8"?>
<mlt>
  <profile description="" width="640" height="360"/>
  <producer id="16da6066-6d38-76bd-75de-5394693db212">
    <property name="resource">http://kb-oss-daily.oss-cn-zhangjiakou.aliyuncs.com/video/2019/08/06/67399a58-8788-474b-90d0-567383694ca8.mp4</property>
    <filter>
      <property name="mlt_service">affine</property>
      <property name="transition.rect">0 0 640 360</property>
      <property name="background">color:red</property>
    </filter>
  </producer>
  <playlist id="main_timeline">
    <entry producer="16da6066-6d38-76bd-75de-5394693db212"/>
  </playlist>
  <tractor id="default">
    <track producer="main_timeline"/>
  </tractor>
</mlt>
ddennedy commented 5 years ago

I reproduced this with git master when rescale=bilinear or bicubic but not neareset, which is the default for SDL.

BTW <profile description="" width="640" height="360"/> will not work the way you think it does since you did not provide all of the profile values. The default profile is dv_pal, which is not square pixels! You probably want to set sample_aspect_num, sample_aspect_den, display_aspect_num, and display_aspect_den. A test with <profile description="" width="640" height="360" sample_aspect_num="1" sample_aspect_den="1" display_aspect_num="16" display_aspect_den="9"/> did not provide a workaround for this bug.

The following diff works for me, but it needs more verification and testing since we have experienced crashes in this area before (ab626f7).

--- a/src/modules/plus/transition_affine.c
+++ b/src/modules/plus/transition_affine.c
@@ -593,8 +593,8 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                        .b_alpha = mlt_properties_get_int( properties, "b_alpha" ),
                        // Affine boundaries
                        .minima = 0,
-                       .xmax = b_width - 1,
-                       .ymax = b_height - 1
+                       .xmax = b_width,
+                       .ymax = b_height
                };

                // Recalculate vars if alignment supplied.
ziyunfei commented 5 years ago

Thanks, I fixed my issue by set rescale=nearest image