
Recherche avancée
Médias (91)
-
Chuck D with Fine Arts Militia - No Meaning No
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Paul Westerberg - Looking Up in Heaven
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Le Tigre - Fake French
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Thievery Corporation - DC 3000
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Dan the Automator - Relaxation Spa Treatment
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Gilberto Gil - Oslodum
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (92)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (10911)
-
avformat/segment : Fix leak of string on error
5 septembre 2020, par Andreas Rheinhardtavformat/segment : Fix leak of string on error
A string containing the segment's filename that the segment muxer
allocates got only freed in its write_trailer function. This implies
that it leaks if write_trailer is never called, e.g. if initializing
the child muxer fails. This commit fixes this by freeing the string
in the deinit function instead.Reviewed-by : Ridley Combs <rcombs@rcombs.me>
Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@gmail.com> -
lavf/vf_framerate : Fix frame leak when increasing framerate.
11 mars 2017, par Alexis Ballier -
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);
}