[libav-api] Win32 audio encode problem

Jake Alley jakealley26 at yahoo.com
Mon Oct 24 16:18:06 CEST 2011


Is there any trick to get audio encoding to initialize properly on win32?  I used the latest autobuilds from win32.libav.org and copied api-example.c.  avcodec_open(c, codec) always seems to return -22.  Decoding works fine.


Thanks.

    printf("Audio encoding\n");

    /* find the MP2 encoder */
    codec = avcodec_find_encoder(CODEC_ID_MP2);
    if (!codec) {
        fprintf(stderr, "codec not found\n");
        exit(1);
    }

    c = avcodec_alloc_context3(codec);

    /* put sample parameters */
    c->bit_rate = 64000;
    c->sample_rate = 44100;
    c->channels = 2;

    /* open it */
    int r = avcodec_open(c, codec);
// always returns -22
    if (r < 0) {
        fprintf(stderr, "could not open codec\n");
        exit(1);
    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libav.org/pipermail/libav-api/attachments/20111024/86a1b83c/attachment.html>


More information about the libav-api mailing list