Commit 096701d9 authored by Michael Niedermayer's avatar Michael Niedermayer

muxing example: set encoder defaults

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 1fd69243
...@@ -199,6 +199,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id) ...@@ -199,6 +199,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
{ {
AVCodecContext *c; AVCodecContext *c;
AVStream *st; AVStream *st;
AVCodec *codec;
st = avformat_new_stream(oc, NULL); st = avformat_new_stream(oc, NULL);
if (!st) { if (!st) {
...@@ -207,8 +208,16 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id) ...@@ -207,8 +208,16 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
} }
c = st->codec; 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_id = codec_id;
c->codec_type = AVMEDIA_TYPE_VIDEO;
/* put sample parameters */ /* put sample parameters */
c->bit_rate = 400000; c->bit_rate = 400000;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment