[Ffmpeg-devel] Bugs report

Yao, Dongxian yaodongxian
Fri Mar 3 17:57:21 CET 2006

I found two bugs for the latest version of FFMpeg project:


1.	If you compile the project in Windows by using msys and MinGW
library, you will get error says "undefined reference to mkstemp" in
file "\libavcodec\xvid_rc.c". To fix it, just copy the way you team have
done for the file "libavcodec\xvidff.c", add some codes to make Windows
happy, here is the code I modified, and it got compiled and worked well:


#ifdef CONFIG_WIN32 /* Ugly work around */


            char *tempname;


        tempname = tempnam(".", "xvidrc");

        fd = -1;

        if( tempname &&

                  (fd = open(tempname, _O_RDWR | _O_BINARY)) != -1 ) {

                        tmp_name = av_strdup(tempname);

#undef free


#define free please_use_av_free

                if( tmp_name == NULL ) {

                    av_log(s->avctx, AV_LOG_ERROR,

                        "XviD: Cannot allocate 2-pass buffer\n");

                    return -1;





      tmp_name= av_strdup("/tmp/xvidrc.XXXXXX");

    fd = mkstemp(tmp_name);

    if(fd < 0){

        strcpy(tmp_name, "./xvidrc.XXXXXX");

        fd = mkstemp(tmp_name);





2.	If you use FFMpeg to convert ".wmv" file to other formats of
files, you always get some error message like "[asf @ 00665D54]ff asf
bad header 90  at:78447606rate= 118.7kbits/s", and it always happen when
the processing reaches to the end of the wmv file. I checked and found
out lots of wmv files generated by the "Windows Media Encoder" will
append some useless packets at the end of the wmv file. The regular
packet start with flag "0x82", but these padding packets do not start
with "0x82". And it caused trouble some times. Then I checked the file
"\libavformat\asf.c", and modified the code like this. It works, when
program find a packet not start with "0x82", it just return the error
and terminate the process. But I don't think it is the best solution,
could you please check!


    if (c != 0x82) {

        if (!url_feof(pb))


            av_log(s, AV_LOG_ERROR, "ff asf bad header %x
at:%"PRId64"\n", c, url_ftell(pb));

            return AVERROR_IO;






Dongxian Yao

More information about the ffmpeg-devel mailing list