Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (63)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • 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

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

Sur d’autres sites (6726)

  • libvorbis : do not flush libvorbis analysis if dsp state was not initialized

    29 février 2012, par Justin Ruggles

    libvorbis : do not flush libvorbis analysis if dsp state was not initialized

  • libvorbis : do not flush libvorbis analysis if dsp state was not initialized

    29 février 2012, par Justin Ruggles

    libvorbis : do not flush libvorbis analysis if dsp state was not initialized

  • ffmpeg audio decoding providing half the data from original audio in C++

    3 mai 2016, par hockeyislife

    I am trying to write a simple program in C++ that captures audio from a microphone on the computer and encodes it into mp2. Which I was successful in doing, I verified this by saving a mp2 audio file and playing it back in VLC.

    I then decided to see if I could take the encoded audio packets from ffmpeg and convert them back to raw PCM format, and this is where I am having trouble.

    So below is my decoder settings :

    AVCodecID audio_codec_id = AV_CODEC_ID_MP2;
    AVCodec * audio_decodec = avcodec_find_decoder(audio_codec_id);
    if (!audio_decodec)
    {
       return -1;
    }
    audio_decodec_ctx = avcodec_alloc_context3(audio_decodec);
    audio_decodec_ctx->bit_rate = 64000;
    audio_decodec_ctx->channels = 2;
    audio_decodec_ctx->channel_layout = AV_CH_LAYOUT_STEREO;
    audio_decodec_ctx->sample_rate = 44100;
    audio_decodec_ctx->sample_fmt = AV_SAMPLE_FMT_S16;

    int retval;
    if ((retval = avcodec_open2(audio_decodec_ctx, audio_decodec, NULL)) < 0)
    {
       return -1;
    }

    Here is my encoder settings, which I made identical :

    AVCodecID audio_codec_id = AV_CODEC_ID_MP2;
    AVCodec* audio_codec = avcodec_find_encoder(audio_codec_id);
    if (!audio_codec)
    {
       return -1;
    }

    // Initialize codec.
    AVCodecContext* audio_codec_ctx = avcodec_alloc_context3(audio_codec);
    audio_codec_ctx->bit_rate = 64000;
    audio_codec_ctx->channels = 2;
    audio_codec_ctx->channel_layout = AV_CH_LAYOUT_STEREO;
    audio_codec_ctx->sample_rate = 44100;
    audio_codec_ctx->sample_fmt = AV_SAMPLE_FMT_S16;

    int audio_retval;
    if ((audio_retval = avcodec_open2(audio_codec_ctx, audio_codec, NULL)) < 0)
    {
       return -1;
    }

    As stated previously, the encoding of the audio signal works perfectly, when I try to take the packets that are encoded and attempt to convert them back I am getting only half the data.

    avcodec_encode_audio2(audio_codec_ctx, &audio_pkt, pOutAudioFrame, &got_output);

    if (got_output)
    {
       fwrite(audio_pkt.data, 1, audio_pkt.size, f); // MP2 file write which, sounds very nice, which leads me to believe encoding is being done correctly
       AVFrame * audio_frame_decode = av_frame_alloc();
       avcodec_get_frame_defaults(audio_frame_decode);
       int frame_finished = 0;

       avcodec_decode_audio4(audio_decodec_ctx, audio_frame_decode, &frame_finished, &audio_pkt );
       if (frame_finished)
       {
           decoded_size += audio_frame_decode->linesize[0];  // only getting 2304 bytes
           av_free_packet(&audio_pkt);
       }
    }  

    The amount of PCM data being taken is 4608 but after decoding the encoder version I am getting only 2304 bytes. Seems like I have something incorrect but I can’t put my finger on it. Any help would be greatly appreciated.

    Thanks in advance.