Recherche avancée

Médias (0)

Mot : - Tags -/diogene

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (82)

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

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

Sur d’autres sites (9967)

  • FFmpeg memory leak

    10 septembre 2015, par Spamdark

    I have developed just a simple library modifing a library that I found on the internet.

    What scares me, is that, when I play an avi, it plays and free the memory when the video ends, but when I play the video, it’s like a memory leak ! It grows to 138mb although the video has ended and the FreeAll method (A function that deletes the context, etc...) has been called.

    Here is the code of the method that is causing the memory leak :

    int VideoGL::NextVideoFrame(){
    int frameDone = 0;
    int result = 0;
    double pts = 0;

    if(!this->ended){

    if (!_started) return 0;
    AVPacket* packet;

    // Get the number of milliseconds passed and see if we should display a new frame
    int64_t msPassed = (1000 * (clock() - _baseTime)) / CLOCKS_PER_SEC;
    if (msPassed >= _currentPts)
    {
       // If this is not the current frame, copy it to the buffer
       if (_currentFramePts != _currentPts){
           _currentFramePts = _currentPts;
           memcpy(buffer_a,buffer, 3 * _codec_context_video->width * _codec_context_video->height);
           result = 1;
       }

       // Try to load a new frame from the video packet queue
       bool goodop=false;
       AVFrame *_n_frame = avcodec_alloc_frame();
       while (!frameDone && (packet = this->DEQUEUE(VIDEO)) != NULL)
       {
           if (packet == (AVPacket*)-1) return -1;

           goodop=true;

           _s_pts = packet->pts;
           avcodec_decode_video2(_codec_context_video, _n_frame, &frameDone, packet);
           av_free_packet(packet);

           if (packet->dts == AV_NOPTS_VALUE)
           {
               if (_n_frame->opaque && *(uint64_t*)_n_frame->opaque != AV_NOPTS_VALUE) pts = (double) *(uint64_t*)_n_frame->opaque;
               else pts = 0;
           }
           else pts = (double) packet->dts;

           pts *= av_q2d(_codec_context_video->time_base);

       }

       if (frameDone)
       {
           // if a frame was loaded scale it to the current texture frame buffer, but also set the pts so that it won't be copied to the texture until it's time
           sws_scale(sws_ctx,_n_frame->data, _n_frame->linesize, 0, _codec_context_video->height, _rgb_frame->data, _rgb_frame->linesize);


           double nts = 1.0/av_q2d(_codec_context_video->time_base);
           _currentPts = (uint64_t) (pts*nts);

       }

       avcodec_free_frame(&_n_frame);
       av_free(_n_frame);

       if(!goodop){
           ended=true;
       }
    }
    }

    return result;
    }

    I’ll be waiting for answers, thanks.

  • how to output a media stream using ffmpeg ?

    26 juin 2017, par Sanduni Wickramasinghe

    I am reading a mpeg4 video stream using ffmpeg. I use some of its properties and do some processes using those properties. What I want is to play the opened video using a player like vlc. And then consequently I need to play the output video after processing in order to check whether there is a latency. Is it possible to give the video to a port. So that I can get the video as a input to the vlc player from the specific port.

    This is my code up to now. I use MV_generation method to extract features from it and to do a comparison from it.

    static int MV_generation(const AVPacket *pkt)
    {
       std::vector<unsigned long="long"> vl = File_read();
       std::hash<string> hash1;
       std::ios_base::app);
       double x_src_val = 0;
       double y_src_val = 0;
       double x_dst_val = 0;
       double y_dst_val = 0;

       int ret = avcodec_send_packet(video_dec_ctx, pkt);
       if (ret &lt; 0) {
           //fprintf(stderr, "Error while sending a packet to the decoder: %s\n", av_err2str(ret));
           return ret;
       }
       video_frame_count++;
       while (ret >= 0){

           ret = avcodec_receive_frame(video_dec_ctx, frame);
           if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
               break;
           }
           else if (ret &lt; 0) {
               return ret;
           }
           if (ret >= 0) {
               AVFrameSideData *sd;
               sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS);

               if (sd) {

                   const AVMotionVector *mvs = (const AVMotionVector *)sd->data;

                   int size_sd = sd->size;
                   //outData &lt;&lt; size_sd &lt;&lt; endl;

                   string str = "", str1, str2, str3, str4;
                   for (int i = 0; i &lt; size_sd / sizeof(*mvs); i++) {
                       const AVMotionVector *mv = &amp;mvs[i];

                       int x_src = mv->src_x;
                       int y_src = mv->src_y;
                       int x_dst = mv->dst_x;
                       int y_dst = mv->dst_y;


                       if (x_src != x_dst || y_src != y_dst || x_src > 100 || y_src > 100 || x_dst > 100 || y_dst > 100){
                           str1 = to_string(x_src);
                           str2 = to_string(y_src);
                           str3 = to_string(x_dst);
                           str4 = to_string(y_dst);

                           str = str.append(str1).append(str2).append(str3).append(str4);
                       }
                   }

                   for (unsigned long long y : vl)
                   {
                       // Check if any of the numbers are equal to x
                       if (hash1(str) == y)
                       {
                           cout &lt;&lt; "matched frame_no : " &lt;&lt; video_frame_count &lt;&lt; endl;
                       }
                   }
               }
               av_frame_unref(frame);
           }
       }
       outData.close();
       return 0;
    }
    </string></unsigned>
  • How do you display things in the rails console for the user in Rails ?

    30 décembre 2014, par Swaathi K

    I am using Streamio-ffmpeg to process files. The gem shows the progress of the transcoding in the console. I want to display this progress to the user. Is there anyway of doing this ?

    This is my helper : (Where the transcoding is done)

    if myfile.filetype == "video"
           movie = FFMPEG::Movie.new(oldpath(myfile))
           movie.transcode(newpath(myfile),"-deadline realtime -aq 10 -qmax 25") { |progress| puts progress }

           FileUtils.rm_rf(oldpath(myfile))

    The { |progress| puts progress } is responsible for printing the progress to the console. Can I display this in my views instead ?