[Libav-user] Unable to find codec

francesco at bltitalia.com francesco at bltitalia.com
Mon Jan 9 15:21:02 CET 2012


I call at start the init and register:

  avcodec_init();
  // Register all formats and codecs
  av_register_all();


but it seems that the codec aren't registered.  I make an attempt using 

  pCodec=avcodec_find_decoder_by_name("mpeg2video");

but nothing.  The matter that I don't understand is that in this last case
I should have a valid pointer.  Codec "mpeg2video" is present, so should 
return a valid pointer.  Where is the mistake ?



At 15.04 09/01/2012 +0100, you wrote:
>Le decadi 20 nivôse, an CCXX,
francesco-V8Dg30rvLxeB+jHODAdFcQ at public.gmane.org a écrit :
>> I compiled last release of ffmpeg with all codecs enabled. So I linked the
>> libraries to my project and opened a simple image composed with a single
field.
>> The av_open_input_file, and av_find_stream_info(pFormatCtx) works correctly,
>> that is info contained into pFormatCtx are correct (video stream is a MPEG2
>> one).The problem arises when I attempt to detect codec.  Here is the code:
>> 
>>   videoStream=-1;
>>   for(i=0; i<pFormatCtx->nb_streams; i++)
>>     if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) {
>>       videoStream=i; break;
>>     }
>> 
>>   if(videoStream==-1) {Memo1->Lines->Add("Unable to detect stream type");
>> goto   end_conv;}
>
>Note that you can use av_find_best_stream for that.
>
>>    // Get a pointer to the codec context for the video stream
>>   pCodecCtx=pFormatCtx->streams[videoStream]->codec;
>> 
>>   // Find the decoder for the video stream
>>   pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
>> 
>> The pCodec is always null.  Did anyone have an idea ?
>
>Did you forge to call some of the register_all?
>
>If not, trim your program until remains only the bare minimum to show the
>problem; do not hesitate to hardcode filenames or even codec ids. The result
>should probably be less than 20 lines. Then post it here as a whole.
>
>Regards,
>
>-- 
>  Nicolas George
>_______________________________________________
>Libav-user mailing list
>Libav-user at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/libav-user
>
>
>__________ Informazioni da ESET NOD32 Antivirus, versione del database
delle firme digitali 6777 (20120108) __________
>
>Il messaggio è stato controllato da ESET NOD32 Antivirus.
>
>www.nod32.it
>
>
>
>
/*******************************************************************\
*    ing. Francesco  Cuzzocrea
*    company:    BLT Italia srl        web:  http://www.blt.it
*    address:    via Rosselli, 91     city:  Lido di CAMAIORE
*    country:    ITALY                 zip:  55043-i
*      Tel. :    +39 0584 904788       Fax:  +39 0584 904789  
*     e-mail:   francesco at bltitalia.com
\*******************************************************************/




More information about the Libav-user mailing list