
Recherche avancée
Médias (91)
-
Spitfire Parade - Crisis
15 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Wired NextMusic
14 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (56)
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (5789)
-
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.


-
FFmpeg, access violation on av_frame_free when running though Unity
27 octobre 2016, 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.
-
How to send loading data before sending a file in Express Get Request
2 octobre 2023, par TheHangelI have an express Node.js server.


The objective of this server is make a process with ffmpeg and to send the file as result.


I manage to know the percentage of the process. But I don't know how to make the client aware of the percentage before it sends the file.


So here is my server-side code :
(I omitted some part of the ffmpeg process because, this is not very important, the important thing is to send the variable 'percent').


const ffmpeg = require('fluent-ffmpeg');

app.get('/download', (req,res) => {
 const video = new ffmpeg('myaudio.mp3');
 let total;
 video
 .format('mp3')
 .on('codecData', (data) => {
 total = parseInt(data.duration.replace(/:/g, ''));
 })
 .on('progress', (progress) => {
 const time = parseInt(progress.timemark.replace(/:/g, ''));
 const percent = (time / total) * 100;
 console.log(percent); // I want to send 'percent' to the client instead of console.log
 })
 .on('end', () => {
 res.status(200).sendFile(output); // then it sends the file to client
 })
 .save(output);
});



if you have a solution, can you show the client-side example, (axios or fetch) please ?