Recherche avancée

Médias (0)

Mot : - Tags -/interaction

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

Autres articles (89)

  • À propos des documents

    21 juin 2013, par

    Que faire quand un document ne passe pas en traitement, dont le rendu ne correspond pas aux attentes ?
    Document bloqué en file d’attente ?
    Voici une liste d’actions ordonnée et empirique possible pour tenter de débloquer la situation : Relancer le traitement du document qui ne passe pas Retenter l’insertion du document sur le site MédiaSPIP Dans le cas d’un média de type video ou audio, retravailler le média produit à l’aide d’un éditeur ou un transcodeur. Convertir le document dans un format (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (19691)

  • Why FFMpeg seeking is not working with `av_seek_frame` API ?

    5 décembre 2023, par kakaiikaka

    I'm writing a simple C function to get target(the frame_num's frame) AVFrame. I know about intra-frame staff, so I may need to get several neighbour frames after seeking. But the seek API does not work ; I printed the decoded frame in the inner while the loop was still counting from the first frame in the file.

    


    Why it does not work ? BTW, I'm testing on an H.264 file.

    


    int seekHevcGetFrameToSeconds(const char *filename, int64_t frame_num, AVFrame *frame){
    int ret = 0;
    int video_stream_index = -1;
    AVFormatContext *fmt_ctx = NULL;

    // open input
    if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)) < 0)
    {
        fprintf(stderr, "Could not open input file '%s' (error '%s')\n",
                filename, av_err2str(ret));
        return ret;
    }

    for (int i = 0; i < fmt_ctx->nb_streams; i++)
    {
        AVStream *stream = fmt_ctx->streams[i];
        AVCodecParameters *codecpar = stream->codecpar;
        if (codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
        {
            video_stream_index = i;
            break;
        }
    }

    if (video_stream_index < 0)
    {
        fprintf(stderr, "Could not find video stream in the input, aborting\n");
        ret = -1;
        goto end;
    }

    AVStream *stream = fmt_ctx->streams[video_stream_index];

    // find decoder for the stream
    const AVCodec *codec = avcodec_find_decoder(stream->codecpar->codec_id);

    // allocate a new decoding context
    AVCodecContext *codec_ctx = avcodec_alloc_context3(codec);
  
    if (!codec_ctx)
    {
      fprintf(stderr, "Failed to allocate video codec context\n");
      return -1;
    }
    
    AVBufferRef *hw_device_ctx = NULL;
    int err = 0;
    
    err = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_VIDEOTOOLBOX, NULL, NULL, 0);
    if (err < 0)
    {
      fprintf(stderr, "Failed to create a VIDEOTOOLBOX device context\n");
      return -1;
    }
    
    codec_ctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);

    // pass codec parameters to decoding context
    if ((ret = avcodec_parameters_to_context(codec_ctx, stream->codecpar)) < 0)
    {
        fprintf(stderr, "Failed to copy codec parameters to decoder context (error '%s')\n", av_err2str(ret));
        goto end;
    }

    // init the decoders
    if ((ret = avcodec_open2(codec_ctx, codec, NULL)) < 0)
    {
        fprintf(stderr, "Failed to open codec for stream #%u (error '%s')\n", video_stream_index, av_err2str(ret));
        goto end;
    }

    AVPacket *pkt = av_packet_alloc();

    AVRational frame_rate = stream->avg_frame_rate;
    double fps = av_q2d(frame_rate);

    // Calculate the timestamp of the 500th frame in seconds
    double timestamp = frame_num / fps;

    // Convert the timestamp to AVStream.time_base units
    int64_t timestamp_in_time_base_units = timestamp / av_q2d(stream->time_base);
  
    // seek to target timestamp
    if (( ret = av_seek_frame( fmt_ctx, -1, timestamp_in_time_base_units, 0 )) < 0)
    {
        fprintf(stderr, "Failed to seek to target frame (error '%s')\n", av_err2str(ret));
        goto end;
    }

    avcodec_flush_buffers(codec_ctx);

    // read frames from the file
    while (av_read_frame(fmt_ctx, pkt) >= 0)
    {
        if (pkt->stream_index != video_stream_index)
        {
            av_packet_unref(pkt);
            continue;
        }
      
        if (avcodec_send_packet(codec_ctx, pkt) < 0)
        {
            fprintf(stderr, "Error while sending a packet to the decoder\n");
            ret = -1;
            goto end;
        }

        while (avcodec_receive_frame(codec_ctx, frame) == 0)
        {
            printf("Frame %c (%" PRId64 ") pts %" PRId64 " dts %" PRId64 " key_frame %d\n",
                 av_get_picture_type_char(frame->pict_type),
                 codec_ctx->frame_num,
                 frame->pts,
                 frame->pkt_dts,
                 frame->key_frame);
            goto end;
        }
        av_packet_unref(pkt);
    }
    

end:
    av_packet_free(&pkt);
    avcodec_free_context(&codec_ctx);
    avformat_close_input(&fmt_ctx);
    return ret; 
}


    


  • avfilter/w3fdif : do not write to line before start line

    22 juillet 2017, par Muhammad Faiz
    avfilter/w3fdif : do not write to line before start line
    

    That line has been written by previous job.
    Fix tsan warning.

    Reviewed-by : Paul B Mahol <onemda@gmail.com>
    Signed-off-by : Muhammad Faiz <mfcc64@gmail.com>

    • [DH] libavfilter/vf_w3fdif.c
  • swresample/resample : do not assert compensation_distance on rebuild_filter

    17 mars 2017, par Muhammad Faiz
    swresample/resample : do not assert compensation_distance on rebuild_filter
    

    when set_compensation is called with zero sample_delta,
    compensation does not happen (because dst_incr == ideal_dst_incr)
    but compensation_distance is set

    regression since 01ebb57c03abde89bca7bdbc552917efcb8f551d

    Found-by : wm4 <nfxjfg@googlemail.com>
    Reviewed-by : wm4 <nfxjfg@googlemail.com>
    Signed-off-by : Muhammad Faiz <mfcc64@gmail.com>

    • [DH] libswresample/resample.c