[Libav-user] invalid AVPacket size in av_read_frame usage.
daggs
daggs at gmx.com
Mon Apr 27 12:56:19 CEST 2015
Greetings,
> Sent: Monday, April 27, 2015 at 11:20 AM
> From: "Carl Eugen Hoyos" <cehoyos at ag.or.at>
> To: libav-user at ffmpeg.org
> Subject: Re: [Libav-user] invalid AVPacket size in av_read_frame usage.
>
> daggs <daggs at ...> writes:
>
> > > > I'm writing a program that needs to sample the
> > > > screen in bgra format. the problem is what I try
> > > > to read an av frame, I get this error:
> > > > [rawvideo <at> 0x1403aa0] Invalid buffer size,
> > > > packet size 1228800 < expected frame_size 8294400
> > >
> > > Where does the packet come from that you pass to
> > > the video decode function?
>
> ?
I'm using the x11grab module set to my desktop and grab the packets using av_read_frame call.
>
> > > What is the resolution of the video that you
> > > want to decode?
> >
> > that is a raw packet of a 1920x1080 screen.
>
> 1920 x 1080 x 4 = 8,294,400 so the error seems correct
> to me.
>
> [...]
but that isn't what I've asked, I see that error and tried to increase the buffer using av_new_packet but it doesn't work so I'm trying to understand what I'm doing wrong.
>
> > which encodes it to the required format (libx264rbg).
> >
> > if I'm not mistaken, scaling the frame to yuv420p
> > will drop the quality of the frame which I don't
> > want to have.
>
> That doesn't explain why you need the rawvideo decoder.
I did, I don't want the thread that grabs the screen do encode the frame, so I grab it raw and pass it to another thread which encodes it.
> Or are you using libavformat to capture the screen?
> (You didn't say so.)
>
I've searched the net and found some examples and projects that grabs screen in similar way.
I haven't found any example in the ffmpeg docs regarding screen capture so I assumed that is the way to do that.
is there another way to do that?
More information about the Libav-user
mailing list