
Recherche avancée
Médias (1)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (97)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
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. -
HTML5 audio and video support
13 avril 2011, parMediaSPIP 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 (...)
Sur d’autres sites (9284)
-
avformat/segment : Fix leak and invalid free of AVIOContext
6 septembre 2020, par Andreas Rheinhardtavformat/segment : Fix leak and invalid free of AVIOContext
seg_init() and seg_write_header() currently contain a few error paths
in which an already opened AVIOContext for the child muxer leaks (namely
if there are unrecognized options for the child muxer or if writing the
header of the child muxer fails) ; the reason for this is that this
AVIOContext is not closed in the deinit function. If all goes well, it
is closed when writing the trailer. From this it also follows that the
AVIOContext also leaks when the trailer is never written, even when
writing the header succeeds.But simply freeing said AVIOContext in the deinit function is
complicated by the fact that the AVIOContext may or may not have been
opened via the io_open callback : If options are set to discard header
and trailer, said AVIOContext can also be a null context which must not
be closed via the io_close callback. This may lead to crashes, as
io_close may presume the AVIOContext's opaque to be set. It currently
works with the default io_close callback which simply calls avio_close(),
because avio_close() doesn't care about opaque being NULL since commit
6e8e8431e15a58aa44cfdd8c11f9ea096837c0fa. Therefore this commit records
which of the two kinds of AVIOContext is currently in use to use the
right way to close it.Finally there was one instance (namely if initializing the child muxer
fails with no unrecognized options) where the AVIOContext was always
closed via the io_close callback. The above remark applies to this ; it
has been fixed, too.Reviewed-by : Ridley Combs <rcombs@rcombs.me>
Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@gmail.com> -
avformat/segment : Free SegmentListEntries in deinit, not write_trailer
5 septembre 2020, par Andreas Rheinhardt -
Memory leak using FFmpeg
3 août 2020, par kichmaI found out that my application has a memory leak coming from a C++ function. It seems this function is called for each frame and it leak is proportional to the size of a frame. It's called from a python code but the leak is somewhere in the C++ code.

I don't have much experience with ffmpeg or C++ and I'm not author of this code. Does anyone see what is causing leak here or can provide some advice how to debug this ? I tried to use the code (windows part) from this answer https://stackoverflow.com/a/64166/10046424 to find which part of the code uses memory but I always got 0.

static py::object video_encode_frame(py::object self) 
{

 video_encode_helper *vec = py::cppobject < video_encode_helper > (self.attr("_encoder_state")).value();

 int image_id = 0;
 RTIConfig rti;
 ViewerBase *bs = base(self);
 Py_BEGIN_ALLOW_THREADS;
 renderToExistingImage(&rti, vec->img_key, image_id, bs, vec->c->width, vec->c->height);
 Py_END_ALLOW_THREADS;

 static int i = 0;
 float dummy;
 int h, w;
 char buf[MVO_BUFFER_SIZE];

 HC_Show_Image(vec->img_key, &dummy, &dummy, &dummy, buf, &w, &h, vec->data);
 struct SwsContext *sws_ctx = sws_getContext(vec->c->width, vec->c->height, PIX_FMT_RGB24,
 vec->c->width, vec->c->height, (PixelFormat) vec->picture->format, 
 SWS_FAST_BILINEAR, NULL, NULL, NULL);

 int src_linesize[] = { vec->c->width * 3, 0, 0, 0 };
 const uint8_t *src_data[] = { (const uint8_t *) vec->data, 0, 0, 0 };
 sws_scale(sws_ctx, (const uint8_t * const *) src_data, src_linesize, 0, vec->c->height, vec->picture->data,
 vec->picture->linesize);
 sws_freeContext(sws_ctx);

 int repeat = vec->FPS / vec->TPS;
 if (repeat == 0)
 repeat = 1;


 int ret = -1;

 AVPacket pkt = { 0 };
 int got_packet;
 av_init_packet(&pkt);

 /* encode the image */
 ret = avcodec_encode_video2(vec->c, &pkt, vec->picture, &got_packet);
 if (ret < 0) 
 return py::bool_(false);

 for (int r = 0; r < repeat; r++) {
 /* If size is zero, it means the image was buffered. */
 if (!ret && got_packet && pkt.size) {
 pkt.stream_index = vec->video_st->index;

 /* Write the compressed frame to the media file. */
 ret = av_interleaved_write_frame(vec->oc, &pkt);

 } else
 ret = 0;

 vec->picture->pts += av_rescale_q(1, vec->video_st->codec->time_base, vec->video_st->time_base);
 vec->frame_count++;
 }
 return py::bool_(true);
}



There is also a cleanup function that is called at the end. Perhaps something should be deallocated there ?


static py::object video_encode_finalize(py::object self)
{
 if (self.attr("_encoder_state") == py::none())
 return py::bool_(false);

 video_encode_helper *vec = py::cppobject < video_encode_helper > (self.attr("_encoder_state")).value();

 /* Write the trailer, if any. The trailer must be written before you
 * close the CodecContexts open when you wrote the header; otherwise
 * av_write_trailer() may try to use memory that was freed on
 * av_codec_close(). */
 av_write_trailer(vec->oc);
 /* Close each codec. */

 avcodec_close(vec->video_st->codec);
 av_freep(&(vec->picture->data[0]));
 av_free(vec->picture);

 if (!(vec->fmt->flags & AVFMT_NOFILE))
 /* Close the output file. */
 avio_close(vec->oc->pb);

 /* free the stream */
 avformat_free_context(vec->oc);

 vec->initialized = false;
 vec->frame_count = 0;

 return py::bool_(true);
}