aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-02 22:49:00 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-02 22:54:49 +0100
commit096701d9b2a4207529a225d935208e5be8ebde6b (patch)
tree52495ed8d473f08d59848f115f51520fbda25e4c /doc/examples
parent1fd69243201741e1ad9026cdfd72194d25caceef (diff)
downloadffmpeg-096701d9b2a4207529a225d935208e5be8ebde6b.tar.gz
muxing example: set encoder defaults
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/muxing.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index 77dccb49a8..394b950c7e 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -199,6 +199,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
{
AVCodecContext *c;
AVStream *st;
+ AVCodec *codec;
st = avformat_new_stream(oc, NULL);
if (!st) {
@@ -207,8 +208,16 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
}
c = st->codec;
+
+ /* find the video encoder */
+ codec = avcodec_find_encoder(codec_id);
+ if (!codec) {
+ fprintf(stderr, "codec not found\n");
+ exit(1);
+ }
+ avcodec_get_context_defaults3(c, codec);
+
c->codec_id = codec_id;
- c->codec_type = AVMEDIA_TYPE_VIDEO;
/* put sample parameters */
c->bit_rate = 400000;