Thanks Dear :-), but where can I get those magician bitstream ? somebody know how fill extradata for WMV3
Stefano Falasca -----Messaggio originale----- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Per conto di avcoder Inviato: sabato 21 giugno 2008 16.21 A: Libav* user questions and discussions Oggetto: Re: [libav-user] R: avcodec_open fail Dear: You should put some magic bitstream in AVCodecContext.extradata, otherwise, avcodec_open() will refuse to work Please check: //@file vc1.c line 3872 if(avctx->extradata_size < 16) { av_log(avctx, AV_LOG_ERROR, "Extradata size too small: %i\n", avctx->extradata_size); return -1; } Good luck On 6/21/08, Stefano Falasca <[EMAIL PROTECTED]> wrote: > > Thanks Stefano, for your suggest. I never used av_log then I looked around. > I implemented the follow avlog callback, to log info into file. > > -------- > static void ffmpeg_avcodec_log(void *ptr, int val, const char * msg, > va_list > ap) > { > AVClass* avc= ptr ? *(AVClass**)ptr : NULL; > > FILE *flog=fopen("MMedia.log","a"); > fprintf(flog, "[%s @ %p] ", avc->item_name(ptr), avc); > vfprintf(flog, msg, ap); > fclose(flog); > } > --------- > > And the new code is this: > > --------- > int CFFDecode::Init(int codec_id, int width, int height, int fps) > { > if ((width & 1) == 1) return E_INVALIDARG; > if ((height & 1) == 1) return E_INVALIDARG; > > av_log_set_callback( ffmpeg_avcodec_log ); > > m_codec = avcodec_find_decoder((CodecID)codec_id); > if (m_codec == NULL) {DbgOut("FFINIT OK");return E_FAIL;} > > m_c = avcodec_alloc_context(); > if (m_c == NULL) > {DbgOut("avcodec_alloc_context error");return > E_OUTOFMEMORY;} > > avcodec_get_context_defaults2(m_c, CODEC_TYPE_VIDEO); > avcodec_get_frame_defaults(&m_picture); > > m_c->codec_id = (CodecID) codec_id; > m_c->codec_type = CODEC_TYPE_VIDEO; > m_c->strict_std_compliance = 0; > > m_c->width = width; > m_c->height = height; > m_c->time_base.den = fps; > m_c->time_base.num = 1; > m_c->gop_size = 12; > m_c->pix_fmt = PIX_FMT_BGR24; > > /* open the codec */ > int iRetOpen = avcodec_open(m_c, m_codec); > if ( iRetOpen < 0) { > av_log(m_c, AV_LOG_DEBUG, "Fail avcodec_open\n"); > return E_FAIL; > > } > -------------- > > Into log file I've only this information! > > [NULL @ 68C432E0] Fail avcodec_open > > I can't undertand where is the problem > > thanks > > > Stefano Falasca > > > -- ------------------------------------------------- Inspired by http://www.avcoder.net Your potential. Our passion. _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
