Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (35)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • 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 (3029)

  • Anomalie #4756 : Régressions liées aux évolutions des styles du privé

    17 mai 2021, par RastaPopoulos ♥

    Les variantes de box notice, success etc, ont l’air de ne pas avoir pile le même radius en haut à gauche que les autres de base : si on met inverse+notice par ex, on voit le noir qui dépasse sous le jaune en haut à gauche.

  • Anomalie #4756 : Régressions liées aux évolutions des styles du privé

    17 mai 2021, par RastaPopoulos ♥

    Bé ça reste des variantes de boites avec juste les choix aplat/ombres etc qui changent. Ça me parait un peu bizarre que ce soit pas le même arrondi quand on est dans le même composant (qu’éventuellement ça soit pas le même radius entre box et button ok, mais là c’est entre box). Ça se voit parce que j’ai testé de combiner, mais même sans, ça me parait à corriger. :)

    Cela dit, au moins pour certaines, notamment inverse, ça me parait logique de pouvoir combiner, on peut vouloir inverse pour se détacher + notice ou erreur parce que c’est attention danger. Mais c’est un autre point que l’uniformisation des radius. :)

  • 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;