Recherche avancée

Médias (1)

Mot : - Tags -/epub

Autres articles (43)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

Sur d’autres sites (3608)

  • Rails ActionController::Live - Sends everything at once instead of async

    28 janvier 2016, par Michael B

    I have an issue with rails ActionController::Live

    In the end I want to show the progress of FFMPEG to the user, but for now I want to get this minimal example running :

    Rails media_controller.rb :

    class MediaController < ApplicationController
     include ActionController::Live

     def stream
       puts "stream function loaded"

         response.headers['Content-Type'] = 'text/event-stream'
         i = 0
         begin
           response.stream.write "data: 1\n\n"
           sleep 0.5
           i += 1
           puts "response... data: " + i.to_s
         end while i < 10
       response.stream.close
     end
    end

    Javascript :

    source = new EventSource("/test/0");
    source.addEventListener("message", function(response) {
     // Do something with response.data
     console.log('I have received a response from the server: ' + response);
    }, false);

    When I navigate to the site, there are no JavaScript Errors showing. As soon as I navigate to the site, the "stream"-Action of the MediaController gets successfully called. I can verify this, by looking at the Server-Console. It gives me the following output. After every response line, there is a 500ms delay, like expected :

    stream function loaded
    response... data: 1
    response... data: 2
    response... data: 3
    response... data: 4
    response... data: 5
    response... data: 6
    response... data: 7
    response... data: 8
    response... data: 9
    response... data: 10
    Completed 200 OK in 5005ms (ActiveRecord: 0.8ms)

    On the JavaScript Side, it gives me the following Output :

    (10x) I have received a response from the server: [object MessageEvent]

    But the problem is here, that it sends all these 10 Messages from the server after 5 seconds at the same time ! The expected behavior however is, that it should send me 1 message every 0.5 seconds !

    So what am I doing wrong here ? Where is the error ?

    Screenshot Rails Console / JavaScript Console

  • Fast movie creation using MATLAB and ffmpeg

    24 février 2018, par hyiltiz

    I have some time series data that I would like to create into movies. The data could be 2D (about 500x10000) or 3D (500x500x10000). For 2D data, the movie frames are simply line plot using plot, and for 3D data, we can use surf, imagesc, contour etc. Then we create a video file using these frames in MATLAB, then compress the video file using ffmpeg.

    To do it fast, one would try not to render all the images to display, nor save the data to disk then read it back again during the process. Usually, one would use getframe or VideoWriter to create movie in MATLAB, but they seem to easily get tricky if one tries not to display the figures to screen. Some even suggest plotting in hidden figures, then saving them as images to disk as .png files, then compress them using ffmpeg (e.g. with x265 encoder into .mp4). However, saving the output of imagesc in my iMac took 3.5s the first time, then 0.5s after. I also find it not fast enough to save so many files to disk only to ask ffmpeg to read them again. One could hardcopy the data as this suggests, but I am not sure whether it works regardless of the plotting method (e.g. plot, surf etc.), and how one would transfer data over to ffmpeg with minimal disk access.

    This is similiar to this, but immovie is too slow. This post 3 is similar, but advocates writing images to disk then reading them (slow IO).

  • Extracting frames from a video does not work correctly [closed]

    13 avril 2024, par Al Tilmidh

    Using the libraries (libav) and (ffmpeg), I try to extract frames as .jpg files from a video.mp4, the problem is that my program crashes when I use the CV_8UC3 parameter, but by changing this parameter to CV_8UC1, the extracted images end up without color (grayscale), I don't really know what I missed, here is a minimal code to reproduce the two situations :

    


    #include <opencv2></opencv2>opencv.hpp>&#xA;&#xA;extern "C"&#xA;{&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;}&#xA;&#xA;int main()&#xA;{&#xA;    AVFormatContext *formatContext = nullptr;&#xA;&#xA;    if (avformat_open_input(&amp;formatContext, "video.mp4", nullptr, nullptr) != 0)&#xA;    {&#xA;        return -1;&#xA;    }&#xA;&#xA;    if (avformat_find_stream_info(formatContext, nullptr) &lt; 0)&#xA;    {&#xA;        return -1;&#xA;    }&#xA;&#xA;    AVPacket packet;&#xA;    const AVCodec *codec = nullptr;&#xA;    AVCodecContext *codecContext = nullptr;&#xA;&#xA;    int videoStreamIndex = av_find_best_stream(formatContext, AVMEDIA_TYPE_VIDEO, -1, -1, &amp;codec, 0);&#xA;    if (videoStreamIndex &lt; 0)&#xA;    {&#xA;        return -1;&#xA;    }&#xA;&#xA;    codecContext = avcodec_alloc_context3(codec);&#xA;    avcodec_parameters_to_context(codecContext, formatContext->streams[videoStreamIndex]->codecpar);&#xA;&#xA;    if (avcodec_open2(codecContext, codec, nullptr) &lt; 0)&#xA;    {&#xA;        return -1;&#xA;    }&#xA;&#xA;    AVFrame *frame = av_frame_alloc();&#xA;&#xA;    while (av_read_frame(formatContext, &amp;packet) >= 0)&#xA;    {&#xA;        if (packet.stream_index == videoStreamIndex)&#xA;        {&#xA;            int response = avcodec_send_packet(codecContext, &amp;packet);&#xA;            &#xA;            if (response &lt; 0)&#xA;            {&#xA;                break;&#xA;            }&#xA;&#xA;            while (response >= 0)&#xA;            {&#xA;                response = avcodec_receive_frame(codecContext, frame);&#xA;                if (response == AVERROR(EAGAIN))&#xA;                {&#xA;                    // NO FRAMES&#xA;                    break;&#xA;                }&#xA;&#xA;                else if (response == AVERROR_EOF)&#xA;                {&#xA;                    // END OF FILE&#xA;                    break;&#xA;                }&#xA;&#xA;                else if (response &lt; 0)&#xA;                {&#xA;                    break;&#xA;                }&#xA;&#xA;                //cv::Mat frameMat(frame->height, frame->width, CV_8UC3, frame->data[0]); // CV_8UC3 → THE PROGRAM CRASHES&#xA;                cv::Mat frameMat(frame->height, frame->width, CV_8UC1, frame->data[0]); // CV_8UC1 → WORK BUT IMAGES ARE IN GRAYSCALE&#xA;                cv::imwrite("frame_" &#x2B; std::to_string(frame->pts) &#x2B; ".jpg", frameMat);&#xA;            }&#xA;        }&#xA;&#xA;        av_packet_unref(&amp;packet);&#xA;    }&#xA;&#xA;    av_frame_free(&amp;frame);&#xA;    avcodec_free_context(&amp;codecContext);&#xA;    avformat_close_input(&amp;formatContext);&#xA;&#xA;    return 0;&#xA;}&#xA;

    &#xA;