Recherche avancée

Médias (3)

Mot : - Tags -/spip

Autres articles (53)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

Sur d’autres sites (10279)

  • Linker error by trying example program with ffmpeg

    11 mars, par Chris

    I think this might be a stupid question and I'm just blind but that thing is driving me nuts for hours now.
I downloaded ffmpeg and build it. Now I want to try the thing out in a program but I can't setup cmake to link ffmpeg properly and have no idea what is wrong.

    


    The linker always tells me this :

    


    christoph@christoph-ThinkPad-T490:~/develop/ffmpg_example/build$ make
[ 50%] Linking CXX executable test
CMakeFiles/test.dir/main.cxx.o: In function `main':
main.cxx:(.text+0x180): undefined reference to `av_register_all()'
main.cxx:(.text+0x1a7): undefined reference to `avformat_open_input(AVFormatContext**, char const*, AVInputFormat*, AVDictionary**)'
main.cxx:(.text+0x1ce): undefined reference to `avformat_find_stream_info(AVFormatContext*, AVDictionary**)'
main.cxx:(.text+0x206): undefined reference to `av_dump_format(AVFormatContext*, int, char const*, int)'
main.cxx:(.text+0x2bb): undefined reference to `avcodec_find_decoder(AVCodecID)'
main.cxx:(.text+0x2fc): undefined reference to `avcodec_alloc_context3(AVCodec const*)'
main.cxx:(.text+0x316): undefined reference to `avcodec_copy_context(AVCodecContext*, AVCodecContext const*)'
main.cxx:(.text+0x361): undefined reference to `avcodec_open2(AVCodecContext*, AVCodec const*, AVDictionary**)'
main.cxx:(.text+0x377): undefined reference to `av_frame_alloc()'
main.cxx:(.text+0x383): undefined reference to `av_frame_alloc()'
main.cxx:(.text+0x3ba): undefined reference to `avpicture_get_size(AVPixelFormat, int, int)'
main.cxx:(.text+0x3d0): undefined reference to `av_malloc(unsigned long)'
main.cxx:(.text+0x3ff): undefined reference to `avpicture_fill(AVPicture*, unsigned char const*, AVPixelFormat, int, int)'
main.cxx:(.text+0x43d): undefined reference to `sws_getContext(int, int, AVPixelFormat, int, int, AVPixelFormat, int, SwsFilter*, SwsFilter*, double const*)'
main.cxx:(.text+0x465): undefined reference to `av_read_frame(AVFormatContext*, AVPacket*)'
main.cxx:(.text+0x49f): undefined reference to `avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, AVPacket const*)'
main.cxx:(.text+0x4fd): undefined reference to `sws_scale(SwsContext*, unsigned char const* const*, int const*, int, int, unsigned char* const*, int const*)'
main.cxx:(.text+0x545): undefined reference to `av_free_packet(AVPacket*)'
main.cxx:(.text+0x556): undefined reference to `av_free(void*)'
main.cxx:(.text+0x565): undefined reference to `av_frame_free(AVFrame**)'
main.cxx:(.text+0x574): undefined reference to `av_frame_free(AVFrame**)'
main.cxx:(.text+0x580): undefined reference to `avcodec_close(AVCodecContext*)'
main.cxx:(.text+0x58f): undefined reference to `avcodec_close(AVCodecContext*)'
main.cxx:(.text+0x59e): undefined reference to `avformat_close_input(AVFormatContext**)'
collect2: error: ld returned 1 exit status
CMakeFiles/test.dir/build.make:87: recipe for target 'test' failed
make[2]: *** [test] Error 1
CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/test.dir/all' failed
make[1]: *** [CMakeFiles/test.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2


    


    The cmake list looks like this :

    


    cmake_minimum_required(VERSION 3.16)

project(ffmpeg_test)

add_library(avformat STATIC IMPORTED)
set_target_properties(avformat
    PROPERTIES IMPORTED_LOCATION /home/christoph/develop/FFmpeg/build/lib/libavformat.a
)
add_library(avcodec STATIC IMPORTED)
set_target_properties(avcodec
    PROPERTIES IMPORTED_LOCATION /home/christoph/develop/FFmpeg/build/lib/libavcodec.a
)
add_library(swscale STATIC IMPORTED)
set_target_properties(swscale
    PROPERTIES IMPORTED_LOCATION /home/christoph/develop/FFmpeg/build/lib/libswscale.a
)
add_library(avutil STATIC IMPORTED)
set_target_properties(avutil
    PROPERTIES IMPORTED_LOCATION /home/christoph/develop/FFmpeg/build/lib/libavutil.a
)
add_executable(test main.cxx)

target_link_libraries(test PRIVATE
    /home/christoph/develop/FFmpeg/build/lib/libavformat.a
    avcodec
    swscale
    avutil
)
target_include_directories(test PRIVATE /home/christoph/develop/FFmpeg/build/include)


    


    And here are the ffmpeg libs :

    


    christoph@christoph-ThinkPad-T490:~/develop/FFmpeg/build/lib$ ll
total 277840
drwxr-xr-x  3 christoph christoph      4096 Dez  7 23:59 ./
drwxr-xr-x 17 christoph christoph      4096 Dez  7 23:59 ../
-rw-r--r--  1 christoph christoph 173479270 Dez  7 23:59 libavcodec.a
-rw-r--r--  1 christoph christoph   2174910 Dez  7 23:59 libavdevice.a
-rw-r--r--  1 christoph christoph  37992438 Dez  7 23:59 libavfilter.a
-rw-r--r--  1 christoph christoph  59222040 Dez  7 23:59 libavformat.a
-rw-r--r--  1 christoph christoph   4759514 Dez  7 23:59 libavutil.a
-rw-r--r--  1 christoph christoph    695698 Dez  7 23:59 libswresample.a
-rw-r--r--  1 christoph christoph   6164398 Dez  7 23:59 libswscale.a
drwxr-xr-x  2 christoph christoph      4096 Dez  7 23:59 pkgconfig/


    


    And this is the example code :

    


    #include&#xA;&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;&#xA;// compatibility with newer API&#xA;#if LIBAVCODEC_VERSION_INT &lt; AV_VERSION_INT(55,28,1)&#xA;#define av_frame_alloc avcodec_alloc_frame&#xA;#define av_frame_free avcodec_free_frame&#xA;#endif&#xA;&#xA;void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame) {&#xA;  FILE *pFile;&#xA;  char szFilename[32];&#xA;  int  y;&#xA;  &#xA;  // Open file&#xA;  sprintf(szFilename, "frame%d.ppm", iFrame);&#xA;  pFile=fopen(szFilename, "wb");&#xA;  if(pFile==NULL)&#xA;    return;&#xA;  &#xA;  // Write header&#xA;  fprintf(pFile, "P6\n%d %d\n255\n", width, height);&#xA;  &#xA;  // Write pixel data&#xA;  for(y=0; ydata[0]&#x2B;y*pFrame->linesize[0], 1, width*3, pFile);&#xA;  &#xA;  // Close file&#xA;  fclose(pFile);&#xA;}&#xA;&#xA;int main(int argc, char *argv[]) {&#xA;  // Initalizing these to NULL prevents segfaults!&#xA;  AVFormatContext   *pFormatCtx = NULL;&#xA;  int               i, videoStream;&#xA;  AVCodecContext    *pCodecCtxOrig = NULL;&#xA;  AVCodecContext    *pCodecCtx = NULL;&#xA;  AVCodec           *pCodec = NULL;&#xA;  AVFrame           *pFrame = NULL;&#xA;  AVFrame           *pFrameRGB = NULL;&#xA;  AVPacket          packet;&#xA;  int               frameFinished;&#xA;  int               numBytes;&#xA;  uint8_t           *buffer = NULL;&#xA;  struct SwsContext *sws_ctx = NULL;&#xA;&#xA;  if(argc &lt; 2) {&#xA;    printf("Please provide a movie file\n");&#xA;    return -1;&#xA;  }&#xA;  // Register all formats and codecs&#xA;  av_register_all();&#xA;  &#xA;  // Open video file&#xA;  if(avformat_open_input(&amp;pFormatCtx, argv[1], NULL, NULL)!=0)&#xA;    return -1; // Couldn&#x27;t open file&#xA;  &#xA;  // Retrieve stream information&#xA;  if(avformat_find_stream_info(pFormatCtx, NULL)&lt;0)&#xA;    return -1; // Couldn&#x27;t find stream information&#xA;  &#xA;  // Dump information about file onto standard error&#xA;  av_dump_format(pFormatCtx, 0, argv[1], 0);&#xA;  &#xA;  // Find the first video stream&#xA;  videoStream=-1;&#xA;  for(i=0; inb_streams; i&#x2B;&#x2B;)&#xA;    if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) {&#xA;      videoStream=i;&#xA;      break;&#xA;    }&#xA;  if(videoStream==-1)&#xA;    return -1; // Didn&#x27;t find a video stream&#xA;  &#xA;  // Get a pointer to the codec context for the video stream&#xA;  pCodecCtxOrig=pFormatCtx->streams[videoStream]->codec;&#xA;  // Find the decoder for the video stream&#xA;  pCodec=avcodec_find_decoder(pCodecCtxOrig->codec_id);&#xA;  if(pCodec==NULL) {&#xA;    fprintf(stderr, "Unsupported codec!\n");&#xA;    return -1; // Codec not found&#xA;  }&#xA;  // Copy context&#xA;  pCodecCtx = avcodec_alloc_context3(pCodec);&#xA;  if(avcodec_copy_context(pCodecCtx, pCodecCtxOrig) != 0) {&#xA;    fprintf(stderr, "Couldn&#x27;t copy codec context");&#xA;    return -1; // Error copying codec context&#xA;  }&#xA;&#xA;  // Open codec&#xA;  if(avcodec_open2(pCodecCtx, pCodec, NULL)&lt;0)&#xA;    return -1; // Could not open codec&#xA;  &#xA;  // Allocate video frame&#xA;  pFrame=av_frame_alloc();&#xA;  &#xA;  // Allocate an AVFrame structure&#xA;  pFrameRGB=av_frame_alloc();&#xA;  if(pFrameRGB==NULL)&#xA;    return -1;&#xA;&#xA;  // Determine required buffer size and allocate buffer&#xA;  numBytes=avpicture_get_size(AV_PIX_FMT_RGB24, pCodecCtx->width,&#xA;                  pCodecCtx->height);&#xA;  buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));&#xA;  &#xA;  // Assign appropriate parts of buffer to image planes in pFrameRGB&#xA;  // Note that pFrameRGB is an AVFrame, but AVFrame is a superset&#xA;  // of AVPicture&#xA;  avpicture_fill((AVPicture *)pFrameRGB, buffer, AV_PIX_FMT_RGB24,&#xA;         pCodecCtx->width, pCodecCtx->height);&#xA;  &#xA;  // initialize SWS context for software scaling&#xA;  sws_ctx = sws_getContext(pCodecCtx->width,&#xA;               pCodecCtx->height,&#xA;               pCodecCtx->pix_fmt,&#xA;               pCodecCtx->width,&#xA;               pCodecCtx->height,&#xA;               AV_PIX_FMT_RGB24,&#xA;               SWS_BILINEAR,&#xA;               NULL,&#xA;               NULL,&#xA;               NULL&#xA;               );&#xA;&#xA;  // Read frames and save first five frames to disk&#xA;  i=0;&#xA;  while(av_read_frame(pFormatCtx, &amp;packet)>=0) {&#xA;    // Is this a packet from the video stream?&#xA;    if(packet.stream_index==videoStream) {&#xA;      // Decode video frame&#xA;      avcodec_decode_video2(pCodecCtx, pFrame, &amp;frameFinished, &amp;packet);&#xA;      &#xA;      // Did we get a video frame?&#xA;      if(frameFinished) {&#xA;    // Convert the image from its native format to RGB&#xA;    sws_scale(sws_ctx, (uint8_t const * const *)pFrame->data,&#xA;          pFrame->linesize, 0, pCodecCtx->height,&#xA;          pFrameRGB->data, pFrameRGB->linesize);&#xA;    &#xA;    // Save the frame to disk&#xA;    if(&#x2B;&#x2B;i&lt;=5)&#xA;      SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, &#xA;            i);&#xA;      }&#xA;    }&#xA;    &#xA;    // Free the packet that was allocated by av_read_frame&#xA;    av_free_packet(&amp;packet);&#xA;  }&#xA;  &#xA;  // Free the RGB image&#xA;  av_free(buffer);&#xA;  av_frame_free(&amp;pFrameRGB);&#xA;  &#xA;  // Free the YUV frame&#xA;  av_frame_free(&amp;pFrame);&#xA;  &#xA;  // Close the codecs&#xA;  avcodec_close(pCodecCtx);&#xA;  avcodec_close(pCodecCtxOrig);&#xA;&#xA;  // Close the video file&#xA;  avformat_close_input(&amp;pFormatCtx);&#xA;  &#xA;  return 0;&#xA;}&#xA;

    &#xA;

  • How to increase conversions to meet your business goals

    8 septembre 2020, par Joselyn Khor — Analytics Tips, Marketing

     Through optimizing your messaging, content, or your page layouts, you can increase conversions by getting your visitors through a clear pathway to achieve your business goals.

    Conversion Rate Optimization

    When we talk about optimizing websites to improve and increase conversions, we’re really talking about conversion rate optimization (CRO).

    CRO is the process of learning what the most valuable content/aspect of your website is and how to best optimize this for your visitors to increase its chance to convert. It typically involves generating ideas for elements on your site or app that can be improved, learning which pathways visitors are most likely going to take to conversion and then validating those assumptions through A/B testing and multivariate testing to transform learning into actionable insights.

    Conversion Rate

    The conversion rate is expressed as a % and the goal for any business should be to increase the % of conversions for any given goal e.g. in February a website had 200 newsletter sign-ups from 1,000 visitors on its sign-up page, a conversion rate of 20%. CRO should be used to increase the sign-up rate from 20% to 25%, and then eventually from 25% to 30% and so on.

    CRO cheat sheet

    You need to consider your website or business’ objectives (bigger picture) as well as your website goals (smaller achievements). Whatever the aim of your website, it’s crucial for this to be your starting point. Figure out what you want your website to do and what you want visitors to get from it. When you do that, you’ll know what conversions to focus on.
    • Define your business/website’s objectives. Do you want the website to drive sales ? Is the website a hub to raise awareness for a charity ? Do you want to increase readership for your news site ?
    • Define what your conversion goals are. This helps you narrow your focus so you follow a path to meet your overall objectives. By defining these, you clarify for yourself the next actions you should take, such as wanting to funnel users through to a sign up landing page. Then you’ll need to optimize and test your sign up landing page. If conversions are low, then tweak it and measure the results until you find you’ve increased conversion rates.
    • Conversion goals can include :
      • Purchases in your ecommerce store
      • eBook downloads
      • Sign ups to your mailing list
      • Visitors successfully filling in a contact form
    • Figure out what your Key Performance Indicators (KPIs) are and the metrics you need to focus on to achieve them.

    1. Set goals

    “Make Sure Goals Are Clearly Understood. To prove the value of an analytics-focused company, any project you take on needs to have clear goals. If you don’t have a goal in mind you’ll fail. Everyone involved in the project needs to be aligned around the goals.”

    - Lean Analytics : Use Data to Build a Better Startup Faster

    A goal is the measure of a successful action that you want your visitors to take. The more goals you track, the more you can learn about behavioural changes as you implement and modify paths that lead to conversions over time.

    Matomo goal feature

    You’ll understand which channels and campaigns (SEO, PPC, newsletter, blogging etc.) are converting the best for your business, which cities/countries are most popular, what devices are working and how engaged your visitors are before converting. Learn more

    2. Set Heatmaps

    This is vital to show how your visitors are engaging with your website, blog pages, signup and sales pages. If you want to learn how your visitors really engage with your website to increase conversions, Heatmaps lets you see the results visually without any guesswork.

    Matomo's heatmaps feature

    By showing where your visitors try to click, move the mouse or how far down they’re scrolling on each page, you can effortlessly discover how your visitors truly engage with your most important web pages. Rather than guessing, rely on facts to prove if the changes you make actually improve your website or not. Learn more

    How to improve conversion rates with Heatmaps :

    • If you’ve got important information that will sell your service/product or bring you loyal followers, make sure it’s in the hot zones as shown in your heatmaps.
    • Try to rearrange parts of your pages to see if that increases engagement.
    • Make it easy for people to take important actions by having the CTA above-the-fold where 100% of visitors see it. Make sure you don’t clutter this section with too many messages or actions.
    • You can also identify areas to add links as heatmaps shows where people want to click.
    • Find what content is most popular on the page

    3. Session Recordings

    This is a conversion research technique where you learn what your users are trying to do and make sure your website is optimized to give them what they want. With Session Recordings you can playback all the interactions your visitors took on your website, such as clicks, mouse movements, scrolls, resizes, form interactions and page changes in a video. Truly understand how real visitors are using your website and what experiences they’re having.

    Also, by understanding what’s working you’re increasing the usability of your website, Session Recordings allow you to identify problem areas as well as where users are getting stuck. Learn more

    Session Recordings

    How to improve conversion rates with Session Recordings : For example, on a product landing page, you see your visitor highlighting specific words and putting it into search. With this you can observe what they’re trying to find and what they’re actually interested in. As you tweak the page to ensure what the visitor wants can be easily found, you’re taking steps to increase the chance for more conversions.

    4. A/B Testing

    Test anything and test anywhere to increase your conversions. Grow your website by comparing different versions of your landing pages to determine what works best for your users. Subtle tweaks across different versions of your landing pages can have a significant impact on converting incoming traffic.

    Matomo's a/b testing feature

    The changes for each landing page could be :

    • A different headline
    • Less copy vs more copy
    • Different calls-to-action
    • Colour schemes, forms, fonts, links, testimonials,
    • Or, it could be an entirely different page layout altogether.

    The idea is to see if either page A or page B (or C or D) was most successful in getting your visitors to the next step in the conversion funnel. Learn more

    How Matomo used A/B Testing : For our sign up page we tested three different CTAs and found how phrasing words differently could help improve conversion rates. Both “Start improving your websites” and “Start converting more users now” were stronger CTAs and converted 7% more than, “Start my free 30-day trial”.

    5. Form Analytics

    Form Analytics gives you powerful insights into how your visitors interact with your forms (like cart, sign-up and checkout forms).

    Form Analytics

    Online forms can come in thousands of different variations. It’s an area on your website that if not done right, could lead to you missing out on converting a large portion of your visitors. Rely on facts when you change your forms. Learn more

    How to improve conversion rates with Form Analytics : By proving whether your form is doing better when you change it and by how much. This lets you consistently increase form submission rates (conversions) on your website which is crucial to the success of your business.

    6. Funnels

    At a glance you will learn the steps (actions, events and pages) your users go through to the desired outcomes you want them to achieve whether it’s a sale, sign-up or any other particular goal you have defined.

    Funnels feature

    Looking at the entire conversion funnel and focusing on usability, you’ll be able to identify where your visitors are having problems, where they aren’t understanding the flow of your webpages and identify obstacles that get in the way of your users reaching that end goal. Learn more

    How to improve conversion rates with Funnels : Learn what makes your visitors take action (or what stops them) in progressing to the next step in the conversion funnel. At each step, you’ll discover what content/layout resonates with your visitors and you can optimize your website to have the greatest impact on your business.

    7. Behaviour

    This is one of the most important features to help you optimize your website for conversions. Learning visitor behaviour is a driving force to increase conversions. How ? It lets you identify where you could be taking action to increase conversions. You get to learn first-hand what content or feature on your site is or isn’t working for your visitors. 

    Behaviour feature

    Engagement is essential to help increase conversion rates. If your visitors aren’t interested in the content on your site, then there’s very little chance they’ll be interested in what you have to offer. Learn more

    How to improve conversion rates with Behaviour : Get started by reducing bounce rates on important pages, testing messaging on your most popular entry pages, testing on the highest exit pages to reduce visitors leaving the site, learning pathways through Users Flow and Transitions to see if users are taking pathways that lead them to conversions or are the journeys currently long or go in odd directions. Discover how your visitors are responding to your content. The happier your visitors are to stay on your site, the more likely they’ll be able to move through the journey to help you achieve the goals you’ve set for your site.

    Do privacy-focused industries need conversion optimization ?

    For industries that place extra emphasis on privacy and security, Matomo is a complete analytics tool that can cater for all your needs. You get the full benefits of a web analytics and conversion optimization platform as well as peace of mind knowing Matomo places emphasis on security/privacy and adheres strictly to GDPR.

    If you operate in a data sensitive industry like in government, healthcare, finance, education etc. you can rest assured knowing your user’s privacy is respected and that you will have 100% data ownership.

    Other conversion optimization metrics in Matomo to look at :

    Get a good indication that your conversion optimization efforts are working by knowing where to look and this starts by going through the metrics in your analytics. Below we list how you can make a start.

    “Best” metrics are hard to determine so you’ll need to ask yourself what you want your site to do. How do you want your users to behave or what kind of customer journey do you want them to have ?

    You can start with :

    • Decreasing abandonment rate
    • Decreasing bounce rate
    • Increasing interactions per visit
    • Reducing exit rates on pages that significantly impact your visitors to leave your site
    • Constantly test and learn what content resonates with your visitors
    • Look to advance more users through each stage of the conversion funnel
    • Improve your forms to increase submission rates
    • Always improve the conversion rate % for your goals e.g. if you currently have a 5% conversion rate for selling a product, aim for 10% ; if 30% of your visitors are downloading your e-book, then aim for 40%, then 50% and so on.

    Through optimizing your messaging, content or your page layouts, you will increase conversions by getting your visitors through a clear pathway to meet your website’s goal.

  • C++ ffmpeg and SDL2 video rendering memory leak

    10 avril 2017, par kj192

    I have made a small program what plays a video in SDL2.0 and FFmpeg.
    The software does work and do it is purpose.
    I have left the software running and I have faced a huge memory consumption and started to look online what can I do against it.
    I have used the following tutorials :
    http://www.developersite.org/906-59411-FFMPEG
    http://ardrone-ailab-u-tokyo.blogspot.co.uk/2012/07/212-ardrone-20-video-decording-ffmpeg.html

    I wonder if someone can give advice what do I do wrong. I have tried valgrind but I can’t find any information. I have did try to comment out sections and what I have seen even if I’m not rendering to the display the memory usage is growing and after delete something still not been freed up :

    if (av_read_frame(pFormatCtx, &amp;packet) >= 0)

    the whole source code is here :
    main :

    #include
    #include <ios>
    #include <iostream>
    #include <fstream>
    #include
    #include <sdl2></sdl2>SDL.h>
    #include "video.h"
    using namespace std;

    void memory()
    {
    using std::ios_base;
    using std::ifstream;
    using std::string;

    double vm_usage     = 0.0;
    double resident_set = 0.0;

    // 'file' stat seems to give the most reliable results
    //
    ifstream stat_stream("/proc/self/stat",ios_base::in);

    // dummy vars for leading entries in stat that we don't care about
    //
    string pid, comm, state, ppid, pgrp, session, tty_nr;
    string tpgid, flags, minflt, cminflt, majflt, cmajflt;
    string utime, stime, cutime, cstime, priority, nice;
    string O, itrealvalue, starttime;

    // the two fields we want
    //
    unsigned long vsize;
    long rss;

    stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr
               >> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt
               >> utime >> stime >> cutime >> cstime >> priority >> nice
               >> O >> itrealvalue >> starttime >> vsize >> rss; // don't care about the rest

    stat_stream.close();

    long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages
    vm_usage     = vsize / 1024.0;
    resident_set = rss * page_size_kb;
    std::cout&lt;&lt;"VM: " &lt;&lt; vm_usage &lt;&lt; " RE:"&lt;&lt; resident_set &lt;&lt; std::endl;
    }


    int main()
    {
    //This example using 1280x800 video
    av_register_all();
    if( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER ))
    {
       fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError());
       exit(1);
    }
    SDL_Window* sdlWindow = SDL_CreateWindow("Video Window", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1280, 800, SDL_WINDOW_OPENGL);
    if( !sdlWindow )
    {
       fprintf(stderr, "SDL: could not set video mode - exiting\n");
       exit(1);
    }
    SDL_Renderer* sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE);
    SDL_Texture* sdlTexture = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, 1280, 800);
    if(!sdlTexture)
    {
       return -1;
    }
    SDL_SetTextureBlendMode(sdlTexture,SDL_BLENDMODE_BLEND );
    //VIDEO RESOLUTION
    SDL_Rect sdlRect;
    sdlRect.x = 0;
    sdlRect.y = 0;
    sdlRect.w = 1280;
    sdlRect.h = 800;    
    memory();
    for(int i = 1; i &lt; 6; i++)
    {
       memory();  
       video* vid = new video("vid.mp4");  
       while (!vid -> getFinished())
       {
           memory();
           vid -> Update(sdlTexture);
           SDL_RenderCopy(sdlRenderer,sdlTexture,&amp;sdlRect,&amp;sdlRect);
           SDL_RenderPresent(sdlRenderer);
       }
       delete vid;
       memory();
    }  
    SDL_DestroyTexture(sdlTexture);
    SDL_DestroyRenderer(sdlRenderer);
    SDL_DestroyWindow(sdlWindow);
    SDL_Quit();
    return 0;
    }
    </fstream></iostream></ios>

    video.cpp

    #include "video.h"

    video::video(const std::string&amp; name) : _finished(false)
    {
    av_register_all();
    pFormatCtx = NULL;
    pCodecCtxOrig = NULL;
    pCodecCtx = NULL;
    pCodec = NULL;
    pFrame = NULL;
    sws_ctx = NULL;
    if (avformat_open_input(&amp;pFormatCtx, name.c_str(), NULL, NULL) != 0)
    {
    _finished = true; // Couldn't open file
    }
    // Retrieve stream information
    if (avformat_find_stream_info(pFormatCtx, NULL) &lt; 0)
    {
    _finished = true; // Couldn't find stream information
    }
    videoStream = -1;
    for (i = 0; i &lt; pFormatCtx->nb_streams; i++)
    {
       if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
       {
           videoStream = i;
           break;
       }
    }
    if (videoStream == -1)
    {
       _finished = true; // Didn't find a video stream
    }
    // Get a pointer to the codec context for the video stream
    pCodecCtxOrig = pFormatCtx->streams[videoStream]->codec;
    // Find the decoder for the video stream
    pCodec = avcodec_find_decoder(pCodecCtxOrig->codec_id);
    if (pCodec == NULL)
    {
       fprintf(stderr, "Unsupported codec!\n");
       _finished = true; // Codec not found
    }
    pCodecCtx = avcodec_alloc_context3(pCodec);
    if (avcodec_copy_context(pCodecCtx, pCodecCtxOrig) != 0)
    {
       fprintf(stderr, "Couldn't copy codec context");
       _finished = true; // Error copying codec context
    }
    // Open codec
    if (avcodec_open2(pCodecCtx, pCodec, NULL) &lt; 0)
    {
       _finished = true; // Could not open codec
    }
    // Allocate video frame
    pFrame = av_frame_alloc();
    sws_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height,
    pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height,
    AV_PIX_FMT_YUV420P,
    SWS_BILINEAR,
    NULL,
    NULL,
    NULL);
    yPlaneSz = pCodecCtx->width * pCodecCtx->height;
    uvPlaneSz = pCodecCtx->width * pCodecCtx->height / 4;
    yPlane = (Uint8*)malloc(yPlaneSz);
    uPlane = (Uint8*)malloc(uvPlaneSz);
    vPlane = (Uint8*)malloc(uvPlaneSz);
    if (!yPlane || !uPlane || !vPlane)
    {
       fprintf(stderr, "Could not allocate pixel buffers - exiting\n");
       exit(1);
    }
    uvPitch = pCodecCtx->width / 2;
    }
    void video::Update(SDL_Texture* texture)
    {
    if (av_read_frame(pFormatCtx, &amp;packet) >= 0)
    {
       // Is this a packet from the video stream?
       if (packet.stream_index == videoStream)
       {
           avcodec_decode_video2(pCodecCtx, pFrame, &amp;frameFinished, &amp;packet);
           // Did we get a video frame?
           if (frameFinished)
           {
               AVPicture pict;
               pict.data[0] = yPlane;
               pict.data[1] = uPlane;
               pict.data[2] = vPlane;
               pict.linesize[0] = pCodecCtx->width;
               pict.linesize[1] = uvPitch;
               pict.linesize[2] = uvPitch;
               // Convert the image into YUV format that SDL uses
               sws_scale(sws_ctx, (uint8_t const * const *) pFrame->data,pFrame->linesize, 0, pCodecCtx->height, pict.data,pict.linesize);
               SDL_UpdateYUVTexture(texture,NULL,yPlane,pCodecCtx->width,uPlane,uvPitch,vPlane,uvPitch);
           }
       }
       // Free the packet that was allocated by av_read_frame
       av_packet_unref(&amp;packet);
       av_freep(&amp;packet);
    }
    else
    {
       av_packet_unref(&amp;packet);
       av_freep(&amp;packet);
       _finished = true;
    }
    }
    bool video::getFinished()
    {
    return _finished;
    }
    video::~video()
    {
    av_packet_unref(&amp;packet);
    av_freep(&amp;packet);
    av_frame_free(&amp;pFrame);
    av_freep(&amp;pFrame);
    free(yPlane);
    free(uPlane);
    free(vPlane);
    // Close the codec
    avcodec_close(pCodecCtx);
    avcodec_close(pCodecCtxOrig);
    sws_freeContext(sws_ctx);
    // Close the video file
    for (int i = 0; i &lt; pFormatCtx->nb_streams; i++)
    {
       AVStream *stream = pFormatCtx->streams[i];
       avcodec_close(stream->codec);
    }
    avformat_close_input(&amp;pFormatCtx);
    /*av_dict_free(&amp;optionsDict);  
    sws_freeContext(sws_ctx);
    av_free_packet(&amp;packet);
    av_free(pFrameYUV);
    av_free(buffer);
    avcodec_close(pCodecCtx);
    avformat_close_input(&amp;pFormatCtx);*/
    }

    video.h

    #include <string>
    #include <sdl2></sdl2>SDL.h>
    #ifdef __cplusplus
    extern "C" {
    #endif
    #include <libavcodec></libavcodec>avcodec.h>
    #include <libavformat></libavformat>avformat.h>
    #include <libswscale></libswscale>swscale.h>
    #ifdef __cplusplus
    }
    #endif

    class video
    {
      private:
       bool _finished;
       AVFormatContext *pFormatCtx;
       int videoStream;
       unsigned i;
       AVCodecContext *pCodecCtxOrig;
       AVCodecContext *pCodecCtx;
       AVCodec *pCodec;
       AVFrame *pFrame;
       AVPacket packet;
       int frameFinished;
       struct SwsContext *sws_ctx;
       Uint8 *yPlane, *uPlane, *vPlane;
       size_t yPlaneSz, uvPlaneSz;
       int uvPitch;
      public:
       video(const std::string&amp; name);
       ~video();
       void Update(SDL_Texture* texture);
       bool getFinished();
    };
    </string>

    I’m looking forward to your answers