Recherche avancée

Médias (2)

Mot : - Tags -/map

Autres articles (84)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

Sur d’autres sites (9250)

  • Wav File encoded with FFMPEG has issues with codecs while playing using VLC Player

    24 mai 2022, 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+44-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....

    


  • Wav File encoded with FFMPEG has issues with codecs while playing using VLC Player

    6 décembre 2012, 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....

  • ffserver + ffmpeg, out rtsp stream : why ffplay cannot play the stream, but movie player can

    18 juillet 2014, par user1914692

    Ubuntu 12.04
    I use ffserver + ffmpeg.

    There are a little revision of the original /etc/ffserver.conf :

    RTSPPort 5454
    RTSPBindAddress 0.0.0.0

    # ...

    <stream>
    Format rtp
    # coming from live feed 'feed1'
    Feed feed1.ffm
    </stream>

    The command of ffmpeg (Option 1) is :

    ffmpeg -re -i '/usr/share/red5/webapps/oflaDemo/streams/hobbit_vp6.flv'  http://localhost:8090/feed1.ffm

    BTW, if I use Option 2 as below, it does not work :

    ffmpeg -re -i '/usr/share/red5/webapps/oflaDemo/streams/hobbit_vp6.flv'  http://192.168.1.105:8090/feed1.ffm
    ## not work:
    [http @ 0x21a9c80] HTTP error 404 Not Found
    http://192.168.1.105:8090/feed1.ffm: Input/output error

    So now I need to display the stream.
    On the other computer :

    (Option 1) ffplay rtsp://192.168.1.105:5454/test2-rtsp.mpg

    Not work. [Output] rtsp UDP timeout, retrying with TCP.
    Why ?

    (Option 2) movie player : Open location : rtsp ://192.168.1.105:5454/test2-rtsp.mpg
    it works !