Dear Dan

Many thanks for your quick answer. It makes perfectly sense !

I've always used melt native crop, and it's great, but I'm facing a slight
issue right now when chaining two native crops. That's why I was starting
to test avfilter crop.

Anyway, let's share my experiment with chaining two native crops :

Let's say I have this picture :
http://thepopmanifesto.com/issue09/images/content/kindness-2.jpg
Image size is 642px x 800px

1. If I want to crop center this picture, the picture aspect ratio is
preserved

melt kindness-2.jpg in=0 out=100 -attach-track crop center=1 -profile
hdv_720_25p -consumer avformat:kindness.mp4

Good !

2. If I want to crop the source image from (0,0) to (300,300), the picture
aspect ratio is preserved and I only get the top left section of the image,
centered in the screen

melt kindness-2.jpg in=0 out=100 -attach-clip crop left=0 top=0 right=342
bottom=500 -profile hdv_720_25p -consumer avformat:kindness.mp4

Good !

3. If I want to chain the two crops, which means I want to take the top
left section of the image, then center crop it to remove black borders, it
does not work

melt kindness-2.jpg in=0 out=100 -attach-clip crop left=0 top=0 right=342
bottom=500 -attach-track crop center=1 -profile hdv_720_25p -consumer
avformat:kindness.mp4

First, I don't see a portion of the top left corner of the image and
second, the image aspect ratio is not preserved.

Of course this example is oversimplified, I would not have to chain two
crops, but only one crop with the right 16/9 ratio.
It only makes sense when I'm also adding affine transitions between the
left/top/right/bottom crop and the center crop.

Let me know if I'm not taking the right approach !

Thanks again for your time and patience, all the best

Geoffroy




2016-10-11 8:21 GMT+02:00 Dan Dennedy <d...@dennedy.org>:

> Well, basically, many avfilters are simply incompatible, and we blacklist
> some, but we have not taken the time to audit all of them, and they are
> adding many all the time. In this case, the error occurs because the output
> width and height do not match the width and height that MLT needs - as
> expected for a crop. In MLT, at some point, all video frames need to
> conform in order to allow mixing or to give the output consumer what it
> requested in a consistent manner. For that MLT automatically adds
> normalization filters to deinterlace, change field order, scale, pad,
> resample audio, correct # audio channels, etc. MLT's native crop filter is
> special because it has two pars: one that is first in normalization and one
> the user adds that directs the first one. This allows the scaling and
> padding filters to apply to the output of the first part. In short,
> avfilter.crop cannot work in MLT, and you should use the MLT crop filter.
> In the context of all of this, crop has an interesting behavior that you
> can observe in shotcut or similar. You first need to figure out what
> resolution and aspect ratio you want as a result, use that as a MLT
> profile, and then crop. You cannot simply say take this input crop X from
> top and bottom, compute the result for me, and give it to me.
>
> On Mon, Oct 10, 2016 at 11:09 PM Geoffroy Montel <
> geoffroy.montel...@gmail.com> wrote:
>
>> Dear list,
>>
>> I've been trying to use avfilter crop filter, but I'm getting some errors.
>>
>> melt crop.jpg in=0 out=100 -attach avfilter.crop av.x=0 av.y=0
>> av.out_w=300 av.out_h=300 -progress -consumer avformat:crop.mp4
>>
>> returns
>>
>> [filter avfilter.crop] Unexpected return format
>>
>> and the image is not cropped.
>>
>> Am I doing something wrong ?
>>
>> Thanks in advance for your help, all the best
>>
>> geoffroy
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot______
>> _________________________________________
>> Mlt-devel mailing list
>> Mlt-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/mlt-devel
>>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to