Recherche avancée

Médias (0)

Mot : - Tags -/flash

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

Autres articles (29)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Le plugin : Podcasts.

    14 juillet 2010, par

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 is the first MediaSPIP stable release.
    Its official release date is June 21, 2013 and is announced here.
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

Sur d’autres sites (4333)

  • Improved the UK postcode method to filter out more invalid postcodes. Closes #682

    20 mars 2013
    Improved the UK postcode method to filter out more invalid postcodes. Closes #682
    

    Old one allows integers between 5-7 digits which is not valid.

    New one is still case insensitive and allows spaces & fixes the above issue.

  • Adding a text on top of video using libavfilter API

    19 février 2013, par prajwal

    I am trying to add a visible text ‘sampletext’ on a video and store in another file called “myvideo.mp4”

    Below is my code.(developed from *doc/examples/filtering_video.c *example)

    include

    #define _XOPEN_SOURCE 600 /* for usleep */

    #include <libavcodec></libavcodec>avcodec.h>
    #include <libavformat></libavformat>avformat.h>
    #include <libavfilter></libavfilter>avfiltergraph.h>
    #include <libavfilter></libavfilter>avcodec.h>
    #include <libavfilter></libavfilter>buffersink.h>
    #include <libavfilter></libavfilter>buffersrc.h>

    const char *filter_descr = "drawtext=fontcolor=white:fontfile=/usr/share/fonts/liberation/LiberationMono-Bold.ttf :rate=30000/1001:text=&#39;sampletext&#39;";

    static AVFormatContext *fmt_ctx;
    static AVCodecContext *dec_ctx;
    AVFilterContext *buffersink_ctx;
    AVFilterContext *buffersrc_ctx;
    AVFilterGraph *filter_graph;
    static int video_stream_index = -1;
    static int64_t last_pts = AV_NOPTS_VALUE;

    static int open_input_file(const char *filename)
    {
       int ret;
       AVCodec *dec;

       if ((ret = avformat_open_input(&amp;fmt_ctx, filename, NULL, NULL)) &lt; 0) {
           av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
           return ret;
       }

       if ((ret = avformat_find_stream_info(fmt_ctx, NULL)) &lt; 0) {
           av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n");
           return ret;
       }

       /* select the video stream */
       ret = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &amp;dec, 0);
       if (ret &lt; 0) {
           av_log(NULL, AV_LOG_ERROR, "Cannot find a video stream in the input file\n");
           return ret;
       }
       video_stream_index = ret;
       dec_ctx = fmt_ctx->streams[video_stream_index]->codec;

       /* init the video decoder */
       if ((ret = avcodec_open2(dec_ctx, dec, NULL)) &lt; 0) {
           av_log(NULL, AV_LOG_ERROR, "Cannot open video decoder\n");
           return ret;
       }

       return 0;
    }

    static int init_filters(const char *filters_descr)
    {
       char args[512];
       int ret;
       AVFilter *buffersrc  = avfilter_get_by_name("buffer");
       AVFilter *buffersink = avfilter_get_by_name("ffbuffersink");
       AVFilterInOut *outputs = avfilter_inout_alloc();
       AVFilterInOut *inputs  = avfilter_inout_alloc();
       enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
       AVBufferSinkParams *buffersink_params;

       filter_graph = avfilter_graph_alloc();

       /* buffer video source: the decoded frames from the decoder will be inserted here. */
       snprintf(args, sizeof(args),
               "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
               dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt,
               dec_ctx->time_base.num, dec_ctx->time_base.den,
               dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den);

       ret = avfilter_graph_create_filter(&amp;buffersrc_ctx, buffersrc, "in",
                                          args, NULL, filter_graph);
       if (ret &lt; 0) {
           av_log(NULL, AV_LOG_ERROR, "Cannot create buffer source\n");
           return ret;
       }

       /* buffer video sink: to terminate the filter chain. */
       buffersink_params = av_buffersink_params_alloc();
       buffersink_params->pixel_fmts = pix_fmts;
       ret = avfilter_graph_create_filter(&amp;buffersink_ctx, buffersink, "out",
                                          NULL, buffersink_params, filter_graph);
       av_free(buffersink_params);
       if (ret &lt; 0) {
           av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n");
           return ret;
       }

       /* Endpoints for the filter graph. */
       outputs->name       = av_strdup("in");
       outputs->filter_ctx = buffersrc_ctx;
       outputs->pad_idx    = 0;
       outputs->next       = NULL;

       inputs->name       = av_strdup("out");
       inputs->filter_ctx = buffersink_ctx;
       inputs->pad_idx    = 0;
       inputs->next       = NULL;

       if ((ret = avfilter_graph_parse(filter_graph, filters_descr,
                                       &amp;inputs, &amp;outputs, NULL)) &lt; 0)
           return ret;

       if ((ret = avfilter_graph_config(filter_graph, NULL)) &lt; 0)
           return ret;
       return 0;
    }

    static void save_picref(AVFilterBufferRef *picref, AVRational time_base)
    {
       int x, y;
       uint8_t *p0, *p;
       int64_t delay;
       FILE *pFile;
     char szFilename[32]="myvideo.mp4";

     // Open file
       pFile=fopen(szFilename, "wb");
     if(pFile==NULL)
       return;

       if (picref->pts != AV_NOPTS_VALUE) {
           if (last_pts != AV_NOPTS_VALUE) {
               /* sleep roughly the right amount of time;
                * usleep is in microseconds, just like AV_TIME_BASE. */
               delay = av_rescale_q(picref->pts - last_pts,
                                    time_base, AV_TIME_BASE_Q);
               if (delay > 0 &amp;&amp; delay &lt; 1000000)
                   usleep(delay);
           }
           last_pts = picref->pts;
       }
     fprintf(pFile, "P6\n%d %d\n255\n", picref->video->w, picref->video->h);
       // Write pixel data
       for (y = 0; y &lt; picref->video->h; y++) {
       p = p0;

       fwrite(picref->data[0], 1, picref->video->w, pFile);

       p0 += picref->linesize[0];
       }
     // Close file
     fclose(pFile);

    }

    int main(int argc, char **argv)
    {
       int ret;
       AVPacket packet;
       AVFrame frame;
       int got_frame;

       if (argc != 2) {
           fprintf(stderr, "Usage: %s file\n", argv[0]);
           exit(1);
       }

       avcodec_register_all();
       av_register_all();
       avfilter_register_all();

       if ((ret = open_input_file(argv[1])) &lt; 0)
           goto end;
       if ((ret = init_filters(filter_descr)) &lt; 0)
           goto end;

       /* read all packets */
       while (1) {
           AVFilterBufferRef *picref;
           if ((ret = av_read_frame(fmt_ctx, &amp;packet)) &lt; 0)
               break;

           if (packet.stream_index == video_stream_index) {
               avcodec_get_frame_defaults(&amp;frame);
               got_frame = 0;
               ret = avcodec_decode_video2(dec_ctx, &amp;frame, &amp;got_frame, &amp;packet);
               if (ret &lt; 0) {
                   av_log(NULL, AV_LOG_ERROR, "Error decoding video\n");
                   break;
               }

               if (got_frame) {
                   frame.pts = av_frame_get_best_effort_timestamp(&amp;frame);

                   /* push the decoded frame into the filtergraph */
                   if (av_buffersrc_add_frame(buffersrc_ctx, &amp;frame, 0) &lt; 0) {
                       av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n");
                       break;
                   }

                   /* pull filtered pictures from the filtergraph */
                   while (1) {
                       ret = av_buffersink_get_buffer_ref(buffersink_ctx, &amp;picref, 0);
                       if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
                           break;
                       if (ret &lt; 0)
                           goto end;

                       if (picref) {
                           save_picref(picref, buffersink_ctx->inputs[0]->time_base);
                           avfilter_unref_bufferp(&amp;picref);
                       }
                   }
               }
           }
           av_free_packet(&amp;packet);
       }
    end:
       avfilter_graph_free(&amp;filter_graph);
       if (dec_ctx)
           avcodec_close(dec_ctx);
       avformat_close_input(&amp;fmt_ctx);

       if (ret &lt; 0 &amp;&amp; ret != AVERROR_EOF) {
           char buf[1024];
           av_strerror(ret, buf, sizeof(buf));
           fprintf(stderr, "Error occurred: %s\n", buf);
           exit(1);
       }

       exit(0);
    }

    After compilation and execution, when I try to play the video using

    ffplay myvideo.mp4 *

    I am getting the following error.

    myvideo.mp4 : Invalid data found when processing input*

    i am unable to resolve the error,can anyone pls help me out in solving the error.

  • Add Korean (ko) localization. Closes gh-671

    20 mars 2013, par DexterPark
    Add Korean (ko) localization. Closes gh-671