2010-05-30 66 views

回答

2

這取決於它是如何配置的。當您構建libavformat時會顯示一個列表。如果您已經構建了ffmpeg,則還可以通過輸入ffmpeg -formats來查看列表。 還有一個所有支持的格式的列表here

12

既然你問libav *格式,我猜你是在一個代碼示例之後。

要獲取所有編解碼器的列表,請使用av_codec_next api遍歷可用編解碼器的列表。

/* initialize libavcodec, and register all codecs and formats */ 
av_register_all(); 

/* Enumerate the codecs*/ 
AVCodec * codec = av_codec_next(NULL); 
while(codec != NULL) 
{ 
    fprintf(stderr, "%s\n", codec->long_name); 
    codec = av_codec_next(codec); 
} 

要獲得的格式列表,以同樣的方式使用av_format_next:

AVOutputFormat * oformat = av_oformat_next(NULL); 
while(oformat != NULL) 
{ 
    fprintf(stderr, "%s\n", oformat->long_name); 
    oformat = av_oformat_next(oformat); 
} 

如果你也想找出推薦編解碼器特定的格式,你可以迭代codec tags list:

AVOutputFormat * oformat = av_oformat_next(NULL); 
while(oformat != NULL) 
{ 
    fprintf(stderr, "%s\n", oformat->long_name); 
    if (oformat->codec_tag != NULL) 
    { 
     int i = 0; 

     CodecID cid = CODEC_ID_MPEG1VIDEO; 
     while (cid != CODEC_ID_NONE) 
     { 
      cid = av_codec_get_id(oformat->codec_tag, i++); 
      fprintf(stderr, " %d\n", cid); 
     } 
    } 
    oformat = av_oformat_next(oformat); 
} 
相關問題