
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (43)
-
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang 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, parMediaSPIP 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 2011You 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 BI 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
endJavascript :
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 ?
-
Fast movie creation using MATLAB and ffmpeg
24 février 2018, par hyiltizI 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 usesurf
,imagesc
,contour
etc. Then we create a video file using these frames in MATLAB, then compress the video file usingffmpeg
.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
orVideoWriter
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 usingffmpeg
(e.g. withx265
encoder into.mp4
). However, saving the output ofimagesc
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 askffmpeg
to read them again. One couldhardcopy
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 toffmpeg
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 TilmidhUsing the libraries (libav) and (ffmpeg), I try to extract frames as
.jpg
files from avideo.mp4
, the problem is that my program crashes when I use theCV_8UC3
parameter, but by changing this parameter toCV_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>

extern "C"
{
#include <libavformat></libavformat>avformat.h>
#include <libavcodec></libavcodec>avcodec.h>
}

int main()
{
 AVFormatContext *formatContext = nullptr;

 if (avformat_open_input(&formatContext, "video.mp4", nullptr, nullptr) != 0)
 {
 return -1;
 }

 if (avformat_find_stream_info(formatContext, nullptr) < 0)
 {
 return -1;
 }

 AVPacket packet;
 const AVCodec *codec = nullptr;
 AVCodecContext *codecContext = nullptr;

 int videoStreamIndex = av_find_best_stream(formatContext, AVMEDIA_TYPE_VIDEO, -1, -1, &codec, 0);
 if (videoStreamIndex < 0)
 {
 return -1;
 }

 codecContext = avcodec_alloc_context3(codec);
 avcodec_parameters_to_context(codecContext, formatContext->streams[videoStreamIndex]->codecpar);

 if (avcodec_open2(codecContext, codec, nullptr) < 0)
 {
 return -1;
 }

 AVFrame *frame = av_frame_alloc();

 while (av_read_frame(formatContext, &packet) >= 0)
 {
 if (packet.stream_index == videoStreamIndex)
 {
 int response = avcodec_send_packet(codecContext, &packet);
 
 if (response < 0)
 {
 break;
 }

 while (response >= 0)
 {
 response = avcodec_receive_frame(codecContext, frame);
 if (response == AVERROR(EAGAIN))
 {
 // NO FRAMES
 break;
 }

 else if (response == AVERROR_EOF)
 {
 // END OF FILE
 break;
 }

 else if (response < 0)
 {
 break;
 }

 //cv::Mat frameMat(frame->height, frame->width, CV_8UC3, frame->data[0]); // CV_8UC3 → THE PROGRAM CRASHES
 cv::Mat frameMat(frame->height, frame->width, CV_8UC1, frame->data[0]); // CV_8UC1 → WORK BUT IMAGES ARE IN GRAYSCALE
 cv::imwrite("frame_" + std::to_string(frame->pts) + ".jpg", frameMat);
 }
 }

 av_packet_unref(&packet);
 }

 av_frame_free(&frame);
 avcodec_free_context(&codecContext);
 avformat_close_input(&formatContext);

 return 0;
}