0

問題: AVFormatContext::nb_streams の値が小さすぎます。私のC++コード(リストを減らすために省略されたエラー処理、インクルードなど):

void printA(AVFormatContext* _a)
{
std::cout << "duration    " << (unsigned long)_a->duration << "\n";
std::cout << "streams     " << _a->nb_streams << "\n";
std::cout << "format name " << _a->iformat->name << "\n";
std::cout << "bit_rate    " << _a->bit_rate << "\n";
std::cout << "long name   " << _a->iformat->long_name << "\n";
}

int main(int argc, char **argv)
{


if ( argc < 2 )
{
    std::cout << "Usage: " << argv[0] << " <file>\n";
    return 1;
}

    av_register_all();

AVFormatContext *pFormatCtx = avformat_alloc_context();

avformat_open_input (&pFormatCtx, argv[1], NULL, NULL);
avformat_find_stream_info(pFormatCtx, NULL);

printA( pFormatCtx );
return 0;
}

ランニング:

xx@xx /tmp/avlib $ ./avlibtest /ar/video/Nauka.Sna.2006.HDRip.AVC.mkv 
[matroska,webm @ 0x804c040] max_analyze_duration reached
[matroska,webm @ 0x804c040] Estimating duration from bitrate, this may be inaccurate
duration    134741408
streams     134531840     <---- !!! :-O
format name matroska,webm
bit_rate    0
long name   Matroska/WebM file format

しかし、「avplay」プログラムはうまく機能します。

4

0 に答える 0