[Ffmpeg-devel] nb_streams is never initialized?

Gerald Dalley dalleyg
Wed Mar 1 05:26:25 CET 2006

Okay, I decided to do a bigger cleanup job and start over.  After adding 
new linker options,

    g++ badNbStreams.cpp -I/usr/local/include -L/usr/local/lib 
-lavformat -lavcodec -ldts -lavutil -logg -lz -lfaad -lvorbisenc 
-ltheora -lxvidcore ; ./a.out

it all seems to be magically working again. 

It looks like I missed libavformat/avidec.c, which is where the 
nb_streams is actually initialized.

I think I might have had a problem with multiple versions of the 
libraries being present, but somehow not getting any complaints from the 
compiler or linker. 

FYI, although I made the AVI file on Windows, I am doing the development 
on the current stable distribution of Debian GNU/Linux.

Brian Brice wrote:

> Gerald Dalley wrote:
>> 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.
> I get some pretty different output than you:
>    There are 1 streams after opening the file.
>    Input #0, avi, from 'cinepak.avi':
>      Duration: 00:00:00.3, start: 0.000000, bitrate: 345 kb/s
>      Stream #0.0, 29.97 fps(r): Video: cinepak, yuv420p, 160x120
>    There are 1 streams after finding stream info.
> I'm testing in Windows also.
>> 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
> It's initialized in a huge memset(ptr, 0, size) for the AVFormatContext
> inside av_alloc_format_context(), not explicitly set to 0 as you were
> probably looking for.  I'm not sure why our outputs differ.


--Gerald Dalley
  dalleyg at mit.edu

-------------- 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/4a2a682b/attachment.vcf>

More information about the ffmpeg-devel mailing list