[FFmpeg-devel] Question about av_frame_is_writable
jdelvare at suse.de
Sat Dec 12 13:36:16 CET 2015
On Sat, 12 Dec 2015 12:03:39 +0000, Paul B Mahol wrote:
> On 12/12/15, Jean Delvare <jdelvare at suse.de> wrote:
> > Can av_frame_is_writable() ever return 1, and if so, when?
> > Context: I am testing corner cases of the delogo filter. To my
> > surprise, even for a simple test case such as:
> > $ ffmpeg -f lavfi -i "color=color=white:size=24x24" -frames:v 1 -vf
> > "delogo=7:3:8:8" -f image2 debug.png
> > av_frame_is_writable() returns 0, which disables direct mode of the
> > delogo filter and forces the allocation of a new buffer. My
> > understanding was that we were trying to avoid allocation and data copy
> > as much as possible, for performance reasons, and with such a simple
> > filter graph I can't see why we can't modify the video data in-place.
> > Can someone enlighten me?
> Non-refcounted frames are never writable. And color source is made of one single
> frame which is cloned multiple times.
> Use different input file perhaps?
Thanks for the hint. That makes sense, and if I set the input to a
still picture instead then av_frame_is_writable() indeed returns 1.
However if I add replace "-frames:v 1" with "-loop 1 -frames:v 5",
av_frame_is_writable() still returns 1. I expected the input picture to
be cloned 4 times so it would no longer be writable, given your
Also if I change the input to a MPEG file, av_frame_is_writable()
returns 0 again.
So I still do not fully understand when frames are writable and when
SUSE L3 Support
More information about the ffmpeg-devel