[FFmpeg-devel] [PATCH] examples/muxing: set codec in the codec context

Stefano Sabatini stefasab at gmail.com
Fri Aug 3 18:04:37 CEST 2012


Avoid failure:
No codec provided to avcodec_open2().
could not open codec
---
 doc/examples/muxing.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index 4e62b87..a5d5cf5 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -78,6 +78,7 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
     st->id = 1;
 
     c = st->codec;
+    c->codec = codec;
 
     /* put sample parameters */
     c->sample_fmt  = AV_SAMPLE_FMT_S16;
@@ -206,6 +207,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
     avcodec_get_context_defaults3(c, codec);
 
     c->codec_id = codec_id;
+    c->codec = codec;
 
     /* Put sample parameters. */
     c->bit_rate = 400000;
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list