Hi Konran,

Konran Gerber wrote:
> Hello,
> I'm trying to raw read MPEG2 video using av_read_frame without decoding 
> with avcodec_decode_video because I'm doing analysis and therefore I 
> have to go quickly through each video file.
> 
> Things I need are parameters like repeat_pict, top_field_first, 
> interlaced_frame. There is a flag in AVCodecContext parse_only that says 
> avcodec_parse_frame can be used to get the frame data. But there is 
> neither avcodec_parse_frame in the source code

I suspect this is a residual from some old code, and the comments are 
not valid anymore. I believe you do not need to use 
avcodec_decode_video(), nor you need an AVCodecContext. In my 
understanding, you just need to use the av_read_frame() function 
provided by libavformat.
(the documentation says: "Return the next frame of a stream.... For 
video, the packet contains exactly one frame....")


[...]
> Any other way to get the frame's raw data? I've tried to evaluate the 
> AVPacket content after successfully calling av_read_frame.

IMHO, this should be the right thing to do: call av_read_frame() and 
look at pkt.data.

> But here I 
> get either the entry point from the first sequence header when I point 
> to the beginning of the packet's data member or I get anywhere in the 
> buffer's data when I look at packet.data[packet.pos] ... there is no 
> valid stream start code at that position.

I think pkt.data (and not pkt.data[pkt.pos]) should contain the frame... 
If you already tried looking at it and it does not contain correct data, 
then I do not know what to say. Maybe someone else (who knows 
libavformat's internals better) will have more information about this.
Anyway, what's the problem you are seeing with pkt.data?


                                Luca
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to