Re: [FFmpeg-devel] Question about av_frame_is_writable

2015-12-12 Thread Paul B Mahol
On 12/12/15, Jean Delvare  wrote:
> Hi all,
>
> 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,
> --
> Jean Delvare
> SUSE L3 Support
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Question about av_frame_is_writable

2015-12-12 Thread Jean Delvare
Hi Paul,

On Sat, 12 Dec 2015 12:03:39 +, Paul B Mahol wrote:
> On 12/12/15, Jean Delvare  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
explanation above.

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
not.

But 

-- 
Jean Delvare
SUSE L3 Support
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel