Recherche avancée

Médias (9)

Mot : - Tags -/soundtrack

Autres articles (63)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

Sur d’autres sites (8008)

  • Evolution #2999 : Mettre à jour _IS_BOT

    14 mai 2013, par cedric -

    oui je vois en effet. Ça par contre ce n’est pas logique, c’est bien l’écran qui doit avoir la main sur la constante, la définition du core étant un fallback
    (nb ça marche quand même si on appele l’écran en php_auto_prepend)

  • Anomalie #2931 (Fermé) : insécable sur : :

    12 mai 2013, par denisb -

    fermé (à la main donc...)

  • Wma decoding with ffmpeg

    21 janvier 2012, par Izak

    I am new to ffmpeg and I tried using api-example.c to decode wma files. However when I run the program, it gave me an error saying

    "frame_len overflow". Does anyone know how to fix this error ?

    Here is my code :

    extern "C" {
    #include
    #include "../libavcodec/avcodec.h"
    #include
    }

    #include <iostream>
    #include
    #include
    #include
    #define INBUF_SIZE 4096
    #define AUDIO_INBUF_SIZE 20480
    #define AUDIO_REFILL_THRESH 4096

    int main(int argc, char *argv[]) {
       avcodec_init();
       avcodec_register_all();
       //avdevice_register_all();
       av_register_all();

       AVCodec *codec;
       AVCodecContext *c= NULL;

       AVCodec *ocodec;
       AVCodecContext *oc= NULL;

       int out_size, len,out_size2;
       FILE *f, *outfile;
       uint8_t *outbuf;
       uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];

       AVPacket avpkt;
       char* outfilename="test.wma";
       char* filename="Beethoven&#39;s.wma";
       AVFormatContext *pFormatCtx;

       WAVEFORMATEX* wfx=new WAVEFORMATEX;

       int ret;
       ret=av_open_input_file(&amp;pFormatCtx, filename, NULL, 0, NULL);

       if(ret!=0)
       {
           std::cout&lt;&lt;"cannot open file!"&lt;/ Find the first video stream
       audioStream=-1;
       for(int i=0; inb_streams; i++)
           if(pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_AUDIO)
           {
               audioStream=i;
               break;
           }
       if(audioStream==-1)
       {
           std::cout&lt;&lt;"cannot find audio!"&lt;/ Get a pointer to the codec context for the audio stream
       pCodecCtx=pFormatCtx->streams[audioStream]->codec;
       av_init_packet(&amp;avpkt);

       printf("Audio decoding\n");

       /* find the suitable audio decoder */
       codec = avcodec_find_decoder(pCodecCtx->codec_id);

       if (!codec) {
           fprintf(stderr, "codec not found\n");
           exit(1);
       }

       if(codec->capabilities &amp; CODEC_CAP_TRUNCATED)
           pCodecCtx->flags|=CODEC_FLAG_TRUNCATED;

       //open the codec (for decoding)
       int test = avcodec_open(pCodecCtx, codec);
       if (test &lt; 0) {
           fprintf(stderr, "could not open codec\n");
           exit(1);
       }

       //find mp3 encoder
       ocodec = avcodec_find_encoder(CODEC_ID_MP3);
       if (!ocodec) {
           fprintf(stderr, "codec not found\n");
           exit(1);
       }

       //allocate context
       oc= avcodec_alloc_context();
       /* put sample parameters */
       oc->bit_rate = 64000;
       oc->sample_rate = 44100;
       oc->channels = 1;
       /* open it */
       if (avcodec_open(oc, ocodec) &lt; 0) {
           fprintf(stderr, "could not open encoding codec\n");
           exit(1);
       }

       //buffer
       outbuf = (uint8_t*)malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);

       //open inputfile
       f = fopen(filename, "rb");
       if (!f) {
           fprintf(stderr, "could not open %s\n", filename);
           exit(1);
       }

       //open outputfile
       outfile = fopen(outfilename, "wb");

       if (!outfile) {
           av_free(c);
           exit(1);
       }

       /* decode until eof */
       avpkt.data = inbuf;
       avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);

       //while there is still data
       while (avpkt.size > 0) {
           std::cout&lt;&lt;"decoding..."&lt;/decode
           len = avcodec_decode_audio3(pCodecCtx, (short *)outbuf, &amp;out_size, &amp;avpkt);

           if (len &lt; 0) {
               fprintf(stderr, "Error while decoding\n");
               exit(1);
           }

           if (out_size > 0) {
               /* if a frame has been decoded, output it */
               std::cout&lt;&lt;"1 frame decoded!"&lt;/subtract data from whatever decode function returns

           avpkt.size -= len;

           avpkt.data += len;

           if (avpkt.size &lt; AUDIO_REFILL_THRESH) {

               /* Refill the input buffer, to avoid trying to decode

               * incomplete frames. Instead of this, one could also use

               * a parser, or use a proper container format through

               * libavformat. */

               memmove(inbuf, avpkt.data, avpkt.size);

               avpkt.data = inbuf;

               len = fread(avpkt.data + avpkt.size, 1,

                           AUDIO_INBUF_SIZE - avpkt.size, f);

               if (len > 0)

                   avpkt.size += len;

           }



       }

       fclose(outfile);

       fclose(f);

       free(outbuf);

       avcodec_close(c);

       av_free(c);



    }
    </iostream>

    I have been stuck on this for quite a long time. Please help me.
    anyone know whats wrong with my code ?

    Thanks,

    Izak