[Ffmpeg-devel] nb_streams is never initialized?

Gerald Dalley dalleyg
Tue Feb 28 17:20:59 CET 2006


The nb_streams field does not seem to be initialized.  I downloaded the 
latest source from CVS on 28 Feb 2006 and ran

    ./configure --enable-encoder=vc9 --enable-libogg --enable-vorbis 
--enable-theora --enable-faad --enable-xvid --enable-dts --enable-pp 
--enable-pthreads --enable-gpl
    make
    sudo make install

If I then just start using the recommended "using libavcodec" style 
instructions, but look at the nb_streams, I see bogus values.  I'm 
attaching an example of the problem since the mplayer ftp server is not 
allowing me to create a directory as instructed.  I've attaching 
"badNbStreams.cpp" and a data file "cinepak.avi" (it's small--13k) that 
show the problem.  To run it, do the following:

    g++ badNbStreams.cpp -I/usr/local/include -L/usr/local/lib 
-lavformat -lavcodec
    ./a.out

And I get the following printed to the console

    There are 134556816 streams after opening the file.
    Input #0, avi, from 'cinepak.avi':
      Duration: 00:00:00.3, bitrate: 345 kb/s
      Stream #0.0: Video: cinepak, 160x120, 29.97 fps
    There are 134556816 streams after finding stream info.

Note that the number of streams is wrong.  This file was created with 
VirtualDub by taking 9 image frames and encoding them using the default 
Cinepak arguments. 

I've grepped the ffmpeg source tree, and as far as I can tell, 
nb_streams is only ever initialized when using ffm.c.  I did

    cd ffmpeg
    grep nb_streams */*.c */*.h | less

and looked through each line one at a time.  Except for ffm.c, I could 
only fine code that reads the value.

Thanks in advance.

-- 
--Gerald Dalley
  dalleyg at mit.edu
  
---------8<---cut here------8<------------------------
#include <stdio.h>
#include <assert.h>
#include <ffmpeg/avcodec.h>
#include <ffmpeg/avformat.h>

int main(int argc, const char **argv)
{
  av_register_all();

  AVFormatContext *pFormatCtx;
  const char      *filename="cinepak.avi";
  assert(av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL) == 0);
  assert(pFormatCtx != NULL);
  printf("There are %d streams after opening the file.\n", pFormatCtx->nb_streams);
  assert(av_find_stream_info(pFormatCtx) >= 0);
  dump_format(pFormatCtx, 0, filename, false);
  printf("There are %d streams after finding stream info.\n", pFormatCtx->nb_streams);

  return 0;
}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: cinepak.avi
Type: video/avi
Size: 12984 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060228/8c8c8b5b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dalleyg.vcf
Type: text/x-vcard
Size: 99 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060228/8c8c8b5b/attachment.vcf>



More information about the ffmpeg-devel mailing list