Recherche avancée

Médias (91)

Autres articles (35)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

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

Sur d’autres sites (6253)

  • avcodec/vvcdec : misc, remove unused ALFParams.applied

    17 juin 2024, par Nuo Mi
    avcodec/vvcdec : misc, remove unused ALFParams.applied
    
    • [DH] libavcodec/vvc/ctu.h
    • [DH] libavcodec/vvc/filter.c
  • When using ffmpeg api, the encoded gif is output to the dynamically applied buffer

    5 septembre 2023, par yangjinhui2936

    Purpose:I want to use ffmpeg to encode data from rbg8 to gif format.Currently can be encoded into file output.

    


    But I don't know how to store the gif directly in the buffer instead of saving it in the file.

    


    Below is the text of the code:
input_w560_h1280.rgb8

    


    #include &#xA;#include &#xA;#include &#xA;#include &#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavutil></libavutil>imgutils.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include <libavdevice></libavdevice>avdevice.h>&#xA;&#xA;#define CONFIG_FBDEV_OUTDEV 1&#xA;#define GET_DATA_TO_BUFF 0&#xA;&#xA;int readFileToBuffer(uint8_t *dst, const char* filename, long* fileSize) {&#xA;    FILE* file = fopen(filename, "rb");&#xA;    if (!file || dst == NULL) {&#xA;        fprintf(stderr, "cannot open file: %s %p\n", filename, dst);&#xA;        return -1;&#xA;    }&#xA;&#xA;    fseek(file, 0, SEEK_END);&#xA;    *fileSize = ftell(file);&#xA;    fseek(file, 0, SEEK_SET);&#xA;&#xA;    uint8_t *buffer = NULL;&#xA;    buffer = dst;&#xA;    if (!buffer) {&#xA;        fprintf(stderr, "buffer error\n");&#xA;        fclose(file);&#xA;        return -1;&#xA;    }&#xA;&#xA;    // fread file to buffer&#xA;    if (fread(buffer, 1, *fileSize, file) != *fileSize) {&#xA;        fprintf(stderr, "read file failed size %ld\n", *fileSize);&#xA;        fclose(file);&#xA;        free(buffer);&#xA;        return -1;&#xA;    }&#xA;&#xA;    fclose(file);&#xA;    return 0;&#xA;}&#xA;&#xA;int writeBufferToFile(const char* filename, uint8_t* buffer, long bufferSize) {&#xA;    FILE* file = fopen(filename, "wb");&#xA;    if (!file) {&#xA;        fprintf(stderr, "cannot open: %s\n", filename);&#xA;        return -1;&#xA;    }&#xA;&#xA;    if (fwrite(buffer, 1, bufferSize, file) != bufferSize) {&#xA;        fprintf(stderr, "cannot fwrite\n");&#xA;        fclose(file);&#xA;        return -1;&#xA;    }&#xA;&#xA;    fclose(file);&#xA;    return 0;&#xA;}&#xA;&#xA;int main() {&#xA;    const char *output_filename = "output.gif";&#xA;    const char *input_filename = "input_w560_h1280.rgb8";&#xA;    int width = 560;&#xA;    int height = 1280;&#xA;&#xA;    avcodec_register_all();&#xA;    avdevice_register_all();&#xA;    av_register_all();&#xA;&#xA;    av_log_set_level(AV_LOG_MAX_OFFSET);&#xA;&#xA;    AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_GIF);&#xA;    if (!codec) {&#xA;        printf("GIF encoder not found.\n");&#xA;        return 1;&#xA;    }&#xA;    &#xA;    AVCodecContext *codecContext = avcodec_alloc_context3(codec);&#xA;    if (!codecContext) {&#xA;        printf("Could not allocate codec codecContext.\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    codecContext->width = width;&#xA;    codecContext->height = height;&#xA;    codecContext->pix_fmt = AV_PIX_FMT_RGB8;&#xA;    codecContext->time_base = (AVRational){1, 25};&#xA;    &#xA;    if (avcodec_open2(codecContext, codec, NULL) &lt; 0) {&#xA;        printf("Could not open codec.\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    AVFormatContext *outputFormatContext = NULL;&#xA;    if (avformat_alloc_output_context2(&amp;outputFormatContext, NULL, NULL, output_filename) &lt; 0) {&#xA;        printf("Could not allocate output format codecContext.\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    AVStream *stream = avformat_new_stream(outputFormatContext, NULL);&#xA;    if (!stream) {&#xA;        printf("Could not create stream.\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    AVCodecParameters *codec_params = stream->codecpar;&#xA;    avcodec_parameters_from_context(codec_params, codecContext);&#xA;&#xA;    if (avio_open(&amp;outputFormatContext->pb, output_filename, AVIO_FLAG_WRITE) &lt; 0) {&#xA;        printf("Could not open output file.\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    /* write header for output */&#xA;    if(avformat_write_header(outputFormatContext, NULL) &lt; 0)&#xA;    {&#xA;        printf("avformat_write_header failed\n");&#xA;    }&#xA;&#xA;    // creat and init frame&#xA;    AVFrame *frame = av_frame_alloc();&#xA;    frame->format = AV_PIX_FMT_RGB8;&#xA;    frame->width = width;&#xA;    frame->height = height;&#xA;    /* check frame buff */&#xA;    if (av_frame_get_buffer(frame, 0) &lt; 0) {&#xA;        printf("Failed to allocate frame buffer.\n");&#xA;        return -1;&#xA;    }&#xA;&#xA;    /* read rgb data to  frame->data[0] */&#xA;    uint8_t *rgb8data = (uint8_t *)av_malloc(width * height * 3);&#xA;    long read_size = 0;&#xA;    int ret = readFileToBuffer(rgb8data, input_filename, &amp;read_size);&#xA;    if (ret != 0 || read_size == 0)&#xA;    {&#xA;        printf("error argbData %p read_size %ld\n", rgb8data, read_size);&#xA;    }&#xA;    /* cp input data to frame */&#xA;    av_image_copy_plane(frame->data[0], frame->linesize[0], rgb8data, width, width, height);&#xA;&#xA;    // Init IOcontext (try to get the gif stream)&#xA;    #if GET_DATA_TO_BUFF&#xA;    AVIOContext *outputIoContext = NULL;&#xA;&#xA;    if (avio_open_dyn_buf(&amp;outputIoContext) &lt; 0) {&#xA;        printf("Failed to open output buffer.\n");&#xA;        return -1;&#xA;    }&#xA;    #endif&#xA;    // Encoding loop (simulated frames)&#xA;    AVPacket pkt;&#xA;    av_init_packet(&amp;pkt);&#xA;    pkt.data = NULL;&#xA;    pkt.size = 0;&#xA;    avcodec_send_frame(codecContext, frame);&#xA;&#xA;    while (avcodec_receive_packet(codecContext, &amp;pkt) == 0) {&#xA;        pkt.stream_index = stream->index;&#xA;        #if GET_DATA_TO_BUFF // try to get the gif stream&#xA;        avio_write(outputIoContext, pkt.data, pkt.size);&#xA;        #endif&#xA;        av_write_frame(outputFormatContext, &amp;pkt);&#xA;        av_packet_unref(&amp;pkt);&#xA;    }&#xA;    /* write end */&#xA;    av_write_trailer(outputFormatContext);&#xA;    // try to get the gif stream&#xA;    #if GET_DATA_TO_BUFF&#xA;    uint8_t *outputBuffer;&#xA;    int outputBufferSize = avio_close_dyn_buf(outputIoContext, &amp;outputBuffer);&#xA;    writeBufferToFile("bf_1.gif", outputBuffer, outputBufferSize);&#xA;    #endif&#xA;    /* free */&#xA;    avformat_close_input(&amp;outputFormatContext);&#xA;    av_frame_free(&amp;frame);&#xA;    avcodec_free_context(&amp;codecContext);&#xA;    av_free(rgb8data);&#xA;&#xA;    return 0;&#xA;}&#xA;

    &#xA;

    MAKEFILE

    &#xA;

    CC = gcc&#xA;CFLAGS = -Wall -g&#xA;CFLAGS &#x2B;= -I ../output/include&#xA;CFLAGS &#x2B;= -L ../output/lib&#xA;LIBS = -l:libavdevice.a -l:libavformat.a -l:libavcodec.a -lavfilter -lswresample -lswscale -l:libavutil.a -lpthread -lz  -lbz2 -lm -ldl&#xA;&#xA;all: encode_to_gif&#xA;&#xA;encode_to_gif: encode_to_gif.c&#xA;    $(CC) $(CFLAGS) -o $@ $&lt; $(LIBS)&#xA;

    &#xA;

    Tried The content in the macro definition is the relevant solution I found online. Unfortunately, the data I got is in original rgb8 format, not in gif format.ffmpeg writes data to file and Data dumped from buffer&#xA;The data dumped from the buffer seems to have no gif header

    &#xA;

    My expected result I want to output the encoded gif directly to the buffer,but i don't know what to do.

    &#xA;

    &#xA;

  • I want to create a video from images with transition applied

    29 mars 2023, par Kaleem Abbas

    I want to load images and create video with transition applied. I was able to create video but transitions are not being applied.

    &#xA;

    ffmpeg -framerate 1/5 -start_number 1 -i "D :\video\photo\images%%d.jpg" -filter_complex "[0:v]split=5[0a][0b][0c][0d][0e] ;[0a]format=yuva420p,hflip[flip0] ;[0b]format=yuva420p[bg] ;[0c]format=yuva420p[bg1] ;[0d]format=yuva420p[bg2] ;[0e]format=yuva420p,hflip[flip1] ;[bg][flip0]overlay=x='min(-w*(t-1.5),0)':shortest=1[bg0] ;[bg0][bg1]overlay=x='min(-w*(t-0.5),0)':shortest=1,drawbox=t=fade:enable='between(t,0,1)':color=white[bg01] ;[bg01][flip1]overlay=x='min(-w*(t),0)':shortest=1,drawbox=t=fade:enable='between(t,0,1)':color=white[bg1] ;[bg1][bg2]overlay=x='min(-w*(t+0.5),0)':shortest=1,drawbox=t=fade:enable='between(t,0,1)':color=white[bg12] ;[bg12][1:v]overlay=shortest=1:x='if(gte(t,1),0,-w+(tw))':y=0,drawbox=t=fade:enable='between(t,0,1)':color=white[video]" -map "[video]" -c:v libx264 -crf 18 -preset veryfast -t 5 -vf "fade=t=out:st=4:d=1:alpha=1, wipe=w=0.5:h=0:y='H/2':x='if(gte(t,1),0,W-wt/2)':d=1" output.mp4

    &#xA;