[Libav-user] AVFilterGraph and an In-Memory Image

Stephen H. Gerstacker stephen at napkinstudio.com
Mon Mar 3 22:07:48 CET 2014


Here’s the final output graph from my set up. To get the alpha properly, you need to force overlay to rgb, then format it back to yuv before the buffersink.

+-------------+
| watermarkIn |default--[439x102 1:1 bgra]--overlay:overlay
|  (buffer)   |
+-------------+

+----------+
|    in    |default--[640x960 0:1 yuvj420p]--pad:default
| (buffer) |
+----------+

                                           +-------+
in:default--[640x960 0:1 yuvj420p]--default|  pad  |default--[640x960 0:1 yuvj420p]--auto-inserted scaler 0:default
                                           | (pad) |
                                           +-------+

                                                           +-----------+
auto-inserted scaler 0:default--[640x960 0:1 bgra]-----main|  overlay  |default--[640x960 0:1 bgra]--auto-inserted scaler 1:default
watermarkIn:default-------------[439x102 1:1 bgra]--overlay| (overlay) |
                                                           +-----------+

                                                              +----------+
auto-inserted scaler 1:default--[640x960 0:1 yuv420p]--default|  format  |default--[640x960 0:1 yuv420p]--out:default
                                                              | (format) |
                                                              +----------+

                                              +--------------+
format:default--[640x960 0:1 yuv420p]--default|     out      |
                                              | (buffersink) |
                                              +--------------+

                                            +------------------------+
pad:default--[640x960 0:1 yuvj420p]--default| auto-inserted scaler 0 |default--[640x960 0:1 bgra]--overlay:main
                                            |        (scale)         |
                                            +------------------------+

                                            +------------------------+
overlay:default--[640x960 0:1 bgra]--default| auto-inserted scaler 1 |default--[640x960 0:1 yuv420p]--format:default
                                            |        (scale)         |
                                            +------------------------+



- Stephen



On Feb 28, 2014, at 4:41 PM, Stephen H. Gerstacker <stephen at napkinstudio.com> wrote:

> As a follow up, I attempted the following
> 
> Create a new “buffer” that I dump BGRA frames in to (that’s the format the watermark is in as memory).
> Every time I add a frame to my original buffer, I add a watermark frame to my watermark buffer.
> After the pad link, I added an “overlay” filter with the pad and watermark buffer as inputs, outputting to the buffersink.
> 
> This worked, but I loose the alpha transparency. Anything I can do to preserve that?
> 
> - Stephen
> 
> 
> 
> On Feb 28, 2014, at 9:54 AM, Stephen H. Gerstacker <stephen at napkinstudio.com> wrote:
> 
>> I'm making an AVFilterGraph in code. I need to apply a watermark to the video. 
>> 
>> My assumption is that I need to use the "movie" AVFilter to then overlay it. My watermark is just stored in memory, not in a file, so I'm unsure how to point the "movie" filter to use that watermark? 
>> 
>> Can someone clarify how I would do that?
>> 
>> My current filter graph is basically:
>> 
>> buffer -> (optional rotation) -> scale -> pad -> buffersink
>> 
>> The watermark would come in after the pad and overlaid there.
>> 
>> - Stephen
>> 
>> 
>> 
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
> 
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20140303/5586ebb4/attachment.html>


More information about the Libav-user mailing list