Recherche avancée

Médias (1)

Mot : - Tags -/lev manovitch

Autres articles (12)

  • 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

  • ANNEXE : Les extensions, plugins SPIP des canaux

    11 février 2010, par

    Un plugin est un ajout fonctionnel au noyau principal de SPIP. MediaSPIP consiste en un choix délibéré de plugins existant ou pas auparavant dans la communauté SPIP, qui ont pour certains nécessité soit leur création de A à Z, soit des ajouts de fonctionnalités.
    Les extensions que MediaSPIP nécessite pour fonctionner
    Depuis la version 2.1.0, SPIP permet d’ajouter des plugins dans le répertoire extensions/.
    Les "extensions" ne sont ni plus ni moins que des plugins dont la particularité est qu’ils se (...)

  • Le plugin : Gestion de la mutualisation

    2 mars 2010, par

    Le plugin de Gestion de mutualisation permet de gérer les différents canaux de mediaspip depuis un site maître. Il a pour but de fournir une solution pure SPIP afin de remplacer cette ancienne solution.
    Installation basique
    On installe les fichiers de SPIP sur le serveur.
    On ajoute ensuite le plugin "mutualisation" à la racine du site comme décrit ici.
    On customise le fichier mes_options.php central comme on le souhaite. Voilà pour l’exemple celui de la plateforme mediaspip.net :
    < ?php (...)

Sur d’autres sites (3542)

  • FFMpeg DVB Subtitles memory leak

    13 janvier 2015, par WLGfx

    When decoding the subtitles track from an mpegts udp mutlicast stream I am getting a memory leak using avcodec_decode_subtitle2. The audio and video streams are fine. And all three streams are manually memory managed by pre-allocating all buffers.

    There’s very little information about but I do believe there’s a patch somewhere.

    I’m currently using ffmpeg 2.0.4 compiled for armv7-a for android.

    In the process I’ve found that video streams are different resolutions, ie, 720x576 or 576x576 which doesn’t matter now as I am rendering the subtitles separately as an overlay on the video. My original decoding function (which is changing to render a separate overlay) is :

    void ffProcessSubtitlePacket( AVPacket *pkt )
    {
       //LOGI("NATIVE FFMPEG SUBTITLE - Decoding subtitle packet");

       int got = 0;

       avcodec_decode_subtitle2(ffSubtitleContext, &amp;ffSubtitleFrame, &amp;got, pkt);

       if ( got )
       {
           //LOGI("NATIVE FFMPEG SUBTITLE - Got subtitle frame");
           //LOGI("NATIVE FFMPEG SUBTITLE - Format = %d, Start = %d, End = %d, Rects = %d, PTS = %llu, AudioPTS = %llu, PacketPTS = %llu",
           //      ffSubtitleFrame.format, ffSubtitleFrame.start_display_time,
           //      ffSubtitleFrame.end_display_time, ffSubtitleFrame.num_rects,
           //      ffSubtitleFrame.pts, ffAudioGetPTS(), pkt->pts);

           // now add the subtitle data to the list ready

           for ( int s = 0; s &lt; ffSubtitleFrame.num_rects; s++ )
           {
               ffSubtitle *sub = (ffSubtitle*)mmAlloc(sizeof(ffSubtitle)); //new ffSubtitle;

               if ( sub )
               {
                   AVSubtitleRect *r = ffSubtitleFrame.rects[s];
                   AVPicture *p = &amp;r->pict;

                   // set main data

                   sub->startPTS   = pkt->pts + (uint64_t)ffSubtitleFrame.start_display_time;
                   sub->endPTS     = pkt->pts + (uint64_t)ffSubtitleFrame.end_display_time * (uint64_t)500;
                   sub->nb_colors  = r->nb_colors;
                   sub->xpos       = r->x;
                   sub->ypos       = r->y;
                   sub->width      = r->w;
                   sub->height     = r->h;

                   // allocate space for CLUT and image all in one chunk

                   sub->data       = mmAlloc(r->nb_colors * 4 + r->w * r->h); //new char[r->nb_colors * 4 + r->w * r->h];

                   if ( sub->data )
                   {
                       // copy the CLUT data

                       memcpy(sub->data, p->data[1], r->nb_colors * 4);

                       // copy the bitmap onto the end

                       memcpy(sub->data + r->nb_colors * 4, p->data[0], r->w * r->h);

                       // check for duplicate subtitles and remove them as this
                       // one replaces it with a new bitmap data

                       int pos = ffSubtitles.size();

                       while ( pos-- )
                       {
                           ffSubtitle *s = ffSubtitles[pos];
                           if ( s->xpos == sub->xpos &amp;&amp;
                                s->ypos == sub->ypos &amp;&amp;
                                s->width == sub->width &amp;&amp;
                                s->height == sub->height )
                           {
                               //delete s;
                               ffSubtitles.erase( ffSubtitles.begin() + pos );

                               //LOGI("NATIVE FFMPEG SUBTITLE - Removed old duplicate subtitle, size %d", ffSubtitles.size());
                           }
                       }

                       // append to subtitles list

                       ffSubtitles.push_back( sub );

                       char *dat;  // data pointer used for the CLUT table

                       //LOGI("NATIVE FFMPEG SUBTITLE - Added %d,%d - %d,%d, Queue %d, Length = %d",
                       //  r->x, r->y, r->w, r->h, ffSubtitles.size(), ffSubtitleFrame.end_display_time);

                       // convert the CLUT (RGB) to YUV values

                       dat = sub->data;

                       for ( int c = 0; c &lt; r->nb_colors; c++ )
                       {
                           int r = dat[0];
                           int g = dat[1];
                           int b = dat[2];

                           int y = ( (  65 * r + 128 * g +  24 * b + 128) >> 8) +  16;
                           int u = ( ( -37 * r -  74 * g + 112 * b + 128) >> 8) + 128;
                           int v = ( ( 112 * r -  93 * g -  18 * b + 128) >> 8) + 128;

                           *dat++ = (char)y;
                           *dat++ = (char)u;
                           *dat++ = (char)v;
                           dat++;  // skip the alpha channel
                       }
                   }
                   else
                   {
                       //delete sub;
                       sub = 0;
                       LOGI("NATIVE FFMPEG SUBTITLE - Memory allocation error CLUT and BITMAP");
                   }
               }
               else
               {
                   LOGI("NATIVE FFMPEG SUBTITLE - Memory allocation error ffSubtitle struct");
                   mmGarbageCollect();
                   ffSubtitles.clear();
               }
           }
       }
    }

    void ffSubtitleRenderCheck(int bpos)
    {
       if ( ffSubtitleID == -1 || !usingSubtitles )
       {
           // empty the list in case of memory leaks

           ffSubtitles.clear();
           mmGarbageCollect();
           return;
       }

       uint64_t audioPTS = ffAudioGetPTS();
       int pos = 0;

       // draw the subtitle list to the YUV frames

       char *yframe = ffVideoBuffers[bpos].yFrame;
       char *uframe = ffVideoBuffers[bpos].uFrame;
       char *vframe = ffVideoBuffers[bpos].vFrame;

       int ywidth = fv.frameActualWidth;   // actual width with padding
       int uvwidth = fv.frameAWidthHalf;   // and for uv frames

       while ( pos &lt; ffSubtitles.size() )
       {
           ffSubtitle *sub = ffSubtitles[pos];

           if ( sub->startPTS >= audioPTS ) // okay to draw this one?
           {
               //LOGI("NATIVE FFMPEG SUBTITLE - Rendering subtitle bitmap %d", pos);

               char *clut = sub->data;     // colour table
               char *dat = clut + sub->nb_colors * 4; // start of bitmap data

               int w = sub->width;
               int h = sub->height;
               int x = sub->xpos;
               int y = sub->ypos;

               for ( int xpos = 0; xpos &lt; w; xpos++ )
               {
                   for ( int ypos = 0; ypos &lt; h; ypos++ )
                   {
                       // get colour for pixel
                       char bcol = dat[ypos * w + xpos];

                       if ( bcol != 0 )    // ignore 0 pixels
                       {
                           char cluty = clut[bcol * 4 + 0];    // get colours from CLUT
                           char clutu = clut[bcol * 4 + 1];
                           char clutv = clut[bcol * 4 + 2];

                           // draw to Y frame

                           int newx = x + xpos;
                           int newy = y + ypos;

                           yframe[newy * ywidth + newx] = cluty;

                           // draw to uv frames if we have a quarter pixel only

                           if ( ( newy &amp; 1 ) &amp;&amp; ( newx &amp; 1 ) )
                           {
                               uframe[(newy >> 1) * uvwidth + (newx >> 1)] = clutu;
                               vframe[(newy >> 1) * uvwidth + (newx >> 1)] = clutv;
                           }
                       }
                   }
               }
           }

           pos++;
       }

       // Last thing is to erase timed out subtitles

       pos = ffSubtitles.size();

       while ( pos-- )
       {
           ffSubtitle *sub = ffSubtitles[pos];

           if ( sub->endPTS &lt; audioPTS )
           {
               //delete sub;
               ffSubtitles.erase( ffSubtitles.begin() + pos );

               //LOGI("NATIVE FFMPEG SUBTITLE - Removed timed out subtitle");
           }
       }

       if ( ffSubtitles.size() == 0 )
       {
           // garbage collect the custom memory pool

           mmGarbageCollect();
       }

       //LOGI("NATIVE FFMPEG SUBTITLE - Size of subtitle list = %d", ffSubtitles.size());
    }

    Any information would be appreciated or would I have to upgrade to a later version of ffmpeg ?

  • How to Save and Display a Video Simultaneously using C# Aforge.NET framework ?

    8 avril 2014, par Akshay

    I am able to display the video from my webcam or any other integrated device into a picturebox . Also i am able to Save the video into an avi file using FFMPEG DLL files.
    I want to do both things simultaneously ie Save the video in the avi file as well as at the same time display the live feed too.
    This is for a surveillance project where i want to monitor the live feed and save those too.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    using AForge.Video;
    using AForge.Video.DirectShow;
    using AForge.Video.FFMPEG;
    using AForge.Video.VFW;
    using System.Drawing.Imaging;
    using System.IO;

    namespace cam_aforge1
    {
    public partial class Form1 : Form
    {
       private bool DeviceExist = false;
       private FilterInfoCollection videoDevices;
       private VideoCaptureDevice videoSource = null;

       public Form1()
       {
           InitializeComponent();
       }

       private void getCamList()
       {
           try
           {
               videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
               comboBox1.Items.Clear();
               if (videoDevices.Count == 0)
                   throw new ApplicationException();

               DeviceExist = true;
               foreach (FilterInfo device in videoDevices)
               {
                   comboBox1.Items.Add(device.Name);
               }
               comboBox1.SelectedIndex = 0; //make dafault to first cam
           }
           catch (ApplicationException)
           {
               DeviceExist = false;
               comboBox1.Items.Add("No capture device on your system");
           }
       }

       private void rfsh_Click(object sender, EventArgs e)
       {
           getCamList();
       }

       private void start_Click(object sender, EventArgs e)
       {
           if (start.Text == "&amp;Start")
           {
               if (DeviceExist)
               {
                   videoSource = new VideoCaptureDevice(videoDevices[comboBox1.SelectedIndex].MonikerString);
                   videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
                   videoSource.NewFrame += new NewFrameEventHandler(video_NewFrameSave);
                   CloseVideoSource();
                   videoSource.DesiredFrameSize = new Size(160, 120);
                   //videoSource.DesiredFrameRate = 10;
                   videoSource.Start();
                   label2.Text = "Device running...";
                   start.Text = "&amp;Stop";
                   timer1.Enabled = true;
               }
               else
               {
                   label2.Text = "Error: No Device selected.";
               }
           }
           else
           {
               if (videoSource.IsRunning)
               {
                   timer1.Enabled = false;
                   CloseVideoSource();
                   label2.Text = "Device stopped.";
                   start.Text = "&amp;Start";                    
               }
           }
       }
       private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
       {
           Bitmap img = (Bitmap)eventArgs.Frame.Clone();
           pictureBox1.Image = img;
       }

       Bitmap imgsave;
       private void video_NewFrameSave(object sender, NewFrameEventArgs eventArgs)
       {
           imgsave = (Bitmap)eventArgs.Frame.Clone();
       }

       private void CloseVideoSource()
       {
           if (!(videoSource == null))
               if (videoSource.IsRunning)
               {
                   videoSource.SignalToStop();
                   videoSource = null;
               }
       }

       private void timer1_Tick(object sender, EventArgs e)
       {
           label2.Text = "Device running... " + videoSource.FramesReceived.ToString() + " FPS";
       }

       private void Form1_FormClosed(object sender, FormClosedEventArgs e)
       {
           CloseVideoSource();
       }

       private void Form1_Load(object sender, EventArgs e)
       {

       }

       VideoFileWriter writer;

       private void button1_Click(object sender, EventArgs e)
       {
           int width = 640;
           int height = 480;
           writer = new VideoFileWriter();
           writer.Open("test.avi", width, height, 75, VideoCodec.MPEG4);
           for (int i = 0; i &lt; 5000; i++)
           {
               writer.WriteVideoFrame(imgsave);
           }

       }

       private void button2_Click(object sender, EventArgs e)
       {
           writer.Close();
       }

    }
    }

    Thanks in advance.

  • Rotate a video based on the rotate metadata with ffmpeg ?

    10 juillet 2014, par qix

    I know I can transpose the video with the transpose video filter if I know how the video is rotated in advance, and update the metadata using something like this -metadata:s:v:0 rotate=0, but how can I use the correct transpose value dependent on the metadata rotate bit in the video ? Basically I want to bake the rotate information into the video data itself, and clear the rotate metadata.

    Is it possible to do this with ffmpeg alone, or must I write some sort of script to extract the rotation value, and call ffmpeg with the appropriate options ? If the latter, does anyone have a working script already ? :) I see this as one guy’s approach using exiftool and rails ; is it possible to do it without ?