Advanced search

Medias (91)

Other articles (55)

  • Le profil des utilisateurs

    12 April 2011, by

    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 (...)

  • Configurer la prise en compte des langues

    15 November 2010, by

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 May 2011, by

    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 (...)

On other websites (4092)

  • doc/ffmpeg: Use @code

    29 July 2015, by Michael Niedermayer
    doc/ffmpeg: Use @code
    

    Found-by: ubitux
    Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

    • [DH] doc/ffmpeg.texi
  • How to explain the given ffplay C code snippet?

    20 July 2015, by Jerikc XIONG

    The following code snippet is from ffplay:

    static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) {
       int got_frame = 0;

       do {
           int ret = -1;

           if (d->queue->abort_request)
               return -1;

           if (!d->packet_pending || d->queue->serial != d->pkt_serial) {
               AVPacket pkt;
               do {
                   if (d->queue->nb_packets == 0)
                       SDL_CondSignal(d->empty_queue_cond);
                   if (packet_queue_get(d->queue, &amp;pkt, 1, &amp;d->pkt_serial) &lt; 0)
                       return -1;
                   if (pkt.data == flush_pkt.data) {
                       avcodec_flush_buffers(d->avctx);
                       d->finished = 0;
                       d->next_pts = d->start_pts;
                       d->next_pts_tb = d->start_pts_tb;
                   }
               } while (pkt.data == flush_pkt.data || d->queue->serial != d->pkt_serial);
               av_free_packet(&amp;d->pkt);
               d->pkt_temp = d->pkt = pkt;
               d->packet_pending = 1;
           }

           switch (d->avctx->codec_type) {
               case AVMEDIA_TYPE_VIDEO:
                   ret = avcodec_decode_video2(d->avctx, frame, &amp;got_frame, &amp;d->pkt_temp);
                   if (got_frame) {
                       if (decoder_reorder_pts == -1) {
                           frame->pts = av_frame_get_best_effort_timestamp(frame);
                       } else if (decoder_reorder_pts) {
                           frame->pts = frame->pkt_pts;
                       } else {
                           frame->pts = frame->pkt_dts;
                       }
                   }
                   break;
               case AVMEDIA_TYPE_AUDIO:
                   ret = avcodec_decode_audio4(d->avctx, frame, &amp;got_frame, &amp;d->pkt_temp);
                   if (got_frame) {
                       AVRational tb = (AVRational){1, frame->sample_rate};
                       if (frame->pts != AV_NOPTS_VALUE)
                           frame->pts = av_rescale_q(frame->pts, d->avctx->time_base, tb);
                       else if (frame->pkt_pts != AV_NOPTS_VALUE)
                           frame->pts = av_rescale_q(frame->pkt_pts, av_codec_get_pkt_timebase(d->avctx), tb);
                       else if (d->next_pts != AV_NOPTS_VALUE)
                           frame->pts = av_rescale_q(d->next_pts, d->next_pts_tb, tb);
                       if (frame->pts != AV_NOPTS_VALUE) {
                           d->next_pts = frame->pts + frame->nb_samples;
                           d->next_pts_tb = tb;
                       }
                   }
                   break;
               case AVMEDIA_TYPE_SUBTITLE:
                   ret = avcodec_decode_subtitle2(d->avctx, sub, &amp;got_frame, &amp;d->pkt_temp);
                   break;
           }

           if (ret &lt; 0) {
               d->packet_pending = 0;
           } else {
               d->pkt_temp.dts =
               d->pkt_temp.pts = AV_NOPTS_VALUE;
               if (d->pkt_temp.data) {
                   if (d->avctx->codec_type != AVMEDIA_TYPE_AUDIO)
                       ret = d->pkt_temp.size;
                   d->pkt_temp.data += ret;
                   d->pkt_temp.size -= ret;
                   if (d->pkt_temp.size &lt;= 0)
                       d->packet_pending = 0;
               } else {
                   if (!got_frame) {
                       d->packet_pending = 0;
                       d->finished = d->pkt_serial; // FLAG
                   }
               }
           }
       } while (!got_frame &amp;&amp; !d->finished);

       return got_frame;
    }

    It’s difficult for me to understand the following code:

    d->finished = d->pkt_serial; // FLAG

    Can anyone help me ?

    Thanks.

  • How do I set the framerate/FPS in an FFmpeg code (C)?

    2 June 2020, by Tobias v. Brevern

    I try to encode single pictures to a .avi video. The goal is to have every picture displayed for a set amount of seconds to create a slide show. I tried my script with 10 pictures and a delay of 1/5 of a second but the output file was not even half a second long (but displayed every picture). For setting the framerate I use the time_base option of the AVCodeContext:

    &#xA;&#xA;

    ctx->time_base = (AVRational) {1, 5};

    &#xA;&#xA;

    When I use the command ffmpeg -framerate 1/3 -i img%03d.png -codec png output.avi everything works fine and I get the file I want. I use the png codec because it was the only one i tried that is playable with Windows Media Player.

    &#xA;&#xA;

    Am I missing anything here? Is there another option that has impact on the framerate?

    &#xA;&#xA;

    This is my code so far:

    &#xA;&#xA;

    Note: I use a couple of self made data structures and methodes from other classes. They are the ones written in Caps Lock. They basicly do what the name suggests but are necessary for my project. The Input Array contains the pictures that i want to encode.

    &#xA;&#xA;

    include <libavutil></libavutil>opt.h>&#xA;include <libavutil></libavutil>imgutils.h>&#xA;include <libavutil></libavutil>error.h>&#xA;&#xA;void PixmapsToAVI (ARRAY* arr, String outfile, double secs)&#xA;{&#xA;     if (arr!=nil &amp;&amp; outfile!="" &amp;&amp; secs!=0) {&#xA;         AVCodec* codec = avcodec_find_encoder(AV_CODEC_ID_PNG);&#xA;         if (codec) {&#xA;             int width  = -1;&#xA;             int height = -1;&#xA;             int ret = 0;&#xA;&#xA;             AVCodecContext* ctx = NULL;&#xA;             ctx = avcodec_alloc_context3(codec);&#xA;             AVFrame* frame = av_frame_alloc();&#xA;             AVPacket* pkt  = av_packet_alloc();&#xA;&#xA;             FILE* file = fopen(outfile, "wb");&#xA;&#xA;             ARRAYELEMENT* e;&#xA;             int count = 0;&#xA;             forall (e, *arr) {&#xA;                 BITMAP bitmap (e->value, false);&#xA;                 if (width &lt; 0) {&#xA;                     width  = bitmap.Width();&#xA;                     height = bitmap.Height();&#xA;&#xA;                     ctx->width = width;&#xA;                     ctx->height = height;&#xA;                     ctx->time_base = (AVRational){1, 5};&#xA;                     ctx->framerate = (AVRational){5, 1};&#xA;                     ctx->pix_fmt = AV_PIX_FMT_RGB24;&#xA;                     ret = avcodec_open2(ctx, codec, NULL);&#xA;&#xA;                     frame->width  = width;&#xA;                     frame->height = height;&#xA;                     frame->format = ctx->pix_fmt;&#xA;                     av_opt_set(ctx->priv_data, "preset", "slow", 1);&#xA;&#xA;                 }&#xA;                 ret  = av_frame_get_buffer(frame, 1);&#xA;                 frame->linesize[0] = width*3;&#xA;&#xA;                 bitmap.Convert32();&#xA;                 byte* pixels = bitmap.PixelsRGB();      &#xA;&#xA;//The two methodes above convert the Pixmap into the RGB structure we need&#xA;//They are not needed to get an output file but are needed to get one that makes sense&#xA;&#xA;                     fflush(stdout);&#xA;                     int writeable = av_frame_make_writable(frame);&#xA;                     if (writeable>=0) {&#xA;                         for(int i=0; i&lt;(height*width*3); i&#x2B;&#x2B;){&#xA;                             frame->data[0][i] = pixels[i];&#xA;                         }&#xA;                     }&#xA;                     ret = avcodec_send_frame(ctx, frame);&#xA;                     for(int i=0; i= 0) {&#xA;                       ret = avcodec_receive_packet(ctx, pkt);&#xA;                     }&#xA;                     count&#x2B;&#x2B;;&#xA;                 avcodec_receive_packet(ctx, pkt);&#xA;                 fwrite(pkt->data, 1, pkt->size, file);&#xA;                 fflush(stdout);&#xA;                 av_packet_unref(pkt);&#xA;             }&#xA;             fclose(file);&#xA;             avcodec_free_context(&amp;ctx);&#xA;             av_frame_free(&amp;frame);&#xA;             av_packet_free(&amp;pkt);&#xA;&#xA;         }&#xA;     }&#xA;} &#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;

    &#xA;