Recherche avancée

Médias (2)

Mot : - Tags -/documentation

Autres articles (90)

  • 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 (...)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

Sur d’autres sites (8801)

  • How to capture camera devices on Windows using Libav ?

    22 septembre 2011, par Occulta

    Is there any way to capture frames from as many camera types as DirectShow do on Windows platform using Libav ? I need to capture a camera output without using DirectShow filters and I want my application to work with many camera devices types.

    I have searched the Internet about this capability of libav and found that it can be done via libav using special input format "vfwcap". Something like that (don't sure about code correctness - I wrote it by myself) :

    AVFormatParameters formatParams = NULL;
    AVInputFormat* pInfmt = NULL;
    pInFormatCtx*  pInFormatCtx = NULL;

    av_register_all();

    //formatParams.device = NULL; //this was probably deprecated and then removed
    formatParams.channel = 0;
    formatParams.standard = "ntsc"; //deprecated too but still available
    formatParams.width = 640;
    formatParams.height = 480;
    formatParams.time_base.num = 1000;
    formatParams.time_base.den = 30000; //so we want 30000/1000 = 30 frames per second
    formatParams.prealloced_context = 0;


    pInfmt = av_find_input_format("vfwcap");
    if( !pInfmt )
    {
     fprintf(stderr,"Unknown input format\n");
     return -1;
    }

    // Open video file (formatParams can be NULL for autodetecting probably)
    if (av_open_input_file(&pInFormatCtx, 0, pInfmt, 0, formatParams) < 0)
      return -1; // Couldn't open device

    /* Same as video4linux code*/

    So another question is : how many devices are supported by Libav ? All I have found about capture cameras output with libav on windows is advice to use DirectShow for this purpose because libav supports too few devices. Maybe situation has already changed now and it does support enough devices to use it in production applications ?

    If this isn't possible.. Well I hope my question won't be useless and this composed from different sources piece of code will help someone interested in this theme 'coz there are really too few information about it in the whole internet.

  • Choppy sound when using ffmpeg

    24 novembre 2011, par Kurt

    I suffered some choppy audio when i try to capture audio from a live stream.
    Another essential problem which could explain the problem is that the Wav file created is twice longer than the capture time.

    The audio is perfect when i play the avs input file with ffplay, so the avs is ok, the problem is after whether in the capture or in the Wav writing.

    To capture :

    av_read_frame(pFormatCtx, &packet)

    if(packet.stream_index == mAudioStream)
    {
       int buff_size = sizeof(mAudioBuffer);
       std::cout << "Buff_size " << buff_size << std::endl;
       len = avcodec_decode_audio3(pAudioCodecCtx,(int16_t*)mAudioBuffer, &buff_size,&packet);
       if(len < 0){
           qDebug("Extractor - Audio isEnd = -1;");
           mAudioBufferSize = 0;
           isEnd = ERROR_;
           return isEnd;
       }

       // Set packet result type
       mFrameType = AUDIO_PKT;
       mAudioBufferSize = buff_size;
       //store audio synchronization informations:
       if(packet.pts != AV_NOPTS_VALUE) {
            mAudioPts_ = av_q2d(pFormatCtx->streams[mAudioStream]->time_base);
            mAudioPts_ *= packet.pts;
       }
    }

           // store a copy of current audio frame in _frame
           _frame.audioFrame = new decoded_frame_t::audio_frame_t();
           _frame.audioFrame->sampleRate = mediaInfos.audioSampleRate;
           _frame.audioFrame->sampleSize = mediaInfos.audioSampleSize;
           _frame.audioFrame->nbChannels = mediaInfos.audioNbChannels;
           _frame.audioFrame->nbSamples = mAudioBufferSize / ((mediaInfos.audioSampleSize/8) * mediaInfos.audioNbChannels);
           _frame.audioFrame->buf.resize(mAudioBufferSize);
           memcpy(&_frame.audioFrame->buf[0],mAudioBuffer,mAudioBufferSize);

    Then i store in a Wav File using libsndfile :

    SNDFILE*            fd;
    SF_INFO             sfInf;

    sfInf.frames = 0;
    sfInf.channels = p_capt->ui_nbChannels;
    sfInf.samplerate = p_capt->ui_sampleRate;
    sfInf.format = SF_FORMAT_WAV | SF_FORMAT_PCM_U8;
    sfInf.sections = 0;
    sfInf.seekable = 0;

    if (sf_format_check(&sfInf) == FALSE)
       std::cout << "Format parameter are uncorrect ! Exit saving !" << std::endl;
    else
    {
       fd = sf_open(fileName.toStdString().c_str(), SFM_WRITE, &sfInf);
       if (fd == NULL)
       {
           std::cout << "Unable to open the file " << fileName.toStdString() << std::endl;
           return GRAB_ST_NOK;
       }

       //little trick because v_buf is a uint8_t vector
       sf_count_t l = sf_write_short(fd, (const short *)(&(p_capt->v_buf[0])), p_capt->v_buf.size()/2);

       if (l != p_capt->v_buf.size()/2)
       {
          std::cout << "sf_write didn't write the right amoung of bits " << l << " != " << p_capt->v_buf.size()/2 << std::endl;
          ret = GRAB_ST_NOK;
       }
       else
       {
           sf_write_sync(fd);
           sf_close(fd);
           ret = GRAB_ST_OK;
       }
    }

    I hope it's understandable. Waiting for remarks.

    Kurt

  • Red5 and FFmpeg in streaming [closed]

    22 mai 2013, par user2408040

    I have installed Red5 and ffmpeg in Ubuntu.

    My idea is use the example http://localhost:5080/demos/ofla_demo.html for a simple streaming with ffmpeg.

    I use ffmpeg as follow :

    ffmpeg -i out.flv -f flv "rtmp://localhost:5080/oflaDemo"

    I hope is to see in http://localhost:5080/demos/ofla_demo.html my streaming but this not happen.

    Someone can tell me I'm doing wrong ?

    Sorry my English :)

    Regards