Go to the documentation of this file.
33 int main(
int argc,
char **argv)
37 int sample_rate = 44100;
42 fprintf(stderr,
"Usage: %s <codec_name> [sample_rate] [channels]\n",
48 sample_rate = atoi(argv[2]);
54 fprintf(stderr,
"Encoder '%s' not found\n", argv[1]);
62 ctx->sample_rate = sample_rate;
68 fprintf(stderr,
"avcodec_open2 failed: %d\n",
ret);
73 printf(
"%s bit_rate=%"PRId64
" block_align=%d bits_per_coded_sample=%d frame_size=%d\n",
75 ctx->bits_per_coded_sample,
ctx->frame_size);
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
__device__ int printf(const char *,...)
int main(int argc, char **argv)
Print encoder properties (bit_rate, block_align, bits_per_coded_sample, frame_size) after init.
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
static AVFormatContext * ctx
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
@ AV_SAMPLE_FMT_S16
signed 16 bits
const char * name
Name of the codec implementation.
attribute_deprecated enum AVSampleFormat * sample_fmts
main external API structure.
const AVCodec * avcodec_find_encoder_by_name(const char *name)
Find a registered encoder with the specified name.