User Tools

Site Tools


ffmpeg:av_read_frame

avc_read_frame

Overview

Defined in avformat.h

Return the next frame of a stream.

The returned packet is valid until the next av_read_frame() or until av_close_input_file() and must be freed with av_free_packet(). For video, the packet contains exactly one frame. For audio, it contains an integer number of frames if each frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames have a variable size (e.g. MPEG audio), then it contains one frame.

pkt→pts, pkt→dts and pkt→duration are always set to correct values in AVStream.timebase units (and guessed if the format cannot provided them). pkt→pts can be AV_NOPTS_VALUE if the video format has B frames, so it is better to rely on pkt→dts if you do not decompress the payload.

int av_read_frame(AVFormatContext *s,
                  AVPacket *pkt);

Parameters

s

AVFormatContext *s

Media file handle. A pointer to AVFormatContext.

pkt

AVPacket *pkt

A pointer to the AVPacket to fill.

Return value

0 if OK, < 0 if error or end of file.


Back to ffmpeg

ffmpeg/av_read_frame.txt · Last modified: 2007/11/22 17:03 by deva