
Recherche avancée
Médias (91)
-
Géodiversité
9 septembre 2011, par ,
Mis à jour : Août 2018
Langue : français
Type : Texte
-
USGS Real-time Earthquakes
8 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
SWFUpload Process
6 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
-
Creativecommons informational flyer
16 mai 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (103)
-
Mise à disposition des fichiers
14 avril 2011, parPar défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...) -
Problèmes fréquents
10 mars 2010, parPHP et safe_mode activé
Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site -
Gestion générale des documents
13 mai 2011, parMédiaSPIP ne modifie jamais le document original mis en ligne.
Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)
Sur d’autres sites (7781)
-
avformat/mpegenc : Ensure packet queue stays valid
15 février 2021, par Andreas Rheinhardtavformat/mpegenc : Ensure packet queue stays valid
The MPEG-PS muxer uses a custom queue of custom packets. To keep track
of it, it has a pointer (named predecode_packet) to the head of the
queue and a pointer to where the next packet is to be added (it points
to the next-pointer of the last element of the queue) ; furthermore,
there is also a pointer that points into the queue (called premux_packet).The exact behaviour was as follows : If premux_packet was NULL when a
packet is received, it is taken to mean that the old queue is empty and
a new queue is started. premux_packet will point to the head of said
queue and the next_packet-pointer points to its next pointer. If
predecode_packet is NULL, it will also made to point to the newly
allocated element.But if premux_packet is NULL and predecode_packet is not, then there
will be two queues with head elements premux_packet and
predecode_packet. Yet only elements reachable from predecode_packet are
ever freed, so the premux_packet queue leaks.
Worse yet, when the predecode_packet queue will be eventually exhausted,
predecode_packet will be made to point into the other queue and when
predecode_packet will be freed, the next pointer of the preceding
element of the queue will still point to the element just freed. This
element might very well be still reachable from premux_packet which
leads to use-after-frees lateron. This happened in the tickets mentioned
below.Fix this by never creating two queues in the first place by checking for
predecode_packet to know whether the queue is empty. If premux_packet is
NULL, then it is set to the newly allocated element of the queue.Fixes tickets #6887, #8188 and #8266.
Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-
FFmpeg, access violation on av_frame_free when running though Unity
1er février 2021, par MockarutanI'm working on a video recording plugin for Unity using ffmpeg. I'm new to the video encoding domain and just got my code to work today. But I think a might have a few memory leaks and trying to fix them crashes Unity.



The plugin is written i c++ (as external "C" code) and imported in a c# script in unity with a simple DllImport. Again, this is not my comfort area either, but it works.



When a screen buffer is rendered, I put in a RGB24 buffer and send it to my c++ function, this one :



int encode_frame(uint8_t* rgb24Data)
{
 AVFrame *frame = av_frame_alloc();
 if (!frame)
 return COULD_NOT_ALLOCATE_FRAME;

 frame->format = codec_context->pix_fmt;
 frame->width = codec_context->width;
 frame->height = codec_context->height;

 int ret = av_image_alloc(frame->data, frame->linesize, codec_context->width, codec_context->height, codec_context->pix_fmt, 32);
 if (ret < 0)
 return COULD_NOT_ALLOCATE_PIC_BUF;

 SwsContext * ctx = sws_getContext(codec_context->width, codec_context->height,
 AV_PIX_FMT_RGB24, codec_context->width, codec_context->height,
 AV_PIX_FMT_YUV420P, 0, 0, 0, 0);


 uint8_t * inData[1] = { rgb24Data };
 int inLinesize[1] = { 3 * codec_context->width };

 sws_scale(ctx, inData, inLinesize, 0, codec_context->height, frame->data, frame->linesize); // From RGB to YUV

 frame->pts = frame_counter++;

 ret = avcodec_send_frame(codec_context, frame);
 if (ret < 0)
 return ERROR_ENCODING_FRAME_SEND;

 AVPacket pkt;
 av_init_packet(&pkt);
 pkt.data = NULL;
 pkt.size = 0;

 while (true)
 {
 ret = avcodec_receive_packet(codec_context, &pkt);
 if (!ret)
 {
 if (pkt.pts != AV_NOPTS_VALUE)
 pkt.pts = av_rescale_q(pkt.pts, codec_context->time_base, video_st->time_base);
 if (pkt.dts != AV_NOPTS_VALUE)
 pkt.dts = av_rescale_q(pkt.dts, codec_context->time_base, video_st->time_base);

 av_write_frame(outctx, &pkt);
 av_packet_unref(&pkt);
 }
 else if (ret == AVERROR(EAGAIN))
 {
 frame->pts = frame_counter++;
 ret = avcodec_send_frame(codec_context, frame);
 if (ret < 0)
 return ERROR_ENCODING_FRAME_SEND;
 }
 else if (ret < 0)
 return ERROR_ENCODING_FRAME_RECEIVE;
 else
 break;
 }

 // This one
 av_frame_free(&frame);
}




Now, this code might have a lot of issues that I'm not aware of, and you are free to point them out if you like. But the line that gives me error is
av_frame_free(&frame);
.


If I run this in a synthetic test app in c++ that I made, it works. I can even run it in a c# synthetic test app (exactly like the c++ one), and it works. But if I run it though Unity, it crashes on the first frame. The log says "Read from location fe7f8097 caused an access violation.".



I have tried with
av_freep()
andav_free()
. Not sure exactly what makes them different (different example codes use different ones), but none work.


So, what I'm I missing ? The
frame
is leaking if I don't free it right ? But why does it crash in Unity ?


The whole thing works great in Unity if I don't have the
av_frame_free(&frame);
. Resulting video looks great !


PS. I'm aware (as far as I know) that the frame also leaks if something fails and returns an error code. But one thing at a time.


-
avformat_close_input memory leak ?
20 janvier 2021, par Keen JackdawI developed an app to push live stream with ffmpeg. When I checked the app with
leaks --atExit -- <the app="app"></the>
(I'm on mac), I found some memory leak with AVFormatContext.

The minimized code are provided below :


#include <iostream>

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

void foo() {
 avdevice_register_all();

 AVFormatContext *avInputFormatContext = avformat_alloc_context();
 AVInputFormat *avInputFormat = av_find_input_format("avfoundation");
 std::cout << "open input" << std::endl;
 int ret = avformat_open_input(&avInputFormatContext, "Capture screen 0", avInputFormat, nullptr);
 if (ret < 0) { std::cout << "open input failed: " << ret << std::endl; return;}

 avformat_close_input(&avInputFormatContext);

}

int main() {
 foo();
 return 0;
}

</iostream>


The output is


Process: ffmpegtest [87726]
Path: /Users/USER/*/ffmpegtest
Load Address: 0x10a752000
Identifier: ffmpegtest
Version: ???
Code Type: X86-64
Platform: macOS
Parent Process: leaks [87725]

Date/Time: 2021-01-20 15:44:57.533 +0800
Launch Time: 2021-01-20 15:44:55.760 +0800
OS Version: macOS 11.1 (20C69)
Report Version: 7
Analysis Tool: /Applications/Xcode.app/Contents/Developer/usr/bin/leaks
Analysis Tool Version: Xcode 12.3 (12C33)

Physical footprint: 9.9M
Physical footprint (peak): 10.6M
----

leaks Report Version: 4.0
Process 87726: 14143 nodes malloced for 2638 KB
Process 87726: 1 leak for 32 total leaked bytes.

 1 (32 bytes) ROOT LEAK: 0x7f8c61e1b040 [32] length: 16 "Capture screen 0"



Did I miss something ?