Recherche avancée

Médias (91)

Autres articles (40)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (8724)

  • avcodec/s3tc : fix alpha decoding when dimensions are not a multiple of 4

    7 mai 2015, par Tom Butterworth
    avcodec/s3tc : fix alpha decoding when dimensions are not a multiple of 4
    

    Fix alpha position error for edge blocks of odd-dimensioned frames

    Signed-off-by : Michael Niedermayer <michaelni@gmx.at>

    • [DH] libavcodec/s3tc.c
  • ffmpeg/c++ Encode additional information of video frame with ffmpeg

    29 janvier 2018, par 8793

    I am new with ffmpeg & video encoding, after looking for some related questions on this page, I found this post which is very useful to understand the overview process of ffmpeg.

    However, my work not only needs to manipulate with Mat frame, after extract important information from video (extract edge, position of edge block, type of each edge block, block number, motion vector), I have to encode and send them to client. I tried to find an example code for this part but it seems nobody have done it before.

    My problems is how to encode these additional information along with video frame, and send both to client. I read about Huffman Coding which can help lossless compression, But is it possible encode edge & motion data using huffman coding while encoding video frame using ffmpeg ? I’m doing experiment using udp protocol.

    I can not find any information about this.
    I read into metadata & side information in ffmpeg but it’s not what I want to do.

    I hope if you can give me an advice or a directions to research into this area, so I can understand and try to implement it. If there is any example code for this case, I would be very grateful for your sharing.

    Thank you so much.

    Below is encoder part on server side :

    int encode(Mat&amp; input_frame, EncodedCallback callback, void* userdata = nullptr) {
       AVPacket pkt;
       /* encode 1 second of video */
       av_init_packet(&amp;pkt);
       pkt.data = NULL; // packet data will be allocated by the encoder
       pkt.size = 0;
       int size = 0;
       fflush(stdout);
       cvtFrame2AVFrameYUV420(input_frame, &amp;frame);

       static int time;
       frame->pts = time++;
       /* encode the image */
       ret = avcodec_send_frame(c, frame);
       if (ret &lt; 0) {
           fprintf(stderr, "Error avcodec_send_frame\n");
           exit(1);
       }
       nbFramesEncoded++;
       ret = avcodec_receive_packet(c, &amp;pkt);
       if (!isFirstFrameEmmited) {
           nbNeededFramesInBuffer++;

           printf("nbNeededFramesInBuffer: %d\n", nbNeededFramesInBuffer);
       }
       if (ret &lt; 0) {
           if (ret == -EAGAIN) {
               //output is not available, we must send more input
           } else {
               fprintf(stderr, "Error avcodec_receive_packet %d\n", ret);
               exit(1);
           }
       } else {

           if (callback) {
               callback(pkt, userdata);
           }
           size = pkt.size + 4;
           av_packet_unref(&amp;pkt);
       }

       return size;
    }

    Below is code to handle frame processing (presently we check & send motioned block to client)

    void updateFrame(Mat&amp; frame) {
       //Get all Streams ready
       bool isReady = true;
       if (!frameStreamer->encoder->isFirstFrameEmmited) {
           frameStreamer->sendFrame(frame);
           isReady = false;
       }
       for (int yidx = 0; yidx &lt; gridSize.height; yidx++) {
           for (int xidx = 0; xidx &lt; gridSize.width; xidx++) {
               StreamPtr&amp; stream = streamGrid[yidx][xidx];
               if (!stream->encoder->isFirstFrameEmmited) {
                   Mat block = frame(stream->irect);
                   stream->sendFrame(block);
                   isReady = false;
               }
           }
       }
       if (isReady == false) {
           return;
       }

       if (pGray.empty()) {

           frameStreamer->sendFrame(frame);
           frameStreamer->sendFrame(frame);

           cvtColor(frame, pGray, CV_BGR2GRAY);
           return;
       }

       //Motion Detection
       Mat gray;
       cvtColor(frame, gray, CV_BGR2GRAY);
       Mat diff;
       absdiff(gray, pGray, diff);
       threshold(diff, diff, NOISE_THRESHOLD, 255, CV_THRESH_BINARY);
       if (HEAT_IMAGE) {
           gray.copyTo(diff, diff);
           imshow("Gray", gray);
           threshold(diff, diff, HEAT_THRESH, 255, CV_THRESH_TOZERO);
       }
       if (USE_MORPH_NOISE) {
           Morph_Noise(diff);
       }

       Mat motionImg = Mat::zeros(frameSize, CV_8UC3);
       //Block Classification
       int nbModifiedBlocks = 0;
       for (int yidx = 0; yidx &lt; gridSize.height; yidx++) {
           for (int xidx = 0; xidx &lt; gridSize.width; xidx++) {
               Rect irect(xidx * blockSize.width, yidx * blockSize.height,
                       blockSize.width, blockSize.height);
               int blockDiff = sum(diff(irect))[0];
               if (blockDiff > BLOCK_THRESHOLD * 255) {
                   this->blockCls.at<uchar>(yidx, xidx) = MODI_BLOCK;
                   nbModifiedBlocks++;
               } else {
                   this->blockCls.at<uchar>(yidx, xidx) = SKIP_BLOCK;
               }
           }
       }

       //Send
       if (nbModifiedBlocks > this->nbBlocksThresh) {
           nbSentBytes += this->frameStreamer->sendFrame(frame);
       } else {
           for (int yidx = 0; yidx &lt; gridSize.height; yidx++) {
               for (int xidx = 0; xidx &lt; gridSize.width; xidx++) {
                   uchar cls = this->blockCls.at<uchar>(yidx, xidx);
                   StreamPtr&amp; stream = streamGrid[yidx][xidx];
                   bool send = false;
                   if (cls == MODI_BLOCK) {
                       if (DEBUG_NETWORK) {
                           printf("Normal (%d, %d): ", xidx, yidx);
                       }
                       send = true;
                       stream->encoder->nbFramesBuffered = stream->encoder->nbNeededFramesInBuffer;

                       rectangle(motionImg, stream->irect, Scalar(0, 0, 255), CV_FILLED);

                   } else if (stream->encoder->nbFramesBuffered > 0) {
                       if (DEBUG_NETWORK) {
                           printf("Extra (%d, %d): ", xidx, yidx);
                       }
                       send = true;
                       stream->encoder->nbFramesBuffered--;
                       stream->encoder->nbFlushFrames++;
                       rectangle(motionImg, stream->irect, Scalar(0, 255, 0), CV_FILLED);
                   }

                   if (send) {
                       Mat block = frame(stream->irect);
                       nbSentBytes += stream->sendFrame(block);
                       gray(stream->irect).copyTo(pGray(stream->irect));
                   }
               }
           }
       }
    </uchar></uchar></uchar>

    }

  • FFmpeg : chromakey without green edges

    5 septembre 2020, par Igniter

    I have a video of a person on green background and I'm trying to turn background transparent by this :

    &#xA;

    ffmpeg -i bg.mp4 -i man.mp4 -filter_complex &#x27;[1:v]colorkey=0x00ff00:0.3:0.3[ckout];[0:v][ckout]overlay[out]&#x27; -map &#x27;[out]&#x27; result.mp4&#xA;

    &#xA;

    Colorkey gives this quite noticeable green edge around the person's figure.
    &#xA;Any attempts to increase opacity or blend parameters result in disappearing facial features.

    &#xA;

    enter image description here

    &#xA;

    Is there any smart way to change pure green 0x00ff00 pixels with transparent ones ?

    &#xA;