[FFmpeg-user] alphamerge filter use problem

Tim Willison timbot at oddlystudios.com
Wed Apr 10 15:18:46 CEST 2013


Hi Paul,
I'm reluctant to report it as a bug, since somebody clearly did a lot of
work on this filter. It could be I'm using it wrong as I've found no full
examples online despite a lot of searching. I am continuing to test
combinations with yuv and rgb, but I thought if anyone has used this filter
set perhaps they would be good enough to share (or some more experienced
users might be prompted to try it and also share what they find).

This person seems to have had a similar problem:
http://ffmpeg.org/pipermail/ffmpeg-user/2012-December/012334.html

If it turns out more people experience a problem I would certainly file a
bug report with everything I've tried. I am now looking at the test units
that were applied to the filters prior to them being committed to see if
I'm doing something wrong. Clearly they passed so I may find something
there.

I also thought some folks might have another way of accomplishing the goal,
which is essentially mapping the luma information of one video to the alpha
channel of another. I've looked at the lut filter as well as the geq
filter, and these can certainly write to the alpha channel but I can't see
how to pass the luma information to those filters.

I think this is why the alphamerge filter was created in the first place -
to solve that problem. But if anyone has another approach I'd love to hear
about it.

Thanks for your reply!

-Tim.

On Tue, Apr 9, 2013 at 11:18 AM, Paul B Mahol <onemda at gmail.com> wrote:

> On 4/7/13, Tim Willison <timbot at oddlystudios.com> wrote:
> > Hi, this is my first question ever to a mailing list (or anywhere!).
> > I have been using ffmpeg for about a year and a half and have figured out
> > many things on my own but I'm stumped regarding the alphaextract and
> > alphamerge filters.
> > I am able to get the proper result every time with images, but have yet
> to
> > succeed with videos. I have tried many formats and searched extensively
> but
> > have not found a single documented case of someone successfully using
> this
> > filter combination and sharing an example. The documentation on the
> > ffmpeg-filters page is very sparse, and does not give any details of what
> > formats/codecs are supported.
> >
> > I think this filter would be very useful if I can figure it out.
> >
> > Step 1 - alphaextract
> > This seems to always work, and produces a grayscale video as expected. In
> > my tests I have used rgba video, as well as quicktime with animation
> codec
> > (bgra).
> >
> > Step 2 - applying the extracted alpha
> > This works every time for images. However while the encode completes with
> > video it never provides the masking expected by mapping the extracted
> alpha
> > information to the alpha channel of the target video. In my tests with
> > still images, I found that the output format must be a format that
> supports
> > an alpha channel, and I have tried several with video (which I determined
> > by looking at the source code of the filter).
> >
> > My command (taken from the docs) looks like this:
> >
> > ffmpeg -i timbotundelay.mp4 -vf "movie=timbotoverlayextracted.mov
> [alpha];
> > [in][alpha] alphamerge [out]" -an -y -pix_fmt rgba -vcodec png
> > composite.mov
> > ffmpeg version git-2013-04-06-1177416 Copyright (c) 2000-2013 the FFmpeg
> > developers
> >   built on Apr  6 2013 17:31:47 with gcc 4.6.1 (Ubuntu/Linaro
> > 4.6.1-9ubuntu3)
> >   configuration: --enable-gpl --enable-libass --enable-libfaac
> > --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
> > --enable-libopencore-amrwb --enable-libspeex --enable-librtmp
> > --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264
> > --enable-nonfree --enable-version3 --enable-libfreetype
> > --enable-filter=drawtext
> >   libavutil      52. 25.100 / 52. 25.100
> >   libavcodec     55.  2.100 / 55.  2.100
> >   libavformat    55.  1.100 / 55.  1.100
> >   libavdevice    55.  0.100 / 55.  0.100
> >   libavfilter     3. 49.100 /  3. 49.100
> >   libswscale      2.  2.100 /  2.  2.100
> >   libswresample   0. 17.102 /  0. 17.102
> >   libpostproc    52.  2.100 / 52.  2.100
> > Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'timbotundelay.mp4':
> >   Metadata:
> >     major_brand     : mp42
> >     minor_version   : 0
> >     compatible_brands: mp42mp41
> >     creation_time   : 2013-04-07 18:35:55
> >   Duration: 00:00:04.97, start: 0.000000, bitrate: 241 kb/s
> >     Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
> > 1280x720 [SAR 1:1 DAR 16:9], 35 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc
> >     Metadata:
> >       creation_time   : 2013-04-07 18:35:55
> >       handler_name    : ?Mainconcept Video Media Handler
> >     Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
> > fltp, 189 kb/s
> >     Metadata:
> >       creation_time   : 2013-04-07 18:35:55
> >       handler_name    : #Mainconcept MP4 Sound Media Handler
> > Output #0, mov, to 'composite.mov':
> >   Metadata:
> >     major_brand     : mp42
> >     minor_version   : 0
> >     compatible_brands: mp42mp41
> >     encoder         : Lavf55.1.100
> >     Stream #0:0(eng): Video: png (png  / 0x20676E70), rgba, 1280x720 [SAR
> > 1:1 DAR 16:9], q=2-31, 200 kb/s, 15360 tbn, 30 tbc
> >     Metadata:
> >       creation_time   : 2013-04-07 18:35:55
> >       handler_name    : ?Mainconcept Video Media Handler
> > Stream mapping:
> >   Stream #0:0 -> #0:0 (h264 -> png)
> > Press [q] to stop, [?] for help
> > frame=  151 fps= 64 q=0.0 Lsize=    1952kB time=00:00:05.03
> > bitrate=3177.5kbits/s dup=2 drop=0
> > video:1951kB audio:0kB subtitle:0 global headers:0kB muxing overhead
> > 0.067323%
> >
> > After this, I see only my red background (timbotundelay.mp4) and no alpha
> > applied.
> > Thanks so much to anyone who can help me out here. I'm running out of
> > things to try. I'd particularly like to see how people are using this
> > filter successfully.
>
>
> If it does not work but should as it works with images than it is bug.
> And bugs should be reported so they get fixed.
>
> > _______________________________________________
> > ffmpeg-user mailing list
> > ffmpeg-user at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>



-- 
Tim Willison
Lead Product Designer
www.oddlystudios.com
495B Queen St. West
Toronto, ON.
647 345 6275


More information about the ffmpeg-user mailing list