Recherche avancée

Médias (1)

Mot : - Tags -/wave

Autres articles (96)

  • 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 ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (4996)

  • Wav File Encoding with FFMPEG

    7 septembre 2011, par user924702

    I want to convert raw PCM data(Taken from Android Phone mic) into a libGSM Wave file. After encoding into file, VLC player shows right codec information and duration but unable to play contents. Please help me to find what I am doing wrong.

    Below is my code for encoding and header writing :

    void EncodeTest(uint8_t *audioData, size_t audioSize)
    {
       AVCodecContext  *audioCodec;
       AVCodec *codec;
       uint8_t *buf;    int bufSize, frameBytes;
       __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG,"Lets encode :%u with size %d\n",(int)audioData, (int)audioSize);
       //Set up audio encoder
       codec = avcodec_find_encoder(CODEC_ID_GSM);
       if (codec == NULL){
           __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,"ERROR:: Unable to find encoder(CODEC_ID_GSM)");
           codec = avcodec_find_encoder(CODEC_ID_GSM);
           if (codec == NULL){
               __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,"ERROR:: Unable to find encoder(CODEC_ID_GSM)");
               return;
           }
       }
       audioCodec                  = avcodec_alloc_context();
       audioCodec->channels        = 1;
       audioCodec->sample_rate     = 8000;
       audioCodec->sample_fmt      = SAMPLE_FMT_S16;
       audioCodec->bit_rate        = 13200;
       audioCodec->priv_data       = gsm_create();

       switch(audioCodec->codec_id) {
           case CODEC_ID_GSM:
               audioCodec->frame_size = GSM_FRAME_SIZE;
               audioCodec->block_align = GSM_BLOCK_SIZE;
               int one = 1;
               gsm_option(audioCodec->priv_data, GSM_OPT_WAV49, &one);
               break;
           case CODEC_ID_GSM_MS: {
               int one = 1;
               gsm_option(audioCodec->priv_data, GSM_OPT_WAV49, &one);
               audioCodec->frame_size = 2*GSM_FRAME_SIZE;
               audioCodec->block_align = GSM_MS_BLOCK_SIZE;
           }
       }
       audioCodec->coded_frame= avcodec_alloc_frame();
       audioCodec->coded_frame->key_frame= 1;
       audioCodec->time_base       = (AVRational){1,  audioCodec->sample_rate};
       audioCodec->codec_type      = CODEC_TYPE_AUDIO;

       if (avcodec_open(audioCodec, codec) < 0){
           __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,"ERROR:: Unable to avcodec_open");
           return;
       }

       bufSize     = FF_MIN_BUFFER_SIZE * 10;
       buf         = (uint8_t *)malloc(bufSize);
       if (buf == NULL) return;
       frameBytes = audioCodec->frame_size * audioCodec->channels * 2;
       FILE *fileWrite = fopen(FILE_NAME,"w+b");
       if(NULL == fileWrite){
           __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,"ERROR:: Unable to open file for reading.");
       }
       /*Write wave header*/
       WriteWav(fileWrite, 32505);/*Just for test*/

       /*Lets encode raw packet and write into file after header.*/
       __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG,"Lets Encode Actual Bytes");
       int nChunckSize = 0;
       while (audioSize >= frameBytes)
       {
           int packetSize;

           packetSize = avcodec_encode_audio(audioCodec, buf, bufSize, (short *)audioData);
           __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG,"Encoder returned %d bytes of data\n", packetSize);
           nChunckSize += packetSize;
           audioData += frameBytes;
           audioSize -= frameBytes;
           if(NULL != fileWrite){
               fwrite(buf, packetSize, 1, fileWrite);
           }
           else{
               __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,"Unable to open file for writting... NULL");
           }
       }
       if(NULL != fileWrite){
           fclose(fileWrite);
       }
       __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG,"----- Done with nChunckSize: %d --- ",nChunckSize);
        __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG,"*****************************");
       wavReadnDisplayHeader(FILE_NAME);
       __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG,"*****************************");
       wavReadnDisplayHeader("/sdcard/Voicemail2.wav");
    }

    Header Writing :

    /** Writes WAV headers */
    void WriteWav(FILE *f, long int bytes)
    {
       /* quick and dirty */
       fwrite("RIFF",sizeof(char),4,f);                /*  0-3 */      //RIFF
       PutNum(bytesã8,f,1,4);                       /*  4-7 */      //ChunkSize
       fwrite("WAVEfmt ",sizeof(char),8,f);            /*  8-15 */     //WAVE Header + FMT header
       PutNum(16,f,1,4);                               /* 16-19 */     //Size of the fmt chunk
       PutNum(49,f,1,2);                                /* 20-21 */     //Audio format, 49=libgsm wave, 1=PCM,6=mulaw,7=alaw, 257=IBM Mu-Law, 258=IBM A-Law, 259=ADPCM
       PutNum(1,f,1,2);                                /* 22-23 */     //Number of channels 1=Mono 2=Sterio
       PutNum(8000,f,1,4);                             /* 24-27 */     //Sampling Frequency in Hz
       PutNum(2*8000,f,1,4);                           /* 28-31 */     //bytes per second /Sample/persec
       PutNum(2,f,1,2);                                /* 32-33 */     // 2=16-bit mono, 4=16-bit stereo
       PutNum(16,f,1,2);                                /* 34-35 */     // Number of bits per sample
       fwrite("data",sizeof(char),4,f);                /* 36-39 */    
       PutNum(bytes,f,1,4);                            /* 40-43 */     //Sampled data length  
    }

    Please help....

  • Started Programming Young

    6 septembre 2011, par Multimedia Mike — Programming

    I have some of the strangest memories of my struggles to jump into computer programming.

    Back To BASIC
    I remember doing some Logo programming on Apple II computers at school in 5th grade (1987 timeframe). But that was mostly driving turtle graphics. Then I remember doing some TRS-80 BASIC in 7th grade, circa 1989. Emboldened by what very little I had learned in perhaps the week or 2 we took in a science class to do this, I tried a little GW-BASIC on my family’s “IBM-PC compatible” computer (they were still called that back then). I still remember what my first program consisted of. Even back then I was interested in manipulating graphics and color on a computer screen. Thus :

    10 color 1
    20 print "This is color 1"
    30 color 2
    40 print "This is color 2"
    ...
    

    And so on through 15 colors. Hey, it did the job– it demonstrated the 15 different colors you could set in text mode.

    What’s FOR For ?
    That 7th grade computer unit in science class wasn’t very thick on computer science details. I recall working with a lab partner to transcribe code listings into a computer (and also saving my work to a storage cassette). We also developed form processing programs that would print instructions to input text followed by an “INPUT I$” statement to obtain the user’s output.

    I remember there was some situation where we needed a brief delay between input and printing. The teacher told us to use a construct of the form :

    10 FOR I = 1 TO 20000
    20 NEXT I
    

    We had to calibrate the number based on our empirical assessment of how long it lasted but I recall that the number couldn’t be much higher than about 32000, for reasons that would become clearer much later.

    Imagine my confusion when I would read and try to comprehend BASIC program code I would find in magazines. I would of course see that FOR..NEXT construct all over the place but obviously not in the context of introducing deliberate execution delays. Indeed, my understanding of one of the fundamental building blocks of computer programming — iteration — was completely skewed because of this early lesson.

    Refactoring
    Somewhere along the line, I figured out that the FOR..NEXT could be used to do the same thing a bunch of times, possibly with different values. A few years after I had written that color program, I found it again and realized that I could write it as :

    10 for I = 1 to 15
    20 color I
    30 print I
    40 next I
    

    It still took me a few more years to sort out the meaning of WHILE..WEND, though.

  • Working way to make video from images in C#

    29 août 2011, par Jim Mischel

    Does anybody have a known reliable way to create a video from a series of image files ? Before you mod me down for not searching for the answer before posting the question, and before you fire off a simple message like "use FFMPEG," read the rest of this message.

    I'm trying to create a video, it doesn't matter too much what format as long as it's widely supported, from a series of images (.jpg, .bmp, etc.). My platform is Windows Server 2008, 64-bit. If I can make the video from within my C# program, that's great, but I'm not averse to writing a series of image files to a directory and then firing off an external program to make a video from those images.

    The only constraints are : it must work on my Windows Server 2008 system, and be scriptable. That is, no GUI programs that require operator intervention.

    I found a number of similar questions on StackOverflow, and have tried several of the solutions, all with varying degrees of frustration and none with anything like success.

    FFMPEG looks like a great program. Maybe it is, on Linux. The two Windows builds I downloaded are broken. Given this command line :

     ffmpeg -r 1 -f image2 -i jpeg\*.jpg video.avi

    One of the builds reads the images and then crashes due to data execution prevention. The other reads the first file and then spits out an error message that says "cannot find suitable codec for file jpeg/image2.jpg". Helpful, that. In any case, FFMPEG looks like a non-starter under Windows.

    One answer to a previous posting recommended Splicer . It looks like pretty good code. I compiled the samples and tried to run, but got some cryptic error message about a file not found. It looks like a COM class isn't registered. I suppose I need to install something (DirectShow, maybe, although I thought that was already installed ?). Depending on what's required, I might have a difficult time justifying its installation on a server. ("What ? Why do you need that on a server ?")

    Another answer suggested the AviFile library from Code Project. That looks simple enough : a wrapper around the Windows AviFile subsystem. Except that the AVI files the package creates appear to have all of the frames, but only the first frame shows when I play the AVI in Windows Media Player. Well, that and if you try to create a compressed video, the program throws an exception.

    So, I'm left wondering if there is a good, reliable way to do what I want : on a Windows system, create an AVI or other common video file format from a series of images, either through a .NET API or using an external program. Any help ?