
Recherche avancée
Médias (2)
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
Autres articles (64)
-
Encodage et transformation en formats lisibles sur Internet
10 avril 2011MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...) -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
-
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)
Sur d’autres sites (7943)
-
FFmpeg insufficient thread locking only when deploying application using homebrew
20 décembre 2012, par KikohsI have the strangest bug of my life.
I have installed ffmpeg using homebrew. I use it from a dll.
I have set a lock manager because I use ffmpeg from multiple threads.In Engine.h :
class EXPORT_LIB Engine
{
public:
static int initEngine();
static int closeEngine();
};In Engine.cpp :
static int ff_lockmgr(void **mutex, enum AVLockOp op)
{
if (NULL == mutex)
return -1;
switch(op)
{
case AV_LOCK_CREATE:
{
*mutex = NULL;
boost::mutex * m = new boost::mutex();
*mutex = static_cast(m);
break;
}
case AV_LOCK_OBTAIN:
{
boost::mutex * m = static_cast(*mutex);
m->lock();
break;
}
case AV_LOCK_RELEASE:
{
boost::mutex * m = static_cast(*mutex);
m->unlock();
break;
}
case AV_LOCK_DESTROY:
{
boost::mutex * m = static_cast(*mutex);
delete m;
break;
}
default:
break;
}
return 0;
}
int Engine::initEngine()
{
int res = -1;
res = av_lockmgr_register(&ff_lockmgr);
av_register_all();
av_log_set_level(AV_LOG_QUIET); // ERROR, PANIC
// Av lock manager success
if( res == 0 ) {
res = MULTITHREAD;
}
else {
res = SINGLETHREAD;
}
return res;
}
int Engine::closeEngine()
{
int res = 0;
res = av_lockmgr_register(NULL);
return res;
}So far so good, everything works as expected.
When I deploy my app using CMake fix_bundle. I have an error message
insufficient thread locking around avcodec_open/close()
If I compile ffmpeg by hand in a custom location, when I deploy the app everything works as expected. What is wrong with homebrew ?
-
Memory Leak in c++/cli application
10 décembre 2013, par AnkushI am passing bitmap from my c# app to c++/cli dll that add it to video.
The problem is program slowly leaking memory. I tried _CrtDumpMemoryLeaks() shows me leak of bitmap & another 40 byte leak but i am disposing bitmap.
Can anyone see memory leak, Here is code..Flow :
1) Capture screenshot by takescreenshot()
2) pass it to c++/cli function
3) dispose bitmap
lines from my c# app
Bitmap snap = takescreeshot();
vencoder.AddBitmap(snap);
snap.Dispose();
vencoder.printleak();
private static Bitmap takescreeshot()
{
System.Drawing.Bitmap bitmap = null;
System.Drawing.Graphics graphics = null;
bitmap = new Bitmap
(
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height,
System.Drawing.Imaging.PixelFormat.Format24bppRgb
);
graphics = System.Drawing.Graphics.FromImage(bitmap);
graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size);
//Write TimeSpamp
Rectangle rect = new Rectangle(1166, 738, 200, 20);
String datetime= System.String.Format("{0:dd:MM:yy hh:mm:ss}",DateTime.Now);
System.Drawing.Font sysfont = new System.Drawing.Font("Times New Roman", 14, FontStyle.Bold);
graphics.DrawString(datetime, sysfont, Brushes.Red,rect);
//
Grayscale filter = new Grayscale(0.2125, 0.7154, 0.0721);
Bitmap grayImage = filter.Apply(bitmap);
//Dispose
bitmap.Dispose();
graphics.Dispose();
return grayImage;
}now in c++/cli dll
bool VideoEncoder::AddBitmap(Bitmap^ bitmap)
{
BitmapData^ bitmapData = bitmap->LockBits( System::Drawing::Rectangle( 0, 0,bitmap->Width, bitmap->Height ),ImageLockMode::ReadOnly,PixelFormat::Format8bppIndexed);
uint8_t* ptr = reinterpret_cast( static_cast( bitmapData->Scan0 ) );
uint8_t* srcData[4] = { ptr, NULL, NULL, NULL };
int srcLinesize[4] = { bitmapData->Stride, 0, 0, 0 };
pCurrentPicture = CreateFFmpegPicture(pVideoStream->codec->pix_fmt, pVideoStream->codec->width, pVideoStream->codec->height);
sws_scale(pImgConvertCtx, srcData, srcLinesize, 0, bitmap->Height, pCurrentPicture->data, pCurrentPicture->linesize );
bitmap->UnlockBits( bitmapData );
write_video_frame();
bitmapData=nullptr;
ptr=NULL;
return true;
}
AVFrame * VideoEncoder::CreateFFmpegPicture(int pix_fmt, int nWidth, int nHeight)
{
AVFrame *picture = NULL;
uint8_t *picture_buf = NULL;
int size;
picture = avcodec_alloc_frame();
if ( !picture)
{
printf("Cannot create frame\n");
return NULL;
}
size = avpicture_get_size((AVPixelFormat)pix_fmt, nWidth, nHeight);
picture_buf = (uint8_t *) av_malloc(size);
if (!picture_buf)
{
av_free(picture);
printf("Cannot allocate buffer\n");
return NULL;
}
avpicture_fill((AVPicture *)picture, picture_buf,
(AVPixelFormat)pix_fmt, nWidth, nHeight);
return picture;
}
void VideoEncoder::write_video_frame()
{
AVCodecContext* codecContext = pVideoStream->codec;
int out_size, ret = 0;
if ( pFormatContext->oformat->flags & AVFMT_RAWPICTURE )
{
printf( "raw picture must be written" );
}
else
{
out_size = avcodec_encode_video( codecContext, pVideoEncodeBuffer,nSizeVideoEncodeBuffer, pCurrentPicture );
if ( out_size > 0 )
{
AVPacket packet;
av_init_packet( &packet );
if ( codecContext->coded_frame->pts != AV_NOPTS_VALUE )
{
packet.pts = av_rescale_q( packet.pts, codecContext->time_base, pVideoStream->time_base );
}
if ( codecContext->coded_frame->pkt_dts != AV_NOPTS_VALUE )
{
packet.dts = av_rescale_q( packet.dts, codecContext->time_base, pVideoStream->time_base );
}
if ( codecContext->coded_frame->key_frame )
{
packet.flags |= AV_PKT_FLAG_KEY;
}
packet.stream_index = pVideoStream->index;
packet.data = pVideoEncodeBuffer;
packet.size = out_size;
ret = av_interleaved_write_frame( pFormatContext, &packet );
av_free_packet(&packet);
av_freep(pCurrentPicture);
}
else
{
// image was buffered
}
}
if ( ret != 0 )
{
throw gcnew Exception( "Error while writing video frame." );
}
}
void VideoEncoder::printleak()
{
printf("No of leaks: %d",_CrtDumpMemoryLeaks());
printf("\n");
} -
Call to Process works fine with Debug, but it doesn't work in the installed application
6 février 2019, par SantiI am developing a Windows Form program that has callings to ffmpeg library through the class
Process
.It works fine when I run it with the Debug in Visual Studio 2013. But when I install the program and I invoke the operation that call to the ffmpeg
Process
, it doesn’t work. The cmd screen appears an disappears and nothing happens.I have tried to know what can be happening getting a log file with the output of ffmpeg, in case it was a problem in the ffmpeg libraries. However, after executing it the log is empty, what means that the ffmpeg command has not been executed.
Can someone help me, please ?
The code is this :
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/c " + ffmpegPath + " " + commandArguments;
using (Process processTemp = new Process())
{
processTemp.StartInfo = startInfo;
processTemp.EnableRaisingEvents = true;
processTemp.Start();
processTemp.WaitForExit();
}I am invoking to
cmd.exe
(not directlyffmpeg.exe
) because in the arguments sometimes there can be a pipe (that is why the command starts with "/c
").