
Recherche avancée
Autres articles (67)
-
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 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 (...) -
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, 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 (...) -
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 (6848)
-
Have 2 blocking scripts interact with each other in linux
18 novembre 2014, par OrtixxI have 2 blocking shell scripts which I want to have interact with each other. The scripts in question are peerflix (nodejs script) and ffmpeg (a simple bash script).
What happens : Peerflix fires up, feeds data to ffmpeg bash scrip which terminates peerflix on completion.
So once peerflix starts it outputs 2 lines and blocks immediately :
[08:15 PM]-[vagrant@packer-virtualbox-iso]-[/var/www/test]-[git master]
$ node /var/www/test/node/node_modules/peerflix/app.js /var/www/test/flexget/torrents/test.torrent -r -q
listening: http://10.0.2.15:38339/
process: 9601I have to feed the listening address to the ffmpeg bash script :
#!/bin/sh
ffmpeg -ss 00:05:00 -i {THE_LISTENING_PORT} -frames:v 1 out1.jpg
ffmpeg -ss 00:10:00 -i {THE_LISTENING_PORT} -frames:v 1 out2.jpgAfter the bash script is done I have to kill the peerflix script (hence me outputting the PID).
My question is how do I achieve this ?
-
suitable video encoding for browsers
26 juin 2022, par seriouslyI was researching how illegal movie streaming services handle all the traffic they get and to understand that I had to follow the steps they perform to get the video data to the users. I got to the stage of video transmission and noticed something that boggled me. Most of the illegal movie streaming sites get their movies/tv-shows through piracy/torrents and even most of the streamers are sister companies of the piracy websites. Now when I took a look at the video encodings of the torrent movies and shows they are h.265 but h.265 is not supported by popular browsers like chrome, firefox edge... Does this mean they (the streamers) have to re-encode every h.265 videos to avc/h.264 before they stream it ? If that's the case, that takes them a huge amount of time to convert their whole movie catalog to h.264 not to mention the space they require to save them. Am I taking a look at this the right way ? Do they really convert and store 2, 3 ... differently encoded video files and stream the suitable one ? Or can they somehow convert the chunks of data they are streaming to h.264 live simultaneously without having to store the h.264 formats hence saving conversion time and space ?


-
Writing opencv frames to avi container using libavformat Custom IO
16 juillet 2017, par AryanI have to write OpenCV cv::Mat frames to an AVI container. I cannot use OpenCV’s VideoWriter because I do not intend to write the AVI file to disk directly, instead I want to send it to a custom stream, so I have to use ffmpeg/libav. As I have never used ffmpeg before I have taken help from solutions provided here and here, alongwith the ffmpeg documentation.
I am able to send AVI container packets to my custom output stream as required but the performance is very bad. Specifically, the call to avcodec_encode_video2 is taking too long.
First, I suspect that due to my inexperience I have misconfigured or wrongly coded something. I am currently working wit 640*480 grayscale frames. On my i.MX6 platform the call to avcodec_encode_video2 is taking about 130ms on average per frame, which is unacceptably slow. Any pointers to an obvious performance killer ??? (i know sws_scale looks useless but it takes negligible time, and might be useful for me later).
Second, I am using PNG encoder, but that is not required, I would be happy to write uncompressed data if I know how to : If the slowdown is not due to my bad programming, can we just get rid of the encoder and generate uncompressed packets for the avi container ? Or use some encoder that accepts grayscale images and is not that slow ?
For Initialization and writing of header I am using :
void MyWriter::WriteHeader()
{
av_register_all();
// allocate output format context
if (avformat_alloc_output_context2(&avFmtCtx, NULL, "avi", NULL) < 0) { printf("DATAREC: avformat_alloc_output_context2 failed"); exit(1); }
// buffer for avio context
bufSize = 640 * 480 * 4; // Don't know how to derive, but this should be big enough for now
buffer = (unsigned char*)av_malloc(bufSize);
if (!buffer) { printf("DATAREC: Buffer alloc failed"); exit(1); }
// allocate avio context
avIoCtx = avio_alloc_context(buffer, bufSize, 1, this, NULL, WriteCallbackWrapper, NULL);
if (!avIoCtx) { printf("DATAREC: avio_alloc_context failed"); exit(1); }
// connect avio context to format context
avFmtCtx->pb = avIoCtx;
// set custom IO flag
avFmtCtx->flags |= AVFMT_FLAG_CUSTOM_IO;
// get encoder
encoder = avcodec_find_encoder(AV_CODEC_ID_PNG);
if (!encoder) { printf("DATAREC: avcodec_find_encoder failed"); exit(1); }
// create new stream
avStream = avformat_new_stream(avFmtCtx, encoder);
if (!avStream) { printf("DATAREC: avformat_new_stream failed"); exit(1); }
// set stream codec defaults
if (avcodec_get_context_defaults3(avStream->codec, encoder) < 0) { printf("DATAREC: avcodec_get_context_defaults3 failed"); exit(1); }
// hardcode settings for now
avStream->codec->pix_fmt = AV_PIX_FMT_GRAY8;
avStream->codec->width = 640;
avStream->codec->height = 480;
avStream->codec->time_base.den = 15;
avStream->codec->time_base.num = 1;
avStream->time_base.den = avStream->codec->time_base.den;
avStream->time_base.num = avStream->codec->time_base.num;
avStream->r_frame_rate.num = avStream->codec->time_base.den;
avStream->r_frame_rate.den = avStream->codec->time_base.num;
// open encoder
if (avcodec_open2(avStream->codec, encoder, NULL) < 0) {
printf("DATAREC: Cannot open codec\n");
exit(1);
}
// write header
if(avformat_write_header(avFmtCtx, NULL) < 0) { printf("DATAREC: avformat_write_header failed\n"); exit(1);}
// prepare for first frame
framePts = 0;
firstFrame = true;
}After writing the header, the following function is called in a loop for each cv::Mat frame :
void MyWriter::WriteFrame(cv::Mat& item)
{
if (firstFrame) // do only once, before writing the first frame
{
// allocate frame
frame = av_frame_alloc();
if (!frame) { printf("DATAREC: av_frame_alloc failed"); exit(1); }
// get size for framebuffer
int picsz = av_image_get_buffer_size(avStream->codec->pix_fmt, avStream->codec->width, avStream->codec->height, 1);
// allocate frame buffer
framebuf = (unsigned char*)av_malloc(picsz);
if (!framebuf) { printf("DATAREC: fail to alloc framebuf"); exit(1); }
// set frame width, height, format
frame->width = avStream->codec->width;
frame->height = avStream->codec->height;
frame->format = static_cast<int>(avStream->codec->pix_fmt);
// set up data pointers and linesizes
if (av_image_fill_arrays(frame->data, frame->linesize, framebuf, avStream->codec->pix_fmt, avStream->codec->width, avStream->codec->height, 1) < 0) { printf("DATAREC: av_image_fill_arrays failed\n"); exit(1);}
// get sws context
swsctx = sws_getCachedContext(nullptr, avStream->codec->width, avStream->codec->height, avStream->codec->pix_fmt, avStream->codec->width, avStream->codec->height, avStream->codec->pix_fmt, SWS_BICUBIC, nullptr, nullptr, nullptr);
if (!swsctx) { printf("DATAREC: fail to sws_getCachedContext"); exit(1); }
// done initializing
firstFrame = false; // don't repeat this for the following frames
}
// call sws scale
const int stride[] = { static_cast<int>(item.step[0]) };
sws_scale(swsctx, &item.data, stride, 0, item.rows, frame->data, frame->linesize);
// set presentation timestamp
frame->pts = framePts++;
// initialize packet
av_init_packet(&pkt);
pkt.data = NULL;
pkt.size = 0;
// THIS TAKES VERY LONG TO EXECUTE
// call encoder, convert frame to packet
if (avcodec_encode_video2(avStream->codec, &pkt, frame, &got_pkt) < 0) { printf("DATAREC: fail to avcodec_encode_video2"); exit(1); }
write packet if available
if (got_pkt)
{
pkt.duration = 1;
av_write_frame(avFmtCtx, &pkt);
}
// wipe packet
av_packet_unref(&pkt);
}
</int></int>After writing required frames, trailer is written :
void MyWriter::WriteTrailer()
{
// prepare packet for trailer
av_init_packet(&pkt);
pkt.data = NULL;
pkt.size = 0;
// encode trailer packet
if (avcodec_encode_video2(avStream->codec, &pkt, nullptr, &got_pkt) < 0) { printf("DATAREC: fail to avcodec_encode_video2"); exit(1); }
// write trailer packet
if (got_pkt)
{
pkt.duration = 1;
av_write_frame(avFmtCtx, &pkt);
}
// free everything
av_packet_unref(&pkt);
av_write_trailer(avFmtCtx);
av_frame_free(&frame);
avcodec_close(avStream->codec);
av_free(avIoCtx);
sws_freeContext(swsctx);
avformat_free_context(avFmtCtx);
av_free(framebuf);
av_free(buffer);
firstFrame = true; // for the next file
}Many many thanks to everyone who made it down to this line !