Recherche avancée

Médias (0)

Mot : - Tags -/optimisation

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (27)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (2692)

  • Linux Media Player Survey Circa 2001

    2 septembre 2010, par Multimedia Mike — General

    Here’s a document I scavenged from my archives. It was dated September 1, 2001 and I now publish it 9 years later. It serves as sort of a time capsule for the state of media player programs at the time. Looking back on this list, I can’t understand why I couldn’t find MPlayer while I was conducting this survey, especially since MPlayer is the project I eventually started to work for a few months after writing this piece.

    For a little context, I had been studying multimedia concepts and tech for a year and was itching to get my hands dirty with practical multimedia coding. But I wanted to tackle what I perceived as unsolved problems– like playback of proprietary codecs. I didn’t want to have to build a new media playback framework just to start working on my problems. So I surveyed the players available to see which ones I could plug into and use as a testbed for implementing new decoders.

    Regarding Real Player, I wrote : “We’re trying to move away from the proprietary, closed-source “solutions”. Heh. Was I really an insufferable open source idealist back in the day ?

    Anyway, here’s the text with some Where are they now ? commentary [in brackets] :


    Towards an All-Inclusive Media Playing Solution for Linux

    I don’t feel that the media playing solutions for Linux set their sights high enough, even though they do tend to be quite ambitious.

    I want to create a media player for Linux that can open a file, figure out what type of file it is (AVI, MOV, etc.), determine the compression algorithms used to encode the audio and video chunks inside (MPEG, Cinepak, Sorenson, etc.) and replay the file using the best audio, video, and CPU facilities available on the computer.

    Video and audio playback is a solved problem on Linux ; I don’t wish to solve that problem again. The problem that isn’t solved is reliance on proprietary multimedia solutions through some kind of WINE-like layer in order to decode compressed multimedia files.

    Survey of Linux solutions for decoding proprietary multimedia
    updated 2001-09-01

    AVI Player for XMMS
    This is based on Avifile. All the same advantages and limitations apply.
    [Top Google hit is a Freshmeat page that doesn’t indicate activity since 2001-2002.]

    Avifile
    This player does a great job at taking apart AVI and ASF files and then feeding the compressed chunks of multimedia data through to the binary Win32 decoders.

    The program is written in C++ and I’m not very good at interpreting that kind of code. But I’m learning all over again. Examining the object hierarchy, it appears that the designers had the foresight to include native support for decoders that are compiled into the program from source code. However, closer examination reveals that there is support for ONE source decoder and that’s the “decoder” for uncompressed data. Still, I tried to manipulate this routine to accept and decode data from other codecs but no dice. It’s really confounding. The program always crashes when I feed non-uncompressed data through the source decoder.
    [Lives at http://avifile.sourceforge.net/ ; not updated since 2006.]

    Real Player
    There’s not much to do with this since it is closed source and proprietary. Even though there is a plugin architecture, that’s not satisfactory. We’re trying to move away from the proprietary, closed-source “solutions”.
    [Still kickin’ with version 11.]

    XAnim
    This is a well-established Unix media player. To his credit, the author does as well as he can with the resources he has. In other words, he supports the non-proprietary video codecs well, and even has support for some proprietary video codecs through binary-only decoders.

    The source code is extremely difficult to work with as the author chose to use the X coding format which I’ve never seen used anywhere else except for X header files. The infrastructure for extending the program and supporting other codecs and file formats is there, I suppose, but I would have to wrap my head around the coding style. Maybe I can learn to work past that. The other thing that bothers me about this program is the decoding approach : It seems that each video decoder includes routines to decompress the multimedia data into every conceivable RGB and YUV output format. This seems backwards to me ; it seems better to have one decoder function that decodes the data into its native format it was compressed from (e.g., YV12 for MPEG data) and then pass that data to another layer of the program that’s in charge of presenting the data and possibly converting it if necessary. This layer would encompass highly-optimized software conversion routines including special CPU-specific instructions (e.g., MMX and SSE) and eliminate the need to place those routines in lots of other routines. But I’m getting ahead of myself.
    [This one was pretty much dead before I made this survey, the most recent update being in 1999. Still, we owe it much respect as the granddaddy of Unix multimedia playback programs.]

    Xine
    This seems like a promising program. It was originally designed to play MPEGs from DVDs. It can also play MPEG files on a hard drive and utilizes the Xv extensions for hardware YUV playback. It’s also supposed to play AVI files using the same technique as Avifile but I have never, ever gotten it to work. If an AVI file has both video and sound, the binary video decoder can’t decode any frames. If the AVI file has video and no sound, the program gets confused and crashes, as far as I can tell.

    Still, it’s promising, and I’ve been trying to work around these crashes. It doesn’t yet have the type of modularization I’d like to see. Right now, it tailored to suit MPEG playback and AVI playback is an afterthought. Still, it appears to have a generalized interface for dropping in new file demultiplexers.

    I tried to extend the program for supporting source decoders by rewriting w32codec.c from scratch. I’m not having a smooth time of it so far. I’m able to perform some manipulations on the output window. However, I can’t get the program to deal with an RGB image format. It has trouble allocating an RGB surface with XvShmCreateImage(). This isn’t suprising, per my limited knowledge of X which is that Xv applies to YUV images, but it could also apply to RGB images as well. Anyway, the program should be able to fall back on regular RGB pixmaps if that Xv call fails.

    Right now, this program is looking the most promising. It will take some work to extend the underlying infrastructure, but it seems doable since I know C quite well and can understand the flow of this program, as opposed to Avifile and its C++. The C code also compiles about 10 times faster.
    [My home project for many years after a brief flirtation with MPlayer. It is still alive ; its latest release was just a month ago.]

    XMovie
    This library is a Quicktime movie player. I haven’t looked at it too extensively yet, but I do remember looking at it at one point and reading the documentation that said it doesn’t support key frames. Still, I should examine it again since they released a new version recently.
    [Heroine Virtual still puts out some software but XMovie has not been updated since 2005.]

    XMPS
    This program compiles for me, but doesn’t do much else. It can play an MP3 file. I have been able to get MPEG movies to play through it, but it refuses to show the full video frame, constricting it to a small window (obviously a bug).
    [This project is hosted on SourceForge and is listed with a registration date of 2003, well after this survey was made. So the project obviously lived elsewhere in 2001. Meanwhile, it doesn’t look like any files ever made it to SF for hosting.]

    XTheater
    I can’t even get this program to compile. It’s supposed to be an MPEG player based on SMPEG. As such, it probably doesn’t hold much promise for being easily extended into a general media player.
    [Last updated in 2002.]

    GMerlin
    I can’t get this to compile yet. I have a bug report in to the dev group.
    [Updated consistently in the last 9 years. Last update was in February of this year. I can’t find any record of my bug report, though.]

  • Multivariate Testing vs A/B Testing (Quick-Start Guide)

    7 mars 2024, par Erin

    Traditional advertising (think Mad Men) was all about slogans, taglines and coming up with a one-liner that was meant to change the world.

    But that type of advertising was extremely challenging to test, so it was hard to know if it worked. Most of the time, nobody knew if they were being effective with their advertising.

    Enter modern marketing : the world of data-driven advertising.

    Thanks to the internet and web analytics tools like Matomo, you can quickly test almost anything and improve your site.

    The question is, should you do multivariate testing or A/B testing ?

    While both have their advantages, each has a specific use case.

    In this guide, we’ll break down the differences between multivariate and A/B testing, offer some pros and cons of each and show you some examples so you can decide which one is best for you.

    What is A/B testing ?

    A/B testing, or split testing, is testing an individual element in a medium against another version of the same element to see which produces better results.

    What is a/b testing?

    A/B tests are conducted by creating two different versions of a digital landmark : a website, landing page, email, or advertisement.

    The goal ? Figure out which version performs better.

    Let’s say, for example, you want to drive more sales on your core product page.

    You test two call-to-action buttons : “Buy Now” and “Add to Cart.”

    After running the test for two weeks, you see that “Buy Now” produced 1.2% conversions while “Add to Cart” produced 7.6%.

    In this scenario, you’ve found your winner : version B, “Add to Cart.”

    By conducting A/B tests regularly, you can optimise your site, increase engagement and convert more visitors into customers.

    Keep in mind that A/B testing isn’t perfect ; it doesn’t always produce a win.

    According to Noah Kagan, founder of AppSumo, only 1 out of 8 A/B tests his company conducts produces significant change.

    Advantages of A/B testing

    A/B testing is great when you need to get an accurate result fast on a specific element of your marketing efforts.

    Whether it’s a landing page or product page, you can get quick results without needing a lot of traffic.

    A/B testing is one of the most widely accepted and used testing methods for marketers and business owners.

    When you limit the number of tracked variables used in a test, you can quickly deliver reliable data, allowing you to iterate and pivot quickly if necessary.

    This is a great way to test your marketing methods, especially if you’re a newer business or you don’t have substantial traffic yet.

    Splitting up your traffic into a few segments (like with multivariate testing) will be very challenging to gain accurate results if you have lower daily traffic.

    One final advantage of A/B testing is that it’s a relatively easy way to introduce testing and optimising to a team, decision-maker, or stakeholder since it’s easy to implement. You can quickly demonstrate the value with a simple change and tangible evidence.

    Disadvantages of A/B testing

    So, what are the downsides to A/B testing ?

    Although A/B testing can get you quick results on small changes, it has limitations.

    A/B testing is all about measuring one element against another.

    This means you’re immediately limited in how many elements you can test. If you have to test out different variables, then A/B testing isn’t your best option since you’ll have to run test after test to get your result.

    If you need specific information on how different combinations of elements interact with one another on a web page, then multivariate is your best option.

    What is multivariate testing ?

    If you want to take your testing to the next level, you’ll want to try multivariate testing.

    Multivariate testing relies on the same foundational mechanism of A/B testing, but instead of matching up two elements against one another, it compares a higher number of variables at once.

    Multiple + variations = multivariate.

    Multivariate testing looks at how combinations of elements and variables interact.

    Like A/B testing, traffic to a page is split between different web page versions. Multivariate testing aims to measure each version’s effectiveness against the other versions.

    Ultimately, it’s about finding the winning combination.

    What Is Multivariate Testing?

    When to use multivariate testing

    The quick answer on when to use multivariate testing is if you have enough traffic.

    Just how much traffic, though ?

    While there’s no set number, you should aim to have 10,000 visitors per month or more, to ensure that each variant receives enough traffic to produce meaningful results within a reasonable time frame.

    Once you meet the traffic requirement, let’s talk about use cases.

    Let’s say you want to introduce a new email signup.

    But you want to create it from scratch and aren’t sure what will make your audience take action.

    So, you create a page with a signup form, a header, and an image.

    To run a multivariate test, you create two lengths of signup forms, four headlines, and two images.

    Next, you would create a test to split traffic between these sixteen combinations.

    Advantages of multivariate testing

    If you have enough traffic, multivariate testing can be an incredible way to speed up your A/B testing by testing dozens of combinations of your web page.

    This is handy when creating a new landing page and you want to determine if specific parts of your design are winners — which you can then use in future campaigns.

    Disadvantages of multivariate testing

    The main disadvantage of multivariate testing is that you need a lot of traffic to get started.

    If you try to do a multivariate analysis but you’re not getting much traffic, your results won’t be accurate (and it will take a long time to see accurate data).

    Additionally, multivariate tests are more complicated. They’re best suited for advanced marketers since more moving parts are at play.

    Key differences between multivariate and A/B testing

    Now that we’ve covered what A/B and multivariate tests are, let’s look at some key differences to help clarify which is best for you.

    Key differences between multivariate testing and A/B testing.

    1. Variation of combinations

    The major difference between A/B and multivariate testing is the number of combinations involved.

    With A/B testing, you only look at one element (no combinations). You simply take one part of your page (i.e., your headline copy) and make two versions.

    With multivariate testing, you’re looking at combinations of different elements (i.e., headline copy, form length, images).

    2. Number of pages to test

    The next difference lies in how many pages you will test.

    With an A/B test, you are splitting traffic on your website to two different pages : A and B.

    However, with multivariate testing, you will likely have 4-16 different test pages.

    This is because dozens of combinations can be created when you start testing a handful of elements at once.

    For example, if you want to test two headlines, two form buttons and two images on a signup form, then you have several combinations :

    • Headline A, Button A, Image A
    • Headline A, Button A, Image B
    • Headline A, Button B, Image A
    • Headline A, Button B, Image B
    • Headline B, Button A, Image A
    • Headline B, Button A, Image B
    • Headline B, Button B, Image A
    • Headline B, Button B, Image B

    In this scenario, you must create eight pages to send traffic to.

    3. Traffic requirements

    The next major difference between the two testing types is the traffic requirements.

    With A/B testing, you don’t need much traffic at all.

    Since you’re only testing two pages, you can split your traffic in half between the two types.

    However, if you plan on implementing a multivariate test, you will likely be splitting your traffic at least four or more ways.

    This means you need to have significantly more traffic coming in to get accurate data from your test. If you try to do this when your traffic is too low, you won’t have a large enough sample size.

    4. Time requirements

    Next up, just like traffic, there’s also a time requirement.

    A/B testing only tests two versions of a page against each other (while testing a single element). This means you’ll get accurate results faster than a multivariate test — usually within days.

    However, for a multivariate test, you might need to wait weeks. This is because you’re splitting your traffic by 4, 8, 12, or more web page variations. This could take months since you need a large enough sample size for accuracy.

    5. Big vs. small changes

    Another difference between A/B testing and multivariate testing is the magnitude of changes.

    With an A/B test, you’re looking at one element of a page, which means changing that element to the winning version isn’t a major overhaul of your design.

    But, with multivariate testing, you may find that the winning combination is drastically different than your control page, which could lead to a significant design change.

    6. Accuracy of results

    A/B tests are easier to decipher than multivariate testing since you only look at two versions of a single element on a page.

    You have a clear winner if one headline yields a 5% conversion rate and another yields a 1.2% conversion rate.

    But multivariate testing looks at so many combinations of a page that it can be a bit trickier to decipher what’s moving the needle.

    Pros and cons : Multivariate vs. A/B testing

    Before picking your testing method of choice, let’s look at some quick pros and cons.

    Pros and cons of multivariate vs. a/b testing.

    A/B testing pros and cons

    Here are the pros and cons of A/B testing :

    Pros

    • Get results quickly
    • Results are easier to interpret
    • Lower traffic requirement
    • Easy to get started

    Cons

    • You need to be hyper-focused on the right testing element
    • Requires performing test after test to optimise a web page

    Multivariate testing pros and cons

    Here are the pros and cons of multivariate testing :

    Pros

    • Handy when redesigning an entire web page
    • You can test multiple variables at once
    • Significant results (since traffic is higher)
    • Gather multiple data insights at once

    Cons

    • Requires substantial traffic
    • Harder to accurately decipher results
    • Not as easy to get started (more advanced)

    Use Matomo to start testing and improving your site

    A/B testing in Matomo analytics

    You need to optimise your website if you want to get more leads, land more conversions and grow your business.

    A/B testing and multivariate testing are proven testing methods you can lean on to improve your website and create a better user experience.

    You may prefer one testing method now over the other, and that’s okay.

    The main thing is you’re starting to test. The best marketers and analysts in the world find what works through testing and double down on their winning tactics.

    If you want to start improving your website with testing today, get started with Matomo for free.

    With Matomo, you can conduct A/B tests and multivariate tests easily, accurately, and ethically. Unlike other web analytics tools, Matomo prioritises privacy, providing
    100% accurate data without sampling, and eliminates the need for cookie consent
    banners (except in the UK and Germany).

    Try Matomo free for 21-days. No credit card required.

  • How to get currecnt AVFrame siquential number after av_seek_frame ?

    14 mai 2021, par Aleksey Timoshchenko

    I am new in decoder and FFmpeg. What I need is to implement the logic that can read frames with some step (ex:20), in other words, I have a file and I need to read frames 0, 20, 40, 60...

    


    what I do is

    


    
AVFrame * m_pAVFrame = nullptr;
int firstFrameIdx = 0;

while(true)
{

if(firstFrameIdx > 0)
{
int64_t seekTarget = FrameToPts(m_pAVStream, firstFrameIdx);
nRet = av_seek_frame(m_pAVFormatCtx, m_streamIdx, seekTarget, AVSEEK_FLAG_FRAME);
}

nRet = av_read_frame(m_pAVFormatCtx, m_pAVPkt);
ret = avcodec_send_packet(m_pAVCodecCtx, m_pAVPkt);
ret = avcodec_receive_frame(m_pAVCodecCtx, m_pAVFrame);

firstFrameIdx+=20;
}



    


    But problem is that av_seek_frame moves the pointer to the Iframe, lets say the video file has keyframes each 15(of course it could be a different number) like 0, 15, 30... So it means that if I try to seek to frame 20 actually I get to frame 15.

    


    I see that AVFrame has a property coded_picture_number that could be useful in my case, I tried to put these returned values to the vector and I see that these values irrelevant

    


    enter image description here

    


    what I expected to see there is 0, 15, 30, 45...

    


    It'll be useful if I for example can make a seek then get a frame to ask the order number (ex:15) then I can understand that Iframe is 15 and in order to reach frame 20 I need to read and skip 5 frames so as a result, I get to frame 20, but as you see above after the seek I ask the order number and get weird values like 0, 2, 1, 3... there is nothing to do with it...

    


    I feel like there is some basic knowledge that I miss, could someone explain how to make a seek logic and get to the right frame ?

    


    UPDATE

    


    Init logic

    


    bool FFmpegDecoder::Init(unsigned char const * pData, int dataSize, int reqId, bool bUseHWAccel, FFmpegDecoderCallback * pCB)&#xA;{&#xA;    Deinit();&#xA;&#xA;    // From memory:&#xA;    if (pData == nullptr || dataSize == 0)&#xA;    {&#xA;        printf("FFmpegDecoder::Init FAILED: neither filename nor memory data were given !\n");&#xA;        return false;&#xA;    }&#xA;    m_pIoCtx = std::make_shared<aviocontextmem>(pData, dataSize);&#xA;&#xA;    if (m_pIoCtx->IsValid() == false)&#xA;    {&#xA;        printf("FFmpegDecoder::Init FAILED: m_pIoCtx is nullptr !\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    m_reqId = reqId;&#xA;    m_bUseHWAccel = bUseHWAccel;&#xA;    m_pCB = pCB;&#xA;    m_pData = pData;&#xA;    m_dataSize = dataSize;&#xA;&#xA;    m_bRequestedAbort = false;&#xA;&#xA;    m_pAVPkt = av_packet_alloc();&#xA;    av_init_packet(m_pAVPkt);&#xA;&#xA;    m_pAVFrame = av_frame_alloc();&#xA;    m_pAVFrameRGB = av_frame_alloc();&#xA;&#xA;    if (m_bUseHWAccel)&#xA;    {&#xA;        m_pSwAVFrameForHw = av_frame_alloc();&#xA;    }&#xA;&#xA;    m_pAVFormatCtx = avformat_alloc_context();&#xA;    m_pIoCtx->initAVFormatContext(m_pAVFormatCtx);&#xA;&#xA;    if (avformat_open_input(&amp;m_pAVFormatCtx, "", nullptr, nullptr) != 0)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in avformat_open_input\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    if (avformat_find_stream_info(m_pAVFormatCtx, nullptr) &lt; 0)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in avformat_find_stream_info\n");&#xA;        return false;&#xA;    }&#xA;&#xA;&#xA;    //av_dump_format(ctx_format, 0, "", false);&#xA;    for (int i = 0; i &lt; (int)m_pAVFormatCtx->nb_streams; i&#x2B;&#x2B;)&#xA;    {&#xA;        if (m_pAVFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)&#xA;        {&#xA;            m_streamIdx = i;&#xA;            m_pAVStream = m_pAVFormatCtx->streams[i];&#xA;            break;&#xA;        }&#xA;    }&#xA;    if (m_pAVStream == nullptr)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: failed to find video stream\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    m_pAVCodec = avcodec_find_decoder(m_pAVStream->codecpar->codec_id);&#xA;    if (!m_pAVCodec)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in avcodec_find_decoder\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    m_pAVCodecCtx = avcodec_alloc_context3(m_pAVCodec);&#xA;    if (!m_pAVCodecCtx)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in avcodec_alloc_context3\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    if (avcodec_parameters_to_context(m_pAVCodecCtx, m_pAVStream->codecpar) &lt; 0)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in avcodec_parameters_to_context\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    if (m_bUseHWAccel)&#xA;    {&#xA;        AVHWDeviceType hwDevType = AV_HWDEVICE_TYPE_DXVA2;&#xA;        g_hwPixFormat = find_fmt_by_hw_type(hwDevType);&#xA;        m_pAVCodecCtx->get_format = get_hw_format;&#xA;        av_opt_set_int(m_pAVCodecCtx, "refcounted_frames", 1, 0);&#xA;        if (av_hwdevice_ctx_create(&amp;m_pBufferRefForHw, hwDevType, NULL, NULL, 0) &lt; 0)&#xA;        {&#xA;            printf("FFmpegDecoder::InitFFmpeg: error in av_hwdevice_ctx_create\n");&#xA;            return false;&#xA;        }&#xA;        m_pAVCodecCtx->hw_device_ctx = av_buffer_ref(m_pBufferRefForHw);&#xA;    }&#xA;&#xA;    if (avcodec_open2(m_pAVCodecCtx, m_pAVCodec, nullptr) &lt; 0)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in avcodec_open2\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    m_pAVFrameRGB->format = AV_PIX_FMT_BGR24;&#xA;    m_pAVFrameRGB->width = m_pAVCodecCtx->width;&#xA;    m_pAVFrameRGB->height = m_pAVCodecCtx->height;&#xA;    if (av_frame_get_buffer(m_pAVFrameRGB, 32) != 0)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in av_frame_get_buffer\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    m_streamRotationDegrees = GetAVStreamRotation(m_pAVStream);&#xA;    m_estimatedFramesCount = 0;&#xA;    assert(m_pAVFormatCtx->nb_streams > 0);&#xA;    if (m_pAVFormatCtx->nb_streams > 0)&#xA;    {&#xA;        m_estimatedFramesCount = m_pAVFormatCtx->streams[0]->nb_frames;&#xA;    }&#xA;&#xA;    //InitConvertColorSpace&#xA;    // Init converter from YUV420p to BGR:&#xA;    if (m_bUseHWAccel)&#xA;    {&#xA;        m_pSwsCtxConvertImg = sws_getContext(m_pAVCodecCtx->width, m_pAVCodecCtx->height, AV_PIX_FMT_NV12, m_pAVCodecCtx->width, m_pAVCodecCtx->height, AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR, NULL, NULL, NULL);&#xA;    }&#xA;    else&#xA;    {&#xA;        m_pSwsCtxConvertImg = sws_getContext(m_pAVCodecCtx->width, m_pAVCodecCtx->height, m_pAVCodecCtx->pix_fmt, m_pAVCodecCtx->width, m_pAVCodecCtx->height, AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR, NULL, NULL, NULL);&#xA;    }&#xA;    if (!m_pSwsCtxConvertImg)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in sws_getContext\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    m_bInitOK = true;&#xA;    return true;&#xA;}&#xA;</aviocontextmem>

    &#xA;

    Decoding logic with last changes

    &#xA;

    void FFmpegDecoder::DecodeWithStep(int step)&#xA;{&#xA;    step = 20;&#xA;    int currentFramePos = 0;&#xA;    int number_of_errors = 0;&#xA;    const int MAX_ERROR_NUM = 10;&#xA;&#xA;    while (true)&#xA;    {&#xA;        if (step > 0)&#xA;        {&#xA;            int seekPos = currentFramePos &#x2B; step;&#xA;            int64_t seekTarget = FrameToPts(m_pAVStream, seekPos);&#xA;&#xA;            if (av_seek_frame(m_pAVFormatCtx, m_streamIdx, seekTarget, AVSEEK_FLAG_FRAME) &lt; 0)&#xA;            {&#xA;                number_of_errors&#x2B;&#x2B;;&#xA;            }&#xA;            else&#xA;            {&#xA;                currentFramePos = seekPos;&#xA;                m_is_seeked = true;&#xA;            }&#xA;        }&#xA;&#xA;        if (av_read_frame(m_pAVFormatCtx, m_pAVPkt) == 0)&#xA;        {&#xA;            if (m_pAVPkt->stream_index == m_streamIdx) //to make sure that I dont get packets from other streams&#xA;            {&#xA;                if (m_is_seeked)&#xA;                {&#xA;                    avcodec_flush_buffers(m_pAVCodecCtx);&#xA;                    m_is_seeked = false;&#xA;                }&#xA;&#xA;                if (avcodec_send_packet(m_pAVCodecCtx, m_pAVPkt) == 0)&#xA;                {&#xA;                    printf("----- BATCH\n");&#xA;&#xA;                    while (avcodec_receive_frame(m_pAVCodecCtx, m_pAVFrame) == 0)&#xA;                    {&#xA;                        ProcessFrame(m_pAVFrame);&#xA;                        av_frame_unref(m_pAVFrame);&#xA;                        currentFramePos&#x2B;&#x2B;;&#xA;                        printf("----- cur position (%d) \n", currentFramePos);&#xA;                    }&#xA;                }&#xA;&#xA;                av_packet_unref(m_pAVPkt);&#xA;            }&#xA;        }&#xA;        else&#xA;        {&#xA;            number_of_errors&#x2B;&#x2B;;&#xA;        }&#xA;&#xA;        if (number_of_errors == MAX_ERROR_NUM)&#xA;        {&#xA;            printf("EXIT\n");&#xA;            break;&#xA;        }&#xA;    }&#xA;}&#xA;

    &#xA;

    UPDATE

    &#xA;

    Init logic

    &#xA;

    bool FFmpegDecoder::Init(unsigned char const * pData, int dataSize, int reqId, bool bUseHWAccel, FFmpegDecoderCallback * pCB)&#xA;{&#xA;    Deinit();&#xA;&#xA;    // From memory:&#xA;    if (pData == nullptr || dataSize == 0)&#xA;    {&#xA;        printf("FFmpegDecoder::Init FAILED: neither filename nor memory data were given !\n");&#xA;        return false;&#xA;    }&#xA;    m_pIoCtx = std::make_shared<aviocontextmem>(pData, dataSize);&#xA;&#xA;    if (m_pIoCtx->IsValid() == false)&#xA;    {&#xA;        printf("FFmpegDecoder::Init FAILED: m_pIoCtx is nullptr !\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    m_reqId = reqId;&#xA;    m_bUseHWAccel = bUseHWAccel;&#xA;    m_pCB = pCB;&#xA;    m_pData = pData;&#xA;    m_dataSize = dataSize;&#xA;&#xA;    m_bRequestedAbort = false;&#xA;&#xA;    m_pAVPkt = av_packet_alloc();&#xA;    av_init_packet(m_pAVPkt);&#xA;&#xA;    m_pAVFrame = av_frame_alloc();&#xA;    m_pAVFrameRGB = av_frame_alloc();&#xA;&#xA;    if (m_bUseHWAccel)&#xA;    {&#xA;        m_pSwAVFrameForHw = av_frame_alloc();&#xA;    }&#xA;&#xA;    m_pAVFormatCtx = avformat_alloc_context();&#xA;    m_pIoCtx->initAVFormatContext(m_pAVFormatCtx);&#xA;&#xA;    if (avformat_open_input(&amp;m_pAVFormatCtx, "", nullptr, nullptr) != 0)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in avformat_open_input\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    if (avformat_find_stream_info(m_pAVFormatCtx, nullptr) &lt; 0)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in avformat_find_stream_info\n");&#xA;        return false;&#xA;    }&#xA;&#xA;&#xA;    //av_dump_format(ctx_format, 0, "", false);&#xA;    for (int i = 0; i &lt; (int)m_pAVFormatCtx->nb_streams; i&#x2B;&#x2B;)&#xA;    {&#xA;        if (m_pAVFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)&#xA;        {&#xA;            m_streamIdx = i;&#xA;            m_pAVStream = m_pAVFormatCtx->streams[i];&#xA;            break;&#xA;        }&#xA;    }&#xA;    if (m_pAVStream == nullptr)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: failed to find video stream\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    m_pAVCodec = avcodec_find_decoder(m_pAVStream->codecpar->codec_id);&#xA;    if (!m_pAVCodec)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in avcodec_find_decoder\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    m_pAVCodecCtx = avcodec_alloc_context3(m_pAVCodec);&#xA;    if (!m_pAVCodecCtx)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in avcodec_alloc_context3\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    if (avcodec_parameters_to_context(m_pAVCodecCtx, m_pAVStream->codecpar) &lt; 0)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in avcodec_parameters_to_context\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    if (m_bUseHWAccel)&#xA;    {&#xA;        AVHWDeviceType hwDevType = AV_HWDEVICE_TYPE_DXVA2;&#xA;        g_hwPixFormat = find_fmt_by_hw_type(hwDevType);&#xA;        m_pAVCodecCtx->get_format = get_hw_format;&#xA;        av_opt_set_int(m_pAVCodecCtx, "refcounted_frames", 1, 0);&#xA;        if (av_hwdevice_ctx_create(&amp;m_pBufferRefForHw, hwDevType, NULL, NULL, 0) &lt; 0)&#xA;        {&#xA;            printf("FFmpegDecoder::InitFFmpeg: error in av_hwdevice_ctx_create\n");&#xA;            return false;&#xA;        }&#xA;        m_pAVCodecCtx->hw_device_ctx = av_buffer_ref(m_pBufferRefForHw);&#xA;    }&#xA;&#xA;    if (avcodec_open2(m_pAVCodecCtx, m_pAVCodec, nullptr) &lt; 0)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in avcodec_open2\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    m_pAVFrameRGB->format = AV_PIX_FMT_BGR24;&#xA;    m_pAVFrameRGB->width = m_pAVCodecCtx->width;&#xA;    m_pAVFrameRGB->height = m_pAVCodecCtx->height;&#xA;    if (av_frame_get_buffer(m_pAVFrameRGB, 32) != 0)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in av_frame_get_buffer\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    m_streamRotationDegrees = GetAVStreamRotation(m_pAVStream);&#xA;    m_estimatedFramesCount = 0;&#xA;    assert(m_pAVFormatCtx->nb_streams > 0);&#xA;    if (m_pAVFormatCtx->nb_streams > 0)&#xA;    {&#xA;        m_estimatedFramesCount = m_pAVFormatCtx->streams[0]->nb_frames;&#xA;    }&#xA;&#xA;    //InitConvertColorSpace&#xA;    // Init converter from YUV420p to BGR:&#xA;    if (m_bUseHWAccel)&#xA;    {&#xA;        m_pSwsCtxConvertImg = sws_getContext(m_pAVCodecCtx->width, m_pAVCodecCtx->height, AV_PIX_FMT_NV12, m_pAVCodecCtx->width, m_pAVCodecCtx->height, AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR, NULL, NULL, NULL);&#xA;    }&#xA;    else&#xA;    {&#xA;        m_pSwsCtxConvertImg = sws_getContext(m_pAVCodecCtx->width, m_pAVCodecCtx->height, m_pAVCodecCtx->pix_fmt, m_pAVCodecCtx->width, m_pAVCodecCtx->height, AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR, NULL, NULL, NULL);&#xA;    }&#xA;    if (!m_pSwsCtxConvertImg)&#xA;    {&#xA;        printf("FFmpegDecoder::InitFFmpeg: error in sws_getContext\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    m_bInitOK = true;&#xA;    return true;&#xA;}&#xA;</aviocontextmem>

    &#xA;

    void FFmpegDecoder::DecodeWithStep(int step)&#xA;{&#xA;    step = 20;&#xA;    int currentFramePos = 0;&#xA;    int number_of_errors = 0;&#xA;    const int MAX_ERROR_NUM = 10;&#xA;    int seekPos = 0;&#xA;&#xA;    while (true)&#xA;    {&#xA;        if (step > 1)&#xA;        {&#xA;            seekPos = currentFramePos &#x2B; step;&#xA;            int64_t seekTarget = FrameToPts(m_pAVStream, seekPos);&#xA;&#xA;            if (av_seek_frame(m_pAVFormatCtx, m_streamIdx, seekTarget, AVSEEK_FLAG_FRAME) &lt; 0)&#xA;            {&#xA;                number_of_errors&#x2B;&#x2B;;&#xA;            }&#xA;            else&#xA;            {&#xA;                m_is_seeked = true;&#xA;            }&#xA;        }&#xA;&#xA;        while (true)&#xA;        {&#xA;            if (av_read_frame(m_pAVFormatCtx, m_pAVPkt) == 0)&#xA;            {&#xA;                if (m_pAVPkt->stream_index == m_streamIdx) //to make sure that I dont get packets from other streams&#xA;                {&#xA;                    if (m_is_seeked)&#xA;                    {&#xA;                        avcodec_flush_buffers(m_pAVCodecCtx);&#xA;                        m_is_seeked = false;&#xA;                    }&#xA;&#xA;                    if (avcodec_send_packet(m_pAVCodecCtx, m_pAVPkt) == 0)&#xA;                    {&#xA;                        int ret = 0;&#xA;                        while (ret >= 0)&#xA;                        {&#xA;                            ret = avcodec_receive_frame(m_pAVCodecCtx, m_pAVFrame);&#xA;&#xA;                            if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;                            {&#xA;                                av_frame_unref(m_pAVFrame);&#xA;                                break;&#xA;                            }&#xA;&#xA;                            currentFramePos = m_pAVFrame->display_picture_number; //In order to get position of currect frame (seek move poiter to the key frame)&#xA;&#xA;                            if (currentFramePos &lt; seekPos) //Some frames need to be skiped in order to reach needed frame&#xA;                            {&#xA;                                printf("----- SKIP : cur position (%d) \n", currentFramePos);&#xA;                                av_frame_unref(m_pAVFrame);&#xA;                                continue;&#xA;                            }&#xA;&#xA;                            ProcessFrame(m_pAVFrame); //needed frame was processed&#xA;                            av_frame_unref(m_pAVFrame);&#xA;                            printf("----- cur position (%d) \n", currentFramePos);&#xA;                            break;&#xA;                        }&#xA;                    }&#xA;&#xA;                    av_packet_unref(m_pAVPkt);&#xA;                }&#xA;                else&#xA;                {&#xA;                    av_packet_unref(m_pAVPkt); //we got a frame from the wrong stream&#xA;                }&#xA;            }&#xA;            else&#xA;            {&#xA;                number_of_errors&#x2B;&#x2B;;&#xA;            }&#xA;&#xA;            if (number_of_errors == MAX_ERROR_NUM)&#xA;            {&#xA;                printf("EXIT1\n");&#xA;                break;&#xA;            }&#xA;        }&#xA;&#xA;        if (number_of_errors == MAX_ERROR_NUM)&#xA;        {&#xA;            printf("EXIT2\n");&#xA;            break;&#xA;        }&#xA;    }&#xA;}&#xA;

    &#xA;

    int64_t FrameToPts(AVStream* pavStream, int frame)&#xA;{&#xA;    return (int64_t(frame) * pavStream->r_frame_rate.den *  pavStream->time_base.den) /&#xA;        (int64_t(pavStream->r_frame_rate.num) * pavStream->time_base.num);&#xA;}&#xA;

    &#xA;