Recherche avancée

Médias (1)

Mot : - Tags -/epub

Autres articles (97)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

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

  • Memory leak while opening encoders in ffmpeg

    22 janvier 2014, par praks411

    I'm getting memory leaks in avcodec_find_encoder. Although I'm cleaning the resources properly
    still I'm not able to get rid of the leak. By successive commenting the code I found that memory leaks happen only after the call of avcodec_find_encoder(). I've tried my code with different video files and I found that memory leaks blocks are always same. Also if I open only audio or video then I get just one memory leaks block.
    Below is the part of Init and Clean-up code from the application.
    Note that this is just part of code which contains initialization and resource release.

    AVFormatContext *m_informat;
    AVFormatContext *m_outformat;
    AVStream *m_in_vid_strm, *m_out_vid_strm;
    AVStream *m_in_aud_strm, *m_out_aud_strm;


    int VideoClipper::Init(const wxString&amp; filename)
    {
       int ret = 0;
       char errbuf[64];

       av_register_all();
       if ((ret = avformat_open_input( &amp;m_informat, filename.mb_str(), 0, 0)) != 0 )
       {
           av_strerror(ret,errbuf,sizeof(errbuf));
           PRINT_VAL("Not able to Open file;; ", errbuf)
           ret = -1;
           return ret;
       }
       else
       {
           PRINT_MSG("Opened File ")
       }

       if ((ret = avformat_find_stream_info(m_informat, 0))&lt; 0 )
       {

           av_strerror(ret,errbuf,sizeof(errbuf));
           PRINT_VAL("Not Able to find stream info:: ", errbuf)
           ret = -1;
           return ret;
       }
       else
       {
           PRINT_MSG("Got stream Info ")
       }

       for(unsigned int i = 0; inb_streams; i++)
       {
           if(m_informat->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
           {

               PRINT_MSG("Found Video Stream ")
               m_in_vid_strm_idx = i;
               m_in_vid_strm = m_informat->streams[i];
           }

           if(m_informat->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
           {
               PRINT_MSG("Found Audio Stream ")
               m_in_aud_strm_idx = i;
               m_in_aud_strm = m_informat->streams[i];
           }
       }

       AVOutputFormat *outfmt = NULL;
       std::string outfile = std::string(filename) + "clip_out.avi";
       outfmt = av_guess_format(NULL,outfile.c_str(),NULL);

       if(outfmt == NULL)
       {
           ret = -1;
           return ret;
       }
       else
       {
           m_outformat = avformat_alloc_context();
           if(m_outformat)
           {
               m_outformat->oformat = outfmt;
               _snprintf(m_outformat->filename, sizeof(m_outformat->filename), "%s", outfile.c_str());    
           }
           else
           {
               ret = -1;
               return ret;
           }
       }

       AVCodec *out_vid_codec,*out_aud_codec;
       out_vid_codec = out_aud_codec = NULL;

       if(outfmt->video_codec != AV_CODEC_ID_NONE &amp;&amp; m_in_vid_strm != NULL)
       {
           out_vid_codec = avcodec_find_encoder(outfmt->video_codec);
           if(NULL == out_vid_codec)
           {
               PRINT_MSG("Could Not Find Vid Encoder")
               ret = -1;
               return ret;
           }
           else
           {
               PRINT_MSG("Found Out Vid Encoder ")
               m_out_vid_strm = avformat_new_stream(m_outformat, out_vid_codec);
               if(NULL == m_out_vid_strm)
               {
                    PRINT_MSG("Failed to Allocate Output Vid Strm ")
                    ret = -1;
                    return ret;
               }
               else
               {
                    PRINT_MSG("Allocated Video Stream ")
                    if(avcodec_copy_context(m_out_vid_strm->codec, m_informat->streams[m_in_vid_strm_idx]->codec) != 0)
                    {
                       PRINT_MSG("Failed to Copy Context ")
                       ret = -1;
                       return ret;
                    }
                  }
               }
         }

       if(outfmt->audio_codec != AV_CODEC_ID_NONE &amp;&amp; m_in_aud_strm != NULL)
       {
           out_aud_codec = avcodec_find_encoder(outfmt->audio_codec);
           if(NULL == out_aud_codec)
           {
               PRINT_MSG("Could Not Find Out Aud Encoder ")
               ret = -1;
               return ret;
           }
           else
           {
               PRINT_MSG("Found Out Aud Encoder ")
               m_out_aud_strm = avformat_new_stream(m_outformat, out_aud_codec);
               if(NULL == m_out_aud_strm)
               {
                   PRINT_MSG("Failed to Allocate Out Vid Strm ")
                   ret = -1;
                   return ret;
               }
               else
               {
                   if(avcodec_copy_context(m_out_aud_strm->codec, m_informat->streams[m_in_aud_strm_idx]->codec) != 0)
                   {
                       PRINT_MSG("Failed to Copy Context ")
                       ret = -1;
                       return ret;
                   }
               }
            }
         }

         if (!(outfmt->flags &amp; AVFMT_NOFILE))
         {
           if (avio_open2(&amp;m_outformat->pb, outfile.c_str(), AVIO_FLAG_WRITE,NULL, NULL) &lt; 0)
           {
                   PRINT_VAL("Could Not Open File ", outfile)
                   ret = -1;
                   return ret;
           }
         }
           /* Write the stream header, if any. */
         if (avformat_write_header(m_outformat, NULL) &lt; 0)
         {
               PRINT_VAL("Error Occurred While Writing Header ", outfile)
               ret = -1;
               return ret;
         }
         else
         {
               PRINT_MSG("Written Output header ")
               m_init_done = true;
         }

       return ret;
    }

    Here is the Clean-up part

    void VideoClipper::ReleaseResource(void)
    {
       if(m_in_aud_strm &amp;&amp; m_in_aud_strm->codec)
       {
           avcodec_close(m_in_aud_strm->codec);
           PRINT_MSG("Closed Input Audio Codec ")
       }

       if(m_in_vid_strm &amp;&amp; m_in_vid_strm->codec)
       {
           avcodec_close(m_in_vid_strm->codec);
           PRINT_MSG("Closed Input Video Codec ")
       }

       if(m_informat)
       {
          avformat_close_input(&amp;m_informat);
           PRINT_MSG("Freed Input Format Contex ")
       }

       if(m_out_aud_strm &amp;&amp; m_out_aud_strm->codec)
       {
           avcodec_close(m_out_aud_strm->codec);
           PRINT_MSG("Closed Output Audio Codec ")
       }

       if(m_out_vid_strm &amp;&amp; m_out_vid_strm->codec)
       {
           avcodec_close(m_out_vid_strm->codec);
           PRINT_MSG("Closed Output Audio Codec ")
       }

       if(m_outformat)
       {
           avformat_close_input(&amp;m_outformat);
           m_outformat = NULL;
           PRINT_MSG("Closed Output Format ")
       }

    }

    Memory Leaks message

    Detected memory leaks!
    Dumping objects ->
    {13691} normal block at 0x01046A60, 4479 bytes long.
    Data: &lt;                > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
    {13685} normal block at 0x01043FD0, 10831 bytes long.
    Data: &lt;         ?      > CD CD CD CD CD CD CD CD D0 3F 04 01 ED ED ED ED
    Object dump complete.

    I'm using latest version of ffmpeg on Visual Studio 2012.
    Please suggest where I'm missing.

    Thanks
    Pradeep

  • Lossless avi encoding on linux

    31 août 2012, par JohnSavage

    I am trying to write video using opencv. It is important for me to do this precisely - so it has to be a lossless codec. I am working with OpenCV 2.4.1 on Ubuntu 12.04

    Previously, I was using the fourcc code 0. This gave me the exact result I wanted, and I was able to recover the images perfectly.

    I am not sure what happened, but as of a recent update (around Jul 20th 2012), something went wrong and I am no longer able to write files with this fourcc code. I really don't remember what it was, but it could have come from doing an update, removing some software from my software center, and some other things I did during general cleaning...

    When I check an older file with mediainfo (http://www.fourcc.org/identifier/) I see the following result :

    Complete name                            : oldsample.avi
    Format                                   : AVI
    Format/Info                              : Audio Video Interleave
    Format profile                           : OpenDML
    File size                                : 1.07 GiB
    Duration                                 : 41s 467ms
    Overall bit rate                         : 221 Mbps
    Writing application                      : Lavf53.5.0
    Video
    ID                                       : 0
    Format                                   : RGB
    Codec ID                                 : 0x00000000
    Codec ID/Info                            : Basic Windows bitmap format. 1, 4 and 8 bpp     versions are palettised. 16, 24 and 32bpp contain raw RGB samples
    Duration                                 : 41s 467ms
    Bit rate                                 : 221 Mbps
    Width                                    : 640 pixels
    Height                                   : 4294966 816 pixels
    Display aspect ratio                     : 0.000
    Frame rate                               : 30.000 fps
    Bit depth                                : 8 bits
    Stream size                              : 1.07 GiB (100%)

    Now, I see that when I write using the 0 fourcc codec, the program actually defaults to the i420 codec. Here is the output from one of the files I try to write now :

    Complete name                            : newsample.avi
    Format                                   : AVI
    Format/Info                              : Audio Video Interleave
    File size                                : 73.0 MiB
    Duration                                 : 5s 533ms
    Overall bit rate                         : 111 Mbps
    Writing application                      : Lavf54.6.100
    Video
    ID                                       : 0
    Format                                   : YUV
    Codec ID                                 : I420
    Codec ID/Info                            : 8 bit Y plane followed by 8 bit 2x2 subsampled U and V planes.
    Duration                                 : 5s 533ms
    Bit rate                                 : 111 Mbps
    Width                                    : 640 pixels
    Height                                   : 480 pixels
    Display aspect ratio                     : 4:3
    Frame rate                               : 30.000 fps
    Compression mode                         : Lossless
    Bits/(Pixel*Frame)                       : 12.000
    Stream size                              : 72.9 MiB (100%)

    This format, and other formats I try to use (like huffyuv HFYU), do not work for me because I end up with effects like this http://imgur.com/a/0OC4y - you see the bright artifacts coming in due to what I assume is either lossy compression or chroma subsampling in the case of HFYU which is supposed to be lossless. What you are looking at is the red channel from one of my videos. The perceptual effect is negligible when you look at all 3 channels simultaneously but it is essential that I reconstruct the images exactly.

    Furthermore, while I am able to play my old files in media players like vlc, I suddenly find them to be completely incompatible with opencv. When I try to open the older files with a videocapture, the open step works fine, but trying to do a read operation results in a segfault. Furthermore, When I try to write with either :

    CV_FOURCC(0,0,0,0)
    0

    Opencv defaults to I420 for some reason.

    Next, I tried using some alternate codecs. 'DIB ' seems like something that should work for me, and on the opencv website (http://opencv.willowgarage.com/wiki/VideoCodecs) it is listed as a 'recommended' codec. However, trying to use this results in the following message :

    OpenCV-2.4.1/modules/highgui/src/cap_gstreamer.cpp:483: error: (-210) Gstreamer Opencv backend doesn&#39;t support this codec acutally. in function CvVideoWriter_GStreamer::open

    Aborted (core dumped)

    I checked the opencv source for this codec, and stumbled across the following :

    cd OpenCV-2.4.1/modules
    grep -i -r "CV_FOURCC" ./*
    ...
    ./highgui/src/cap_qt.cpp:    /*if( fourcc == CV_FOURCC( &#39;D&#39;, &#39;I&#39;, &#39;B&#39;, &#39; &#39; ))
    ./highgui/include/opencv2/highgui/highgui_c.h:#define CV_FOURCC_DEFAULT CV_FOURCC(&#39;I&#39;, &#39;Y&#39;, &#39;U&#39;, &#39;V&#39;) /* Use default codec for specified filename (Linux only) */

    I tried installing qt4 and reconfiguring with the WITH_QT flag, but that did not change anything. I also tried uncommenting that part of the code and reinstalling opencv, but that also did not work.

    My ultimate goal is for any way to efficiently store and retrieve a video stream with 16 bits for every pixel (like 32float would work fine, and then it wouldn't need to be perfect). Right now I am unpacking the 16 bits into the red and green channels, which is why I need it to be perfect - since an error of 1 in the red channel is multiplied by 256 in the final result. I am not having success with any of the fourcc codes available to me.

  • Lossless avi encoding on linux

    21 septembre 2022, par dlants

    I am trying to write video using opencv. It is important for me to do this precisely - so it has to be a lossless codec. I am working with OpenCV 2.4.1 on Ubuntu 12.04

    &#xA;&#xA;

    Previously, I was using the fourcc code 0. This gave me the exact result I wanted, and I was able to recover the images perfectly.

    &#xA;&#xA;

    I am not sure what happened, but as of a recent update (around Jul 20th 2012), something went wrong and I am no longer able to write files with this fourcc code. I really don't remember what it was, but it could have come from doing an update, removing some software from my software center, and some other things I did during general cleaning...

    &#xA;&#xA;

    When I check an older file with mediainfo (http://www.fourcc.org/identifier/) I see the following result :

    &#xA;&#xA;

    Complete name                            : oldsample.avi&#xA;Format                                   : AVI&#xA;Format/Info                              : Audio Video Interleave&#xA;Format profile                           : OpenDML&#xA;File size                                : 1.07 GiB&#xA;Duration                                 : 41s 467ms&#xA;Overall bit rate                         : 221 Mbps&#xA;Writing application                      : Lavf53.5.0&#xA;Video&#xA;ID                                       : 0&#xA;Format                                   : RGB&#xA;Codec ID                                 : 0x00000000&#xA;Codec ID/Info                            : Basic Windows bitmap format. 1, 4 and 8 bpp     versions are palettised. 16, 24 and 32bpp contain raw RGB samples&#xA;Duration                                 : 41s 467ms&#xA;Bit rate                                 : 221 Mbps&#xA;Width                                    : 640 pixels&#xA;Height                                   : 4294966 816 pixels&#xA;Display aspect ratio                     : 0.000&#xA;Frame rate                               : 30.000 fps&#xA;Bit depth                                : 8 bits&#xA;Stream size                              : 1.07 GiB (100%)&#xA;

    &#xA;&#xA;

    Now, I see that when I write using the 0 fourcc codec, the program actually defaults to the i420 codec. Here is the output from one of the files I try to write now :

    &#xA;&#xA;

    Complete name                            : newsample.avi&#xA;Format                                   : AVI&#xA;Format/Info                              : Audio Video Interleave&#xA;File size                                : 73.0 MiB&#xA;Duration                                 : 5s 533ms&#xA;Overall bit rate                         : 111 Mbps&#xA;Writing application                      : Lavf54.6.100&#xA;Video&#xA;ID                                       : 0&#xA;Format                                   : YUV&#xA;Codec ID                                 : I420&#xA;Codec ID/Info                            : 8 bit Y plane followed by 8 bit 2x2 subsampled U and V planes.&#xA;Duration                                 : 5s 533ms&#xA;Bit rate                                 : 111 Mbps&#xA;Width                                    : 640 pixels&#xA;Height                                   : 480 pixels&#xA;Display aspect ratio                     : 4:3&#xA;Frame rate                               : 30.000 fps&#xA;Compression mode                         : Lossless&#xA;Bits/(Pixel*Frame)                       : 12.000&#xA;Stream size                              : 72.9 MiB (100%)&#xA;

    &#xA;&#xA;

    This format, and other formats I try to use (like huffyuv HFYU), do not work for me because I end up with effects like this http://imgur.com/a/0OC4y - you see the bright artifacts coming in due to what I assume is either lossy compression or chroma subsampling in the case of HFYU which is supposed to be lossless. What you are looking at is the red channel from one of my videos. The perceptual effect is negligible when you look at all 3 channels simultaneously but it is essential that I reconstruct the images exactly.

    &#xA;&#xA;

    Furthermore, while I am able to play my old files in media players like vlc, I suddenly find them to be completely incompatible with opencv. When I try to open the older files with a videocapture, the open step works fine, but trying to do a read operation results in a segfault. Furthermore, When I try to write with either :

    &#xA;&#xA;

    CV_FOURCC(0,0,0,0)&#xA;0&#xA;

    &#xA;&#xA;

    Opencv defaults to I420 for some reason.

    &#xA;&#xA;

    Next, I tried using some alternate codecs. 'DIB ' seems like something that should work for me, and on the opencv website (http://opencv.willowgarage.com/wiki/VideoCodecs) it is listed as a 'recommended' codec. However, trying to use this results in the following message :

    &#xA;&#xA;

    OpenCV-2.4.1/modules/highgui/src/cap_gstreamer.cpp:483: error: (-210) Gstreamer Opencv backend doesn&#x27;t support this codec acutally. in function CvVideoWriter_GStreamer::open&#xA;&#xA;Aborted (core dumped)&#xA;

    &#xA;&#xA;

    I checked the opencv source for this codec, and stumbled across the following :

    &#xA;&#xA;

    cd OpenCV-2.4.1/modules&#xA;grep -i -r "CV_FOURCC" ./*&#xA;...&#xA;./highgui/src/cap_qt.cpp:    /*if( fourcc == CV_FOURCC( &#x27;D&#x27;, &#x27;I&#x27;, &#x27;B&#x27;, &#x27; &#x27; ))&#xA;./highgui/include/opencv2/highgui/highgui_c.h:#define CV_FOURCC_DEFAULT CV_FOURCC(&#x27;I&#x27;, &#x27;Y&#x27;, &#x27;U&#x27;, &#x27;V&#x27;) /* Use default codec for specified filename (Linux only) */&#xA;

    &#xA;&#xA;

    I tried installing qt4 and reconfiguring with the WITH_QT flag, but that did not change anything. I also tried uncommenting that part of the code and reinstalling opencv, but that also did not work.

    &#xA;&#xA;

    My ultimate goal is for any way to efficiently store and retrieve a video stream with 16 bits for every pixel (like 32float would work fine, and then it wouldn't need to be perfect). Right now I am unpacking the 16 bits into the red and green channels, which is why I need it to be perfect - since an error of 1 in the red channel is multiplied by 256 in the final result. I am not having success with any of the fourcc codes available to me.

    &#xA;