=====avcodec_encode_subtitle=====
====Overview====
Defined in ''avcodec.h''\\
Encodes a subtitle frame from ''sub'' into ''buf''.\\
The [[ffmpeg:avcodec_encode_subtitle()]] function encodes a video frame from the input ''sub''. To encode it, it makes use of the video codec which was coupled with ''avctx'' using [[ffmpeg:avcodec_open()]]. The resulting encoded bytes representing the frame are stored in the output buffer ''buf''.
int avcodec_encode_subtitle(AVCodecContext *avctx,
uint8_t *buf,
int buf_size,
const AVSubtitle *sub);
====Parameters====
===avctx===
AVCodecContext *avctx
The [[ffmpeg:AVCodecContext]] codec context.
===buf===
uint8_t *buf
The output buffer for the bitstream of encoded frame.
===buf_size===
int buf_size
The size of the output buffer in bytes.
===sub===
const AVSubtitle *sub
The input [[ffmpeg:AVSubtitle]] subtitle to encode.
====Return value====
On error a negative value is returned, on success zero or the number of bytes used from the input buffer.
====See also====
[[ffmpeg:avcodec_encode_video()]], [[ffmpeg:avcodec_encode_audio()]]
----
Back to [[ffmpeg:ffmpeg]]