
Recherche avancée
Médias (1)
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (59)
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (10269)
-
avfilter/vf_convolution : add x86 SIMD for filter_3x3()
27 juin 2019, par Ruiling Songavfilter/vf_convolution : add x86 SIMD for filter_3x3()
Tested using a simple command (apply edge enhance) :
./ffmpeg_g -i /Downloads/bbb_sunflower_1080p_30fps_normal.mp4 \
-vf convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128" \
-an -vframes 1000 -f null /dev/nullThe fps increase from 151 to 270 on my local machine.
Signed-off-by : Ruiling Song <ruiling.song@intel.com>
-
Why AVFormatContext pointer is initialized in a non-global struct object, while NULL in a global object ?
6 mai 2013, par user1914692The code is almost similar to filtering _video.c, one example code in ffmpeg doc.
In the original example file, there are many global static variables. Here is one snippet of the 1st version code (same as the original sample) :
static AVFormatContext *fmt_ctx;
static AVCodecContext *dec_ctx;
int main(int argc, char **argv) {
// .... other code
if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
return ret;
}
// .... other code
}Since all these variables serve for open a video file, I prefer to group them. So the purpose of my code is to rearrange these variables, making the source file more structed.
The first idea came to my mind is to use struct.
struct structForInVFile {
AVFormatContext *inFormatContext;
AVCodecContext *inCodecContext;
AVCodec* inCodec;
AVPacket inPacket;
AVFrame *inFrame;
int video_stream_index;
int inFrameRate;
int in_got_frame;
};Now the 2nd version of code becomes :
int main(int argc, char **argv) {
// .... other code
structForInVFile inStruct;
if ((ret = avformat_open_input(&inStruct.inFormatContext, filename, NULL, NULL)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
return ret;
}
// .... other code
}Result for the 2nd version : the code can not work at the avformat_open_input. No error information. The program silently exits.
Through debugging, I find that : inStruct.inFormatContext : 0xffffefbd22b60000In the 3rd version of code, I set inStruct as a global variable.
The code becomes :structForInVFile inStruct;
int main(int argc, char **argv) {
// .... other code
if ((ret = avformat_open_input(&inStruct.inFormatContext, filename, NULL, NULL)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
return ret;
}
// .... other code
}Result for the 3rd version : the code works.
Through debugging, I find that : inStruct.inFormatContext : 0x0So I think the reason is that : the AVFormatContext should be zero-initialized for avformat_open_input to work.
Now, the question is :Why AVFormatContext pointer is initialized in a non-global struct object, while zero-initialized in a global object ?
I do not know any difference of definition of a struct object as a global variable or a non-global variable.
-
Trying to find a way to limit the number of List that can run at one time
14 mars 2024, par JakeMy application has a List of Tasks. Each Task launches a FFMPEG process that requires a lot of resources on my machine. At times, this list can contain 200+ processes to FFMPEG. While processing, my memory is at 99% and everything freezes up.


I need to limit the amount of processes that can run at one time. I have read a little about SemaphoreSlim ; however, I cannot wrap my mind around it's implementation.


Is this a solution for this particular problem and if so, any ideas on how to implement it in my code ?


Below is my code :


public async System.Threading.Tasks.Task GetVideoFiles()
{ 
 OpenFileDialog openFileDialog = new OpenFileDialog();
 openFileDialog.Multiselect = true;
 
 if (openFileDialog.ShowDialog() == true)
 {
 AllSplices.Clear();
 AllSplices = new ObservableCollection<splicemodel>();
 IsBusy = true;
 IsBusyMessage = "Extracting Metadata";
 IsBusyBackgroundVisible = "Visible";
 NotifyPropertyChanged(nameof(IsBusy));
 NotifyPropertyChanged(nameof(IsBusyMessage));
 NotifyPropertyChanged(nameof(IsBusyBackgroundVisible));
 metaTasks = new List>(); 
 extractFramesTask = new List();
 
 foreach (string file in openFileDialog.FileNames)
 {
 FileInfo fileInfo = new FileInfo(file);
 bool canAdd = true;
 var tempFileName = fileInfo.Name;
 
 foreach (var video in AllVideos)
 {
 if (file == video.VideoPath)
 {
 canAdd = false;
 break;
 }

 if (video.VideoName.Contains(tempFileName))
 {
 video.VideoName = "_" + video.VideoName; 
 } 
 }
 if (canAdd)
 { 
 metaTasks.Add(System.Threading.Tasks.Task.Run(() => ProcessMetaData(file))); 
 } 
 }
 var metaDataResults = await System.Threading.Tasks.Task.WhenAll(metaTasks); 
 
 foreach (var vid in metaDataResults)
 { 
 if(vid == null)
 {
 continue;
 }
 
 vid.IsNewVideo = true; 
 AllVideos.Add(vid);
 
 // This list of task launches up to 200 video processing processes to FFMPEG
 extractFramesTask.Add(System.Threading.Tasks.Task.Run(() => ExtractFrames(vid)));
 
 vid.IsProgressVisible = "Visible";
 TotalDuration += vid.VideoDuration;
 vid.NumberOfFrames = Convert.ToInt32(vid.VideoDuration.TotalSeconds * 30);
 _ = ReportProgress(vid);
 }
 
 IsBusyMessage = "Importing Frames";
 NotifyPropertyChanged(nameof(IsBusyMessage)); 
 await System.Threading.Tasks.Task.WhenAll(extractFramesTask); 
 }
</splicemodel>