Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (27)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • 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" ;

  • D’autres logiciels intéressants

    12 avril 2011, par

    On ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
    La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
    On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
    Videopress
    Site Internet : (...)

Sur d’autres sites (5732)

  • warning : Error opening file (../../modules/videoio/src/cap_ffmpeg_impl.hpp:554)

    7 mars 2016, par Bessy George

    this is my code for applying kmeans algorithm in video.It is written in ceemple( opencv)as a cpp file.it is used to read data from video and apply kmeans for each frame. could you please help me.
    thanks in advance

    #include "opencv2/opencv.hpp"
    #include "opencv2/highgui.hpp"
    #include "opencv2/core.hpp"
    #include "opencv2/imgproc.hpp"
    #include <iostream>
    #include <opencv></opencv>ml.h>

    using namespace cv;

    int main(int, char**)
    {

     Scalar colorTab[] =
         {
             Scalar(0, 0, 255),
             Scalar(0,255,0),
             Scalar(255,100,100),
             Scalar(255,0,255),
             Scalar(0,255,255)
         };
       //VideoCapture cap(0); // open the default camera
     String filename = "ab.avi";
     VideoCapture cap(filename);
     RNG rng(12345);
       if(!cap.isOpened())  // check if we succeeded
           return -1;
       const int MAX_CLUSTERS = 5;
       Mat edges;
       namedWindow("edges",1);
       for(;;)
       {
           Mat frame;
           cap >> frame; // get a new frame from camera
          /* cvtColor(frame, edges, CV_BGR2GRAY);
           GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
           Canny(edges, edges, 0, 30, 3);
           cv::Mat centers;cv::Mat labels;
           kmeans(frame, 8, labels,TermCriteria( TermCriteria::EPS+TermCriteria::COUNT, 10, 1.0),3, cv::KMEANS_PP_CENTERS, centers);
           frame = Scalar::all(0);
           imshow("edges", frame);
           if(waitKey(30) >= 0) break;*/

           int k, clusterCount = rng.uniform(2, MAX_CLUSTERS+1);
           int i, sampleCount = rng.uniform(1, 1001);
           Mat points(sampleCount, 1, CV_32FC2), labels;

           clusterCount = MIN(clusterCount, sampleCount);
           Mat centers;

           /* generate random sample from multigaussian distribution */
           for( k = 0; k &lt; clusterCount; k++ )
           {
               Point center;
               center.x = rng.uniform(0, frame.cols);
               center.y = rng.uniform(0, frame.rows);
               Mat pointChunk = points.rowRange(k*sampleCount/clusterCount,
                                                k == clusterCount - 1 ? sampleCount :
                                                (k+1)*sampleCount/clusterCount);
               rng.fill(pointChunk, RNG::NORMAL, Scalar(center.x, center.y), Scalar(frame.cols*0.05, frame.rows*0.05));
           }

           randShuffle(points, 1, &amp;rng);

           kmeans(points, clusterCount, labels,
               TermCriteria( TermCriteria::EPS+TermCriteria::COUNT, 10, 1.0),
                  3, KMEANS_PP_CENTERS, centers);

           frame = Scalar::all(0);

           for( i = 0; i &lt; sampleCount; i++ )
           {
               int clusterIdx = labels.at<int>(i);
               Point ipt = points.at<point2f>(i);
               circle( frame, ipt, 2, colorTab[clusterIdx], FILLED, LINE_AA );
           }

           imshow("clusters", frame);

           char key = (char)waitKey();
           if( key == 27 || key == 'q' || key == 'Q' ) // 'ESC'
               break;
       }

       return 0;
       }
    </point2f></int></iostream>
  • FFmpeg API - transcoding and sending pulseaudio input (rtsp)

    16 octobre 2020, par user3469024

    My goal is to read pulseaudio microphone audio input and send it via rtsp encoded as opus. To play stream I am using ffplay.

    &#xA;

    What step am I missing ? Currently I am hearing only noise when receiving stream. What is interesting, av_dump_format shows correct output :

    &#xA;

    Input #0, pulse, from &#x27;default&#x27;:&#xA;  Duration: N/A, start: 1602879120.276839, bitrate: 1536 kb/s&#xA;    Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s&#xA;Output #0, rtsp, to &#x27;rtsp://localhost:8191/call&#x27;:&#xA;    Stream #0:0: Audio: opus, 8000 Hz, mono, s16, 16 kb/s&#xA;&#xA;

    &#xA;

    but ffplay shows different stream parameters :

    &#xA;

    Input #0, rtsp, from &#x27;rtsp://localhost:8191/call&#x27;:sq=    0B f=0/0   &#xA;  Metadata:&#xA;    title           : No Name&#xA;  Duration: N/A, start: 51444.871521, bitrate: N/A&#xA;    Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp&#xA;&#xA;

    &#xA;

    #include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include &#xA;&#xA;int main(int argc, char *argv[])&#xA;{&#xA;  int ret,got_frame,got_packet;&#xA;  const char *audio_input;&#xA;  const char *output;&#xA;  AVOutputFormat *out_format = NULL;&#xA;  AVInputFormat *in_format = NULL;&#xA;  AVFormatContext *in_format_ctx = NULL;&#xA;  AVFormatContext *out_format_ctx = NULL;&#xA;  AVCodec *in_codec = NULL;&#xA;  AVCodecContext *in_codec_ctx = NULL;&#xA;  AVCodec *out_codec = NULL;&#xA;  AVCodecContext *out_codec_ctx = NULL;&#xA;  AVPacket packet = { .data = NULL, .size = 0 };&#xA;  AVFrame *frame = NULL;&#xA;  AVDictionary *opt = NULL;&#xA;  AVStream *ost;&#xA;&#xA;  av_register_all();&#xA;  avdevice_register_all();&#xA;&#xA;  audio_input = argv[1];&#xA;  output = argv[2];&#xA;&#xA;  //INPUT&#xA;  //Open input in selected format&#xA;  in_format = av_find_input_format("pulse");&#xA;  if((ret = avformat_open_input(&amp;in_format_ctx, audio_input, in_format, NULL))!=0)&#xA;  {&#xA;    fprintf(stderr,"Could not open audio input: %s. %s\n",audio_input,av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;  //Find stream info in header and display&#xA;  if((ret = avformat_find_stream_info(in_format_ctx, NULL))&lt;0)&#xA;  {&#xA;    fprintf(stderr,"Could not find stream information. %s\n",av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;  av_dump_format(in_format_ctx, 0, audio_input, 0);&#xA;&#xA;  in_codec = avcodec_find_decoder(in_format_ctx->streams[0]->codec->codec_id);&#xA;  if(in_codec==NULL) {&#xA;    fprintf(stderr, "Unsupported decoder.\n");&#xA;    exit(1);&#xA;  }&#xA;&#xA;  //Allocate memory for microphone input codec context (all information)&#xA;  in_codec_ctx = avcodec_alloc_context3(in_codec);&#xA;  if((ret = avcodec_copy_context(in_codec_ctx, in_format_ctx->streams[0]->codec)) != 0) {&#xA;    fprintf(stderr, "Couldn&#x27;t copy codec context. %s\n",av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;  //Use selected codec and codec context&#xA;  if((ret = avcodec_open2(in_codec_ctx, in_codec, NULL))&lt;0)&#xA;  {&#xA;    fprintf(stderr, "Could not open audio codec. %s\n",av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;&#xA;  //OUTPUT&#xA;  ret = avformat_alloc_output_context2(&amp;out_format_ctx, NULL, "rtsp", output);&#xA;  if (!out_format_ctx) {&#xA;    fprintf(stderr, "Output format ptoblem. %s\n",av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;  out_format = out_format_ctx->oformat;&#xA;  /* open the output file, if needed */&#xA;&#xA;  out_codec = avcodec_find_encoder(AV_CODEC_ID_OPUS);&#xA;  if(out_codec==NULL) {&#xA;    fprintf(stderr, "Unsupported encoder.\n");&#xA;    exit(1);&#xA;  }&#xA;&#xA;  out_codec_ctx = avcodec_alloc_context3(out_codec);&#xA;  if (!out_codec_ctx) {&#xA;    fprintf(stderr, "Could not alloc an encoding context\n");&#xA;    exit(1);&#xA;  }&#xA;&#xA;  /* check that the encoder supports s16 pcm input */&#xA;  out_codec_ctx->sample_fmt = AV_SAMPLE_FMT_S16;&#xA;  out_codec_ctx->bit_rate    = 16000;&#xA;  out_codec_ctx->sample_rate = 8000;&#xA;  out_codec_ctx->channels    = 1;&#xA;  out_codec_ctx->channel_layout = AV_CH_LAYOUT_MONO;&#xA;  out_codec_ctx->channels        = av_get_channel_layout_nb_channels(out_codec_ctx->channel_layout);&#xA;&#xA;  if (out_format_ctx->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;      out_codec_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;&#xA;  ret = avcodec_open2(out_codec_ctx, out_codec, NULL);&#xA;  if (ret &lt; 0) {&#xA;    fprintf(stderr, "Could not open audio codec: %s\n", av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;  ost = avformat_new_stream(out_format_ctx, NULL);&#xA;  if (!ost) {&#xA;    fprintf(stderr, "Could not allocate stream\n");&#xA;    exit(1);&#xA;  }&#xA;  ost->id=0;&#xA;&#xA;  ret = avcodec_parameters_from_context(ost->codecpar, out_codec_ctx);&#xA;  if (ret &lt; 0) {&#xA;      av_log(NULL, AV_LOG_ERROR, "Failed to copy encoder parameters to output stream. %s\n",av_err2str(ret));&#xA;      return ret;&#xA;  }&#xA;&#xA;  ost->time_base = out_codec_ctx->time_base;&#xA;&#xA;  av_dump_format(out_format_ctx, 0, output, 1);&#xA;&#xA;  /* copy the stream parameters to the muxer */&#xA;  ret = avcodec_parameters_from_context(ost->codecpar, out_codec_ctx);&#xA;  if (ret &lt; 0) {&#xA;    fprintf(stderr, "Could not copy the stream parameters. %s\n",av_err2str(ret));&#xA;    exit(1);&#xA;  }&#xA;&#xA;  if (!(out_format_ctx->oformat->flags &amp; AVFMT_NOFILE)) {&#xA;      ret = avio_open(&amp;out_format_ctx->pb, output, AVIO_FLAG_WRITE);&#xA;      if (ret &lt; 0) {&#xA;          av_log(NULL, AV_LOG_ERROR, "Could not open output file &#x27;%s&#x27;", output);&#xA;          return ret;&#xA;      }&#xA;  }&#xA;&#xA;  /* init muxer, write output file header */&#xA;  ret = avformat_write_header(out_format_ctx, NULL);&#xA;  if (ret &lt; 0) {&#xA;      av_log(NULL, AV_LOG_ERROR, "Error occurred when opening output file\n");&#xA;      return ret;&#xA;  }&#xA;&#xA;  while(1)&#xA;  {&#xA;    if((ret = av_read_frame(in_format_ctx, &amp;packet)) &lt; 0)&#xA;    {&#xA;      fprintf(stderr, "Reading frame failed. %s\n",av_err2str(ret));&#xA;      break;&#xA;    }&#xA;&#xA;    frame = av_frame_alloc();&#xA;    if (!frame) {&#xA;        ret = AVERROR(ENOMEM);&#xA;        break;&#xA;    }&#xA;&#xA;    av_packet_rescale_ts(&amp;packet,in_format_ctx->streams[0]->time_base,in_codec_ctx->time_base);&#xA;&#xA;    if((ret = avcodec_decode_audio4(in_codec_ctx,frame,&amp;got_frame,&amp;packet)) &lt; 0)&#xA;    {&#xA;      av_frame_free(&amp;frame);&#xA;      fprintf(stderr, "Audio decoding failed. %s\n",av_err2str(ret));&#xA;      break;&#xA;    }&#xA;&#xA;    frame->nb_samples = out_codec_ctx->frame_size;&#xA;    if((ret = av_frame_get_buffer(frame, 0))&lt;0)&#xA;    {&#xA;      fprintf(stderr, "Error allocating an audio buffer. %s\n",av_err2str(ret));&#xA;      break;&#xA;    }&#xA;&#xA;    if(got_frame)&#xA;    {&#xA;      if((ret = avcodec_encode_audio2(out_codec_ctx,&amp;packet,frame,&amp;got_packet)) &lt; 0)&#xA;      {&#xA;        av_frame_free(&amp;frame);&#xA;        fprintf(stderr, "Audio encoding failed. %d %s\n",ret,av_err2str(ret));&#xA;        break;&#xA;      }&#xA;    }&#xA;    av_frame_free(&amp;frame);&#xA;&#xA;    if(got_packet)&#xA;    {&#xA;      if((ret = av_interleaved_write_frame(out_format_ctx,&amp;packet)) &lt; 0)&#xA;      {&#xA;        av_packet_unref(&amp;packet);&#xA;        fprintf(stderr, "Writing frame error. %s\n",av_err2str(ret));&#xA;        break;&#xA;      }&#xA;    }&#xA;    av_packet_unref(&amp;packet);&#xA;  }&#xA;}&#xA;&#xA;

    &#xA;

  • opencv dont receive camera stream

    11 juillet 2022, par Ofek nourian

    I have a simple IP camera connected to a video encoder "barracuda haivision S-280E-SDI"&#xA;I can receive the camera feed just fine with vlc, using the folowing URL :

    &#xA;

    &#xA;

    rtsp ://10.5.1.2:554

    &#xA;

    &#xA;

    then, I tried to play the video with python and opencv, using the following code :

    &#xA;

    cap = cv2.VideoCapture(&#x27;rtsp://10.5.1.2:554&#x27;, cv2.CAP_FFMPEG)&#xA;&#xA;while cap.isOpened():&#xA;  ret, frame = cap.read()&#xA;  cv2.imshow(&#x27;frame&#x27;, frame)&#xA;  if cv2.waitKey(1) == ord(1):&#xA;    break&#xA;cap.release()&#xA;cap.destroyALLWindows()&#xA;

    &#xA;

    but I get Error message :

    &#xA;

    &#xA;

    [rtsp @ 0000219d1e4e580] method SETUP failed : 500

    &#xA;

    &#xA;

    why does it happen ? what can I do to fix it ?

    &#xA;