Recherche avancée

Médias (1)

Mot : - Tags -/censure

Autres articles (54)

  • Qu’est ce qu’un éditorial

    21 juin 2013, par

    Ecrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
    Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
    Vous pouvez personnaliser le formulaire de création d’un éditorial.
    Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...)

  • Librairies et logiciels spécifiques aux médias

    10 décembre 2010, par

    Pour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
    Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

Sur d’autres sites (11001)

  • Merge commit ’c9478410c68c04261f9cfcd80474607e50bd1852’

    11 avril 2016, par Derek Buitenhuis
    Merge commit ’c9478410c68c04261f9cfcd80474607e50bd1852’
    

    * commit ’c9478410c68c04261f9cfcd80474607e50bd1852’ :
    avprobe : add local per-file state

    Merged-by : Derek Buitenhuis <derek.buitenhuis@gmail.com>

    • [DH] ffprobe.c
  • Merge commit ’567d6d5f9d1400f00445183b3477391f58979aa3’

    11 avril 2016, par Derek Buitenhuis
    Merge commit ’567d6d5f9d1400f00445183b3477391f58979aa3’
    

    * commit ’567d6d5f9d1400f00445183b3477391f58979aa3’ :
    avprobe : add local per-stream state

    Merged-by : Derek Buitenhuis <derek.buitenhuis@gmail.com>

    • [DH] ffprobe.c
  • Streaming Audio with OpenAL and FFMPEG

    28 janvier 2013, par Michael Barth

    Alright, basically I'm working on a simple video player and I'll probably be asking another question about lagging video\syncing to audio later, but for now I'm having a problem with audio. What I've managed to do to is go through all of the audio frames of a video and add them to a vector buffer then play the audio from that buffer using OpenAL.

    This is inefficient and memory hogging and so I need to be able stream it using what I guess is called a rotating buffer. I've ran into problems, one being that there's not a lot of information on streaming with OpenAL let alone the proper way to decode audio with FFMPEG and pipe it to OpenAL. I'm even less comfortable using a vector for my buffer because I honestly have no idea how vectors work in C++, but I some how managed to pull something out of my head to make it work.

    Currently I have a Video class that looks like this :

    class Video
    {
       public:
           Video(string MOV);
           ~Video();
           bool HasError();
           string GetError();
           void UpdateVideo();
           void RenderToQuad(float Width, float Height);
           void CleanTexture();
       private:
           string FileName;
           bool Error;
           int videoStream, audioStream, FrameFinished, ErrorLevel;
           AVPacket packet;
           AVFormatContext *pFormatCtx;
           AVCodecContext *pCodecCtx, *aCodecCtx;
           AVCodec *pCodec, *aCodec;
           AVFrame *pFrame, *pFrameRGB, *aFrame;

           GLuint VideoTexture;
           struct SwsContext* swsContext;

           ALint state;
           ALuint bufferID, sourceID;
           ALenum format;
           ALsizei freq;

           vector  bufferData;
    };

    The bottom private variables are the relevant ones. Currently I'm decoding audio in the class constructor to an AVFrame and adding the data to bufferData like so :

       av_init_packet(&amp;packet);

       alGenBuffers(1, &amp;bufferID);
       alGenSources(1, &amp;sourceID);

       alListener3f(AL_POSITION, 0.0f, 0.0f, 0.0f);

       int GotFrame = 0;

       freq = aCodecCtx->sample_rate;
       if (aCodecCtx->channels == 1)
           format = AL_FORMAT_MONO16;
       else
           format = AL_FORMAT_STEREO16;

       while (av_read_frame(pFormatCtx, &amp;packet) >= 0)
       {
           if (packet.stream_index == audioStream)
           {
               avcodec_decode_audio4(aCodecCtx, aFrame, &amp;GotFrame, &amp;packet);
               bufferData.insert(bufferData.end(), aFrame->data[0], aFrame->data[0] + aFrame->linesize[0]);
               av_free_packet(&amp;packet);
           }
       }
       av_seek_frame(pFormatCtx, audioStream, 0, AVSEEK_FLAG_BACKWARD);

       alBufferData(bufferID, format, &amp;bufferData[0], static_cast<alsizei>(bufferData.size()), freq);

       alSourcei(sourceID, AL_BUFFER, bufferID);
    </alsizei>

    In my UpdateVideo() is where I'm decoding video to an OpenGL texture through the video stream, so it would make sense for me to decode my audio there and stream it :

    void Video::UpdateVideo()
    {
       alGetSourcei(sourceID, AL_SOURCE_STATE, &amp;state);
       if (state != AL_PLAYING)
           alSourcePlay(sourceID);
       if (av_read_frame(pFormatCtx, &amp;packet) >= 0)
       {
           if (packet.stream_index == videoStream)
           {
               avcodec_decode_video2(pCodecCtx, pFrame, &amp;FrameFinished, &amp;packet);
               if (FrameFinished)
               {
                   sws_scale(swsContext, pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);
                   av_free_packet(&amp;packet);
               }
           }
           else if (packet.stream_index == audioStream)
           {
               /*
               avcodec_decode_audio4(aCodecCtx, aFrame, &amp;FrameFinishd, &amp;packet);
               if (FrameFinished)
               {
                   //Update Audio and rotate buffers here!
               }
               */
           }
           glGenTextures(1, &amp;VideoTexture);
           glBindTexture(GL_TEXTURE_2D, VideoTexture);
           glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
           glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
           glTexImage2D(GL_TEXTURE_2D, 0, 3, pCodecCtx->width, pCodecCtx->height, 0, GL_RGB, GL_UNSIGNED_BYTE, pFrameRGB->data[0]);
       }
       else
       {
           av_seek_frame(pFormatCtx, videoStream, 0, AVSEEK_FLAG_BACKWARD);
       }
    }

    So I guess the big question is how do I do it ? I've got no clue. Any help is appreciated, thank you !