Recherche avancée

Médias (91)

Autres articles (80)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

Sur d’autres sites (14054)

  • lavfi/delogo : use weighted interpolation

    26 juin 2013, par Jean Delvare
    lavfi/delogo : use weighted interpolation
    

    The original delogo algorithm interpolates both horizontally and
    vertically and uses the average to compute the resulting sample. This
    works reasonably well when the logo area is almost square. However
    when the logo area is significantly larger than high or higher than
    large, the result is largely suboptimal.

    The issue can be clearly seen by testing the delogo filter with a fake
    logo area that is 200 pixels large and 2 pixels high. Vertical
    interpolation gives a very good result in that case, horizontal
    interpolation gives a very bad result, and the overall result is poor,
    because both are given the same weight.

    Even when the logo is roughly square, the current algorithm gives poor
    results on the borders of the logo area, because it always gives
    horizontal and vertical interpolations an equal weight, and this is
    suboptimal on borders. For example, in the middle of the left hand
    side border of the logo, you want to trust the left known point much
    more than the right known point (which the current algorithm already
    does) but also much more than the top and bottom known points (which
    the current algorithm doesn’t do.)

    By properly weighting each known point when computing the value of
    each interpolated pixel, the visual result is much better, especially
    on borders and/or for high or large logo areas.

    The algorithm I implemented guarantees that the weight of each of the
    4 known points directly depends on its distance to the interpolated
    point. It is largely inspired from the original algorithm, the key
    difference being that it computes the relative weights globally
    instead of separating the vertical and horizontal interpolations and
    combining them afterward.

    Signed-off-by : Jean Delvare <khali@linux-fr.org>
    Signed-off-by : Stefano Sabatini <stefasab@gmail.com>

    • [DH] libavfilter/vf_delogo.c
    • [DH] tests/ref/fate/filter-delogo
  • Not able to decode audio from video using ffmpeg API

    26 août 2014, par Ashish

    I’m developing some Video converter application for MAC OS using FFMPEG API(Not Command Line).

    the objective of the app is "converting Videos".

    and...

    I’m just completed converted video file but.. I can’t attach audio into the video.

    I am using this :

    const char* inFileName = "C:\\Ek.avi";
      const char* outFileName = "c:\\avi234567.mp4";
      const char* outFileType = "mp4";

      av_register_all();

      AVFormatContext* inContainer = NULL;
      if(avformat_open_input(&amp;inContainer, inFileName, NULL, NULL) &lt; 0)
             exit(1);

      if(avformat_find_stream_info(inContainer, NULL) &lt; 0)
             exit(1);

      // Find video stream
      int videoStreamIndex = -1;
      int AudioStreamIndex = -1;
      for (unsigned int i = 0; i &lt; inContainer->nb_streams; ++i)
      {
             if (inContainer->streams[i] &amp;&amp; inContainer->streams[i]->codec &amp;&amp;
                    inContainer->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
             {
                    videoStreamIndex = i;
                    break;
             }
      }
      for (unsigned int i = 0; i &lt; inContainer->nb_streams; ++i)
      {
             if (inContainer->streams[i] &amp;&amp; inContainer->streams[i]->codec &amp;&amp;
                    inContainer->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
             {
                    AudioStreamIndex = i;
                    break;
             }
      }
      if (videoStreamIndex == -1)
          exit(1);

      AVFormatContext* outContainer = NULL;
      if(avformat_alloc_output_context2(&amp;outContainer, NULL, outFileType, outFileName) &lt; 0)
             exit(1);

      // ----------------------------
      // Decoder
      // ----------------------------
      AVStream const *const inStream = inContainer->streams[videoStreamIndex];
      AVStream const *const inStreamAudio = inContainer->streams[AudioStreamIndex];
      AVCodec *const decoder = avcodec_find_decoder(inStream->codec->codec_id);
      AVCodec *const Audiodecoder = avcodec_find_decoder(inStreamAudio->codec->codec_id);
      if(!decoder)
             exit(1);
      if(!Audiodecoder)
             exit(1);
      if(avcodec_open2(inStream->codec, decoder, NULL) &lt; 0)
             exit(1);
      if(avcodec_open2(inStreamAudio->codec, Audiodecoder, NULL) &lt; 0)
             exit(1);

      // ----------------------------
      // Encoder
      // ----------------------------
      AVCodec *encoder = avcodec_find_encoder(AV_CODEC_ID_MPEG4);
      AVCodec *Audioencoder = avcodec_find_encoder(AV_CODEC_ID_MP3);
      if(!encoder)
             exit(1);
      AVStream *outStream = avformat_new_stream(outContainer, encoder);
      AVStream *AudiooutStream = avformat_new_stream(outContainer, Audioencoder);
      if(!outStream)
             exit(1);

      avcodec_get_context_defaults3(outStream->codec, encoder);
      avcodec_get_context_defaults3(AudiooutStream->codec, Audioencoder);

      // Construct encoder
      if(outContainer->oformat->flags &amp; AVFMT_GLOBALHEADER)
             outStream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;

       if(outContainer->oformat->flags &amp; AVFMT_GLOBALHEADER)
             AudiooutStream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;

      outStream->codec->coder_type = AVMEDIA_TYPE_VIDEO;
      outStream->codec->pix_fmt = AV_PIX_FMT_YUV420P;
      outStream->codec->width = inStream->codec->width;
      outStream->codec->height = inStream->codec->height;
      outStream->codec->codec_id = encoder->id;
      outStream->codec->bit_rate = inStream->codec->bit_rate;
      outStream->codec->time_base.den = inStream->time_base.den/inStream->time_base.num;
      outStream->codec->time_base.num = inStream->codec->time_base.num;
      outStream->codec->gop_size = inStream->codec->gop_size;; // Keyframe interval(=GOP length). Determines maximum distance distance between I-frames
      outStream->codec->keyint_min = inStream->codec->keyint_min; // minimum GOP size
      outStream->codec->max_b_frames = inStream->codec->max_b_frames; // maximum number of B-frames between non-B-frames
      outStream->codec->b_frame_strategy =inStream->codec->b_frame_strategy; // decides the best number of B-frames to use. Default mode in x264.
      outStream->codec->scenechange_threshold = inStream->codec->scenechange_threshold;
      outStream->codec->refs = inStream->codec->refs; // abillity to reference frames other than the one immediately prior to the current frame. specify how many references can be used.
      outStream->codec->qmin = inStream->codec->qmin;
      outStream->codec->qmax = inStream->codec->qmax;
      outStream->codec->i_quant_factor = inStream->codec->i_quant_factor;





      //for audio

      AudiooutStream->codec->codec_type = inStreamAudio->codec->codec_type;
      AudiooutStream->codec->codec_id = inStreamAudio->codec->codec_id;
      AudiooutStream->codec->bit_rate = inStreamAudio->codec->bit_rate;
      AudiooutStream->codec->sample_rate=inStreamAudio->codec->sample_rate;
      AudiooutStream->codec->channels =inStreamAudio->codec->channels;
      AudiooutStream->codec->time_base.den =(int64_t)inStreamAudio->time_base.num * inStreamAudio->codec->sample_rate;//inStreamAudio->codec->time_base.den;
      AudiooutStream->codec->time_base.num =inStreamAudio->codec->time_base.num;
      AudiooutStream->codec->gop_size = inStreamAudio->codec->gop_size;
      AudiooutStream->codec->frame_size = inStreamAudio->codec->frame_size;
      AudiooutStream->codec->coder_type =inStreamAudio->codec->coder_type;
      AudiooutStream->codec->sample_fmt= AV_SAMPLE_FMT_S16;      






      if(outStream->codec->codec_id == AV_CODEC_ID_H264)
       av_opt_set(outStream->codec->priv_data, "preset", "slow", 0);

      // Open encoder
      if(avcodec_open2(outStream->codec, encoder, NULL) &lt; 0)
             exit(1);


      // Open output container
      if(avio_open(&amp;outContainer->pb, outFileName, AVIO_FLAG_WRITE) &lt; 0)
             exit(1);



      av_dump_format(inContainer, 0, inFileName,0);

      //Write header to ouput container
      int ret=avformat_write_header(outContainer, NULL);

      AVPacket decodePacket, encodedPacket;
      int got_frame, len;
      while(av_read_frame(inContainer, &amp;decodePacket)>=0)
      {
             if (decodePacket.stream_index == videoStreamIndex)
             {
                   AVFrame *decodedFrame = avcodec_alloc_frame();
                   if(!decodedFrame)
                           exit(1);
                   AVFrame *encodeFrame = avcodec_alloc_frame();
                   if(!encodeFrame)
                           exit(1);
                   encodeFrame->format = outStream->codec->pix_fmt;
                   encodeFrame->width = outStream->codec->width;
                   encodeFrame->height = outStream->codec->height;
                   if(av_image_alloc(encodeFrame->data, encodeFrame->linesize,outStream->codec->width, outStream->codec->height,outStream->codec->pix_fmt, 1) &lt; 0)
                           exit(1);
                    len = avcodec_decode_video2(inStream->codec, decodedFrame, &amp;got_frame, &amp;decodePacket);
                    if(len &lt; 0)
                          exit(1);
                    if(got_frame)
                    {
                          av_init_packet(&amp;encodedPacket);
                          encodedPacket.data = NULL;
                          encodedPacket.size = 0;
                          if(avcodec_encode_video2(outStream->codec, &amp;encodedPacket, decodedFrame, &amp;got_frame) &lt; 0)
                                 exit(1);
                          if(got_frame)
                          {
                                 if (outStream->codec->coded_frame->key_frame)
                                        encodedPacket.flags |= AV_PKT_FLAG_KEY;

                                 encodedPacket.stream_index = outStream->index;
                                 if (encodedPacket.pts != AV_NOPTS_VALUE)
                                   encodedPacket.pts =  av_rescale_q(encodedPacket.pts, outStream->codec->time_base, outStream->time_base);
                                 if (encodedPacket.dts != AV_NOPTS_VALUE)
                                   encodedPacket.dts = av_rescale_q(encodedPacket.dts, outStream->codec->time_base, outStream->time_base);

                                 if(av_write_frame(outContainer, &amp;encodedPacket) &lt; 0)
                                        exit(1);

                                 av_free_packet(&amp;encodedPacket);
                          }
                    }
                    avcodec_free_frame(&amp;encodeFrame);
                    avcodec_free_frame(&amp;decodedFrame);
             }
             else if(decodePacket.stream_index == AudioStreamIndex)
             {              
                     AVDictionary *opts = NULL;
                     av_dict_set(&amp;opts, "strict", "experimental", 0);
                     if(avcodec_open2(AudiooutStream->codec, Audioencoder,&amp;opts) &lt; 0)
                     exit(1);
                     av_dict_free(&amp;opts);
                     AVFrame *decodedFrame = avcodec_alloc_frame();
                       if(!decodedFrame)
                               exit(1);
                       AVFrame *encodeFrame = avcodec_alloc_frame();
                       if(!encodeFrame)
                               exit(1);
                       //encodeFrame->format = AudiooutStream->codec->pix_fmt;
                       //encodeFrame->width = AudiooutStream->codec->coded_width;
                       //->height = AudiooutStream->codec->coded_height;
                       /*if(av_image_alloc(encodeFrame->data, encodeFrame->linesize,AudiooutStream->codec->width, AudiooutStream->codec->height,AudiooutStream->codec->pix_fmt, 1) &lt; 0)
                               exit(1);*/
                    len = avcodec_decode_audio4(inStreamAudio->codec, decodedFrame, &amp;got_frame, &amp;decodePacket);
                    if(len &lt; 0)
                          exit(1);
                    if(got_frame)
                    {
                          av_init_packet(&amp;encodedPacket);
                          encodedPacket.data = NULL;
                          encodedPacket.size = 0;
                          if(avcodec_encode_audio2(AudiooutStream->codec, &amp;encodedPacket, decodedFrame, &amp;got_frame) &lt; 0)
                                 exit(1);
                          if(got_frame)
                          {
                                 if (outStream->codec->coded_frame->key_frame)
                                        encodedPacket.flags |= AV_PKT_FLAG_KEY;

                                 encodedPacket.stream_index = AudiooutStream->index;

                                 if(av_write_frame(outContainer, &amp;encodedPacket) &lt; 0)
                                        exit(1);

                                 av_free_packet(&amp;encodedPacket);
                          }
                    }
               int audio=0;//for audio
               avcodec_free_frame(&amp;encodeFrame);
               avcodec_free_frame(&amp;decodedFrame);
             }
             else
             {
               int audio=0;//for audio
             }

             av_free_packet(&amp;decodePacket);
      }
      av_write_trailer(outContainer);
      avio_close(outContainer->pb);



      avformat_free_context(outContainer);
      av_close_input_file(inContainer);
    }

    Problem is here :

    Video of finally created video file was normally played. but the Audio wasn’t. When I tried the same code on windows, then it works fine and converts video file with proper audio and video. Guys its really freaking me out. Please help me how to add audio in that video with proper synchronizing.

    I’ve googled with many keywords but they only say about "FFmpeg command line usage".

    I wanna make with FFMpeg API. not a Command line tool.

    Please help.

  • Anomalie #4737 : Erreur recherche dans les forums dans le privé

    9 juillet 2021, par JLuc -

    Avec ou sans "plat", le SQL généré est :

    1. <span class="CodeRay"><span class="class">SELECT</span> forum.id_forum, resultats.points <span class="keyword">AS</span> points, forum.statut
    2. <span class="keyword">FROM</span> spip_forum <span class="keyword">AS</span> <span class="string"><span class="delimiter">`</span><span class="content">forum</span><span class="delimiter">`</span></span>  
    3. <span class="keyword">INNER</span> <span class="keyword">JOIN</span> spip_resultats <span class="keyword">AS</span> resultats <span class="keyword">ON</span> ( resultats.id = forum.id_forum )
    4. <span class="keyword">WHERE</span> <span class="keyword">NOT</span>((forum.statut <span class="keyword">LIKE</span> <span class="string"><span class="delimiter">'</span><span class="content">priv%</span><span class="delimiter">'</span></span>))
    5.     <span class="keyword">AND</span> (resultats.recherche=<span class="string"><span class="delimiter">'</span><span class="content">c7b4cacf770e2915</span><span class="delimiter">'</span></span> <span class="keyword">AND</span> resultats.table_objet=<span class="string"><span class="delimiter">'</span><span class="content">forum</span><span class="delimiter">'</span></span> <span class="keyword">AND</span> resultats.serveur=<span class="string"><span class="delimiter">'</span><span class="delimiter">'</span></span>)
    6. <span class="keyword">GROUP</span> <span class="keyword">BY</span> forum.id_forum
    7. <span class="keyword">ORDER</span> <span class="keyword">BY</span> forum.id_forum <span class="directive">DESC</span>
    8. </span>

    Télécharger

    Le pb vient du fait que c’est le forum id_thread qui est enregistré dans la table spip_resultats.