
Recherche avancée
Médias (1)
-
Revolution of Open-source and film making towards open film making
6 octobre 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (111)
-
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)
Sur d’autres sites (5716)
-
Piwik Analytics and becoming a Piwik Certified Professional
10 juillet 2017, par Piwik Core Team — AboutDigital Analytics software
Piwik Analytics is the leading open source digital analytics software, offering users around the world an opportunity to liberate their analytics. Most recently, they have introduced the Piwik Certified Professional certification exam which now allows users to become qualified in Piwik Analytics software on an individual level to gain a deeper understanding of Piwik. In this blog post I will guide you through the topics that are covered during the exam and provide you with advice on taking the official Piwik Certified Professional exam.
Piwik certification exam
Taking the exam will cost you a maximum investment of 60 minutes of your time, besides learning all materials of course. The exam consists of 55 multiple choice questions with four answers to choose from. The score needed to pass is 80% (44 questions answered correctly) and the cost is 50 USD total. An earned certificate is valid for 18 months, before these eighteen months are over a person should pass the exam again in order to retain the certified status.
Learning topics
The exam consists of two sections. The main section is focused on the Piwik Analytics software itself while the second part relates to digital analytics in general. All topics and content covered about Piwik Analytics is available through the official Piwik user guides. The second section tests your experience as a digital analyst, online marketer or any other function title in which you work with Piwik Analytics. In this case, the general digital analytics questions should be quite straightforward and easy to answer, and cover only a fraction of the total questions in the exam (around 10% with 5-7 general questions). An outline of all exam topics are listed below :
- A Tour of Piwik
- Track Goals and Measure Conversions
- Event Tracking
- Content Tracking
- Ecommerce Analytics
- Row Evolution – View and compare historical data
- Segmentation – Compare segments of visitors
- Visitors Maps – World, region, city
- Real Time Visitor World Map
- Real Time Analytics
- The Visitor Profile
- Site speed and Page speed
- Site Search Tracking and Reporting
- Transitions – Analyze the previous and following actions of your visitors for each page
- Page Overlay
- Custom Variables Analytics
- Custom Dimensions
- User ID
- Annotating your data
- Tracking Campaigns
- URL Builder for Marketing Campaign Tracking
The best way to prepare for the exam is read the entire Piwik user guides. You should definitely read the “Analytics Features” section since most questions of the Piwik Certified Professional – Digital Analytics exam that will be asked come from these sections. Furthermore you should be able to find your way around in Piwik at a basic level which means you know what the reports mean and where to find certain information. In addition, some basic knowledge regarding the settings is useful too. The exam is definitely not a technical implementation exam so no coding knowledge or any other deeply technical knowledge regarding Piwik is required.
Finally, some general questions will be asked regarding digital analytics covering topics about KPI’s and the role of the analyst within an organization. While Piwik provides some links to articles by Avinash Kaushik covering these topics, you will not be able to learn these topics just by reading. When you have some experience with digital analytics you should be able to answer these general digital analytics questions with common sense and (even basic) experience as a digital analyst, analytics consultant, online marketer or any other related job whereby you work with Piwik.
Taking the exam
With 55 questions to be answered in 60 minutes the key to passing the exam is to keep moving. You have about 1 minute and 5 seconds to answer each question. This means that you should focus on the easiest questions first and return later to the questions that are a bit more challenging to answer. Keep an eye on the timer that will be displayed in the exam window. When the time expires or you click ‘Finish test’ your exam will end and be automatically submitted for review. Remember to first check all questions and answers before you click on the ‘Finish test’ button. If you click too soon and you still haven’t answered all questions, all unanswered questions will be marked as incorrect.
During the test, no hard copy or online materials may be referenced. As you can imagine, it is almost impossible to check if users reference these kind of materials. However, be aware of the penalty system that is in place during the test. When a user leaves from the active test screen to another screen (i.e. a different browser tab) the screen turns red and provides a warning count when the user returns to the test screen again. You will have three warnings, after this your test will be submitted and graded as false. Furthermore, keep in mind you will have to do the test in one go and cannot pause and come back another time.
Practice makes perfect
Below I have included some example questions that could be asked during the exam. These questions do not necessarily represent how Piwik will test you on these topics.
- What is the default report date that is selected by Piwik ?
- Why would someone flatten a report in Piwik ?
- Why would a user especially use the Page Overlay report ?
- What are the three main Ecommerce interactions tracked with Piwik ?
- What is an example of an anonymized IP address in Piwik ?
Passing the Piwik Certified Professional – Digital Analytics exam
Directly after submitting the exam you will receive a notification telling you whether or not you have passed the exam. If you pass, you will be able to download your personal certification right away. A report of your exam performance will also be available. This report lists the amount of correct answers and total questions by topic. The report with your exam performance is also available if you did not pass the exam. The certificate is valid for 18 months from the date of successful completion.
Sometimes the difference between passing and failing can be a matter of how you interpret some of Piwik’s questions. There are several tricky questions included, so be sure to pay attention to detail on every question. If you fail, you may take the exam again. You will have to pay the 50 USD fee for each try, so do your best to pass it the first time.
→ Register to become a Piwik Certified Professional.
We wish you the best of luck and happy analytics !
-
Is there a way to extract frames from a video file using ffmpeg to memory and make some manipulation on each frame ?
28 octobre 2022, par Rojer BriefThe goal is to extract each time a frame from the video file then make histogram from the image and then to move to the next frame. this way all the frames.


The frames extraction and the histogram manipulation is working fine when the frames have saved as images on the hard disk. but now i want to do it all in memory.


to extract the frames i'm using ffmpeg because i think it's fast enough :


ffmpeg -r 1 -i MyVid.mp4 -r 1 "$filename%03d.png



for now i'm using the ffmpeg in command prompt window.


with this command it will save on the hard disk over 65000 images(frames).
but instead saving them on the hard disk i wonder if i can make the histogram manipulation on each frame in memory instead saving all the 65000 frames to the hard disk.


then i want to find specific images using the histogram and save to the hard disk this frames.


the histogram part for now is also using files from the hard disk and not from the memory :


private void btnLoadHistogram_Click(object sender, System.EventArgs e)
 {
 string[] files = Directory.GetFiles(@"d:\screenshots\", "*.jpg");

 for (int i = 0; i < files.Length; i++)
 {
 sbInfo.Text = "Loading image";
 if (pbImage.Image != null)
 pbImage.Image.Dispose();

 pbImage.Image = Image.FromFile(files[i]);//txtFileName.Text);

 Application.DoEvents();

 sbInfo.Text = "Computing histogram";
 long[] myValues = GetHistogram(new Bitmap(pbImage.Image));

 Histogram.DrawHistogram(myValues);

 sbInfo.Text = ""; 
 } 
 }

 public long[] GetHistogram(System.Drawing.Bitmap picture)
 {
 long[] myHistogram = new long[256];

 for (int i=0;i3;
 myHistogram[Temp]++;
 }

 return myHistogram;
 }



and the code of the class of the constrol HistogramaDesenat :


using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace Histograma
{
 /// <summary>
 /// Summary description for HistogramaDesenat.
 /// </summary>
 public class HistogramaDesenat : System.Windows.Forms.UserControl
 {
 /// <summary> 
 /// Required designer variable.
 /// </summary>
 private System.ComponentModel.Container components = null;

 public HistogramaDesenat()
 {
 // This call is required by the Windows.Forms Form Designer.
 InitializeComponent();

 // TODO: Add any initialization after the InitializeComponent call

 this.Paint += new PaintEventHandler(HistogramaDesenat_Paint);
 this.Resize+=new EventHandler(HistogramaDesenat_Resize);
 }

 /// <summary> 
 /// Clean up any resources being used.
 /// </summary>
 protected override void Dispose( bool disposing )
 {
 if( disposing )
 {
 if(components != null)
 {
 components.Dispose();
 }
 }
 base.Dispose( disposing );
 }

 #region Component Designer generated code
 /// <summary> 
 /// Required method for Designer support - do not modify 
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
 // 
 // HistogramaDesenat
 // 
 this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
 this.Name = "HistogramaDesenat";
 this.Size = new System.Drawing.Size(208, 176);
 }
 #endregion

 private void HistogramaDesenat_Paint(object sender, PaintEventArgs e)
 {
 if (myIsDrawing)
 {

 Graphics g = e.Graphics;
 Pen myPen = new Pen(new SolidBrush(myColor),myXUnit);
 //The width of the pen is given by the XUnit for the control.
 for (int i=0;i/We draw each line 
 g.DrawLine(myPen,
 new PointF(myOffset + (i*myXUnit), this.Height - myOffset), 
 new PointF(myOffset + (i*myXUnit), this.Height - myOffset - myValues[i] * myYUnit));

 //We plot the coresponding index for the maximum value.
 if (myValues[i]==myMaxValue)
 {
 SizeF mySize = g.MeasureString(i.ToString(),myFont);

 g.DrawString(i.ToString(),myFont,new SolidBrush(myColor),
 new PointF(myOffset + (i*myXUnit) - (mySize.Width/2), this.Height - myFont.Height ),
 System.Drawing.StringFormat.GenericDefault);
 }
 }

 //We draw the indexes for 0 and for the length of the array beeing plotted
 g.DrawString("0",myFont, new SolidBrush(myColor),new PointF(myOffset,this.Height - myFont.Height),System.Drawing.StringFormat.GenericDefault);
 g.DrawString((myValues.Length-1).ToString(),myFont, 
 new SolidBrush(myColor),
 new PointF(myOffset + (myValues.Length * myXUnit) - g.MeasureString((myValues.Length-1).ToString(),myFont).Width,
 this.Height - myFont.Height),
 System.Drawing.StringFormat.GenericDefault);

 //We draw a rectangle surrounding the control.
 g.DrawRectangle(new System.Drawing.Pen(new SolidBrush(Color.Black),1),0,0,this.Width-1,this.Height-1);
 }

 }

 long myMaxValue;
 private long[] myValues;
 private bool myIsDrawing;

 private float myYUnit; //this gives the vertical unit used to scale our values
 private float myXUnit; //this gives the horizontal unit used to scale our values
 private int myOffset = 20; //the offset, in pixels, from the control margins.

 private Color myColor = Color.Black;
 private Font myFont = new Font("Tahoma",10);

 [Category("Histogram Options")]
 [Description ("The distance from the margins for the histogram")]
 public int Offset
 {
 set
 {
 if (value>0)
 myOffset= value;
 }
 get
 {
 return myOffset;
 }
 }

 [Category("Histogram Options")]
 [Description ("The color used within the control")]
 public Color DisplayColor
 {
 set
 {
 myColor = value;
 }
 get
 {
 return myColor;
 }
 }

 /// <summary>
 /// We draw the histogram on the control
 /// </summary>
 /// The values beeing draw
 public void DrawHistogram(long[] Values)
 {
 myValues = new long[Values.Length];
 Values.CopyTo(myValues,0);

 myIsDrawing = true;
 myMaxValue = getMaxim(myValues);

 ComputeXYUnitValues();

 this.Refresh();
 }

 /// <summary>
 /// We get the highest value from the array
 /// </summary>
 /// The array of values in which we look
 /// <returns>The maximum value</returns>
 private long getMaxim(long[] Vals)
 {
 if (myIsDrawing)
 {
 long max = 0;
 for (int i=0;i max)
 max = Vals[i];
 }
 return max;
 }
 return 1;
 }

 private void HistogramaDesenat_Resize(object sender, EventArgs e)
 {
 if (myIsDrawing)
 {
 ComputeXYUnitValues();
 }
 this.Refresh();
 }

 private void ComputeXYUnitValues()
 {
 myYUnit = (float) (this.Height - (2 * myOffset)) / myMaxValue;
 myXUnit = (float) (this.Width - (2 * myOffset)) / (myValues.Length-1);
 }
 }
}



so in the end this is what i want to do :


- 

-
extract the frames from the video file in memory using the ffmpeg.


-
instead using Directory.GetFiles i want to make the histogram manipulation on each frame from the memory that is extracted by the ffmpeg.


-
each extracted frame image to use the histogram to find if there is a lightning(weather lightning) in the image.


-
if there is a lightning save the frame image to the hard disk.












-
-
SegFault while freeing nvenc hwdevice_ctx
23 février 2024, par camelCaseFor a project, I created a class encoding the output of an OpenGL
renderbuffer
object usingh264_nvenc
. Unfortunately, tidying up doesn't work, and the program crashes with a SegFault. The reason is accessing an unaccessable memory region, happening twice in the final lines (see below) when callingav_buffer_unref( &_hwDeviceRefCtx )
and implicitely also duringavcodec_free_context( &_pCodecCtx )
, but both calls are required for shutting down.

The (in this case relevant)
valgrind
-output is

Invalid read of size 8
 at 0x48AD987: UnknownInlinedFun (buffer.c:121)
 by 0x48AD987: UnknownInlinedFun (buffer.c:144)
 by 0x48AD987: av_buffer_unref (buffer.c:139)
 by 0x5D06D7A: avcodec_close (avcodec.c:486)
 by 0x628DD7D: avcodec_free_context (options.c:175)
 by 0x10A863: main (main.cpp:115)
 Address 0x17812700 is 0 bytes inside a block of size 24 free'd
 at 0x484488F: free (vg_replace_malloc.c:985)
 by 0x48AD98F: UnknownInlinedFun (buffer.c:127)
 by 0x48AD98F: UnknownInlinedFun (buffer.c:144)
 by 0x48AD98F: av_buffer_unref (buffer.c:139)
 by 0x48BE098: hwframe_ctx_free (hwcontext.c:240)
 by 0x48AD9A6: UnknownInlinedFun (buffer.c:133)
 by 0x48AD9A6: UnknownInlinedFun (buffer.c:144)
 by 0x48AD9A6: av_buffer_unref (buffer.c:139)
 by 0x5D06D0A: UnknownInlinedFun (decode.c:1261)
 by 0x5D06D0A: avcodec_close (avcodec.c:465)
 by 0x628DD7D: avcodec_free_context (options.c:175)
 by 0x10A863: main (main.cpp:115)
 Block was alloc'd at
 at 0x4849366: posix_memalign (vg_replace_malloc.c:2099)
 by 0x48D9BD5: av_malloc (mem.c:105)
 by 0x48D9DAD: av_mallocz (mem.c:256)
 by 0x48AD8DD: UnknownInlinedFun (buffer.c:44)
 by 0x48AD8DD: av_buffer_create (buffer.c:64)
 by 0x48BDDEB: av_hwdevice_ctx_alloc (hwcontext.c:179)
 by 0x48BDF29: av_hwdevice_ctx_create (hwcontext.c:622)
 by 0x10A482: main (main.cpp:43)

Invalid free() / delete / delete[] / realloc()
 at 0x484488F: free (vg_replace_malloc.c:985)
 by 0x48AD98F: UnknownInlinedFun (buffer.c:127)
 by 0x48AD98F: UnknownInlinedFun (buffer.c:144)
 by 0x48AD98F: av_buffer_unref (buffer.c:139)
 by 0x5D06D7A: avcodec_close (avcodec.c:486)
 by 0x628DD7D: avcodec_free_context (options.c:175)
 by 0x10A863: main (main.cpp:115)
 Address 0x17812700 is 0 bytes inside a block of size 24 free'd
 at 0x484488F: free (vg_replace_malloc.c:985)
 by 0x48AD98F: UnknownInlinedFun (buffer.c:127)
 by 0x48AD98F: UnknownInlinedFun (buffer.c:144)
 by 0x48AD98F: av_buffer_unref (buffer.c:139)
 by 0x48BE098: hwframe_ctx_free (hwcontext.c:240)
 by 0x48AD9A6: UnknownInlinedFun (buffer.c:133)
 by 0x48AD9A6: UnknownInlinedFun (buffer.c:144)
 by 0x48AD9A6: av_buffer_unref (buffer.c:139)
 by 0x5D06D0A: UnknownInlinedFun (decode.c:1261)
 by 0x5D06D0A: avcodec_close (avcodec.c:465)
 by 0x628DD7D: avcodec_free_context (options.c:175)
 by 0x10A863: main (main.cpp:115)
 Block was alloc'd at
 at 0x4849366: posix_memalign (vg_replace_malloc.c:2099)
 by 0x48D9BD5: av_malloc (mem.c:105)
 by 0x48D9DAD: av_mallocz (mem.c:256)
 by 0x48AD8DD: UnknownInlinedFun (buffer.c:44)
 by 0x48AD8DD: av_buffer_create (buffer.c:64)
 by 0x48BDDEB: av_hwdevice_ctx_alloc (hwcontext.c:179)
 by 0x48BDF29: av_hwdevice_ctx_create (hwcontext.c:622)
 by 0x10A482: main (main.cpp:43)



that is also duplicated (due to the calls to
avcodec_free_context()
andav_buffer_unref()
).

The question is : How can I fix this ?


The (more or less) minimal (not) working example reads


#include <string>

extern "C" {
 #include <libavutil></libavutil>opt.h>
 #include <libavcodec></libavcodec>avcodec.h>
 #include <libavformat></libavformat>avformat.h>
 #include <libavutil></libavutil>hwcontext.h>
 #include <libavutil></libavutil>pixdesc.h>
 #include <libavutil></libavutil>hwcontext_cuda.h>
}

//(former) libx264 encoding based on https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/muxing.c
//update to h264_nvenc with a lot of help from https://stackoverflow.com/questions/49862610/opengl-to-ffmpeg-encode
//and some additional info of https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/vaapi_encode.c

int main() {
 const int _SrcImageWidth=640;
 const int _SrcImageHeight=480;
 
 const AVOutputFormat *_oFmt = nullptr;
 AVFormatContext *_oFmtCtx = nullptr;
 
 const AVCodec *_pCodec = nullptr;
 AVCodecContext *_pCodecCtx = nullptr;
 
 AVFrame* _frame;
 AVPacket* _packet;
 AVStream* _stream;
 
 AVBufferRef *_hwDeviceRefCtx = nullptr;
 const CUcontext* _cudaCtx;
 
 const std::string _OutFileName = "output.mkv";
 
 //constructor part
 int ret;

 //output format context 
 avformat_alloc_output_context2( &_oFmtCtx, nullptr, nullptr, _OutFileName.c_str() );
 _oFmt = _oFmtCtx->oformat;

 //hardware format context
 ret = av_hwdevice_ctx_create( &_hwDeviceRefCtx, AV_HWDEVICE_TYPE_CUDA, "NVIDIA GeForce RTX 4070", nullptr, 0 );

 //hardware frame context for device buffer allocation
 AVBufferRef* hwFrameRefCtx = av_hwframe_ctx_alloc( _hwDeviceRefCtx );
 AVHWFramesContext* hwFrameCtx = (AVHWFramesContext*) (hwFrameRefCtx->data);
 hwFrameCtx->width = _SrcImageWidth;
 hwFrameCtx->height = _SrcImageHeight;
 hwFrameCtx->sw_format = AV_PIX_FMT_0BGR32;
 hwFrameCtx->format = AV_PIX_FMT_CUDA;
 hwFrameCtx->device_ref = _hwDeviceRefCtx;
 hwFrameCtx->device_ctx = (AVHWDeviceContext*) _hwDeviceRefCtx->data;

 ret = av_hwframe_ctx_init( hwFrameRefCtx );

 //get cuda context
 const AVHWDeviceContext* hwDeviceCtx = (AVHWDeviceContext*)(_hwDeviceRefCtx->data);
 const AVCUDADeviceContext* cudaDeviceCtx = (AVCUDADeviceContext*)(hwDeviceCtx->hwctx);
 _cudaCtx = &(cudaDeviceCtx->cuda_ctx);

 //codec context
 _pCodec = avcodec_find_encoder_by_name( "h264_nvenc" );

 _packet = av_packet_alloc();

 _stream = avformat_new_stream( _oFmtCtx, nullptr );
 _stream->id = _oFmtCtx->nb_streams - 1;
 _pCodecCtx = avcodec_alloc_context3( _pCodec );

 _pCodecCtx->qmin = 18;
 _pCodecCtx->qmax = 20;
 _pCodecCtx->width = _SrcImageWidth;
 _pCodecCtx->height = _SrcImageHeight;
 _pCodecCtx->framerate = (AVRational) {25,1};
 _pCodecCtx->time_base = (AVRational) {1,25};
 _stream->time_base = _pCodecCtx->time_base;
 _pCodecCtx->gop_size = 12; //I-Frame every at most 12 frames
 _pCodecCtx->max_b_frames = 2;
 _pCodecCtx->pix_fmt = AV_PIX_FMT_CUDA; //required to use renderbuffer as src
 _pCodecCtx->codec_type = AVMEDIA_TYPE_VIDEO;
 _pCodecCtx->sw_pix_fmt = AV_PIX_FMT_0BGR32; 
 _pCodecCtx->hw_device_ctx = _hwDeviceRefCtx;
 _pCodecCtx->hw_frames_ctx = av_buffer_ref( hwFrameRefCtx );
 av_opt_set(_pCodecCtx->priv_data, "preset", "p7", 0);
 av_opt_set(_pCodecCtx->priv_data, "rc", "vbr", 0);
 if( _oFmtCtx->oformat->flags & AVFMT_GLOBALHEADER ) {
 _pCodecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
 }

 ret = avcodec_open2( _pCodecCtx, _pCodec, nullptr );
 avcodec_parameters_from_context( _stream->codecpar, _pCodecCtx );

 if (!(_oFmtCtx->oformat->flags & AVFMT_NOFILE)) {
 ret = avio_open(&_oFmtCtx->pb, _OutFileName.c_str(), AVIO_FLAG_WRITE);
 }
 ret = avformat_write_header( _oFmtCtx, nullptr );

 //use hardware frame from above
 _frame = av_frame_alloc();
 ret = av_hwframe_get_buffer( _pCodecCtx->hw_frames_ctx, _frame, 0 );
 _frame->pts = 1;

 av_buffer_unref( &hwFrameRefCtx );

 //destructor part
 av_frame_free( &_frame );
 av_packet_free( &_packet );

 av_write_trailer( _oFmtCtx );
 avio_closep( &_oFmtCtx->pb );

 avformat_free_context( _oFmtCtx );

 avcodec_free_context( &_pCodecCtx );
 av_buffer_unref( &_hwDeviceRefCtx );

 return 0;
}
</string>


and compiles with (linux user)


g++ -lavutil -lavformat -lavcodec -lz -lavutil -lswscale -lswresample -lm -ggdb3 -I/opt/cuda/include main.cpp



Thanks in advance !