Recherche avancée

Médias (3)

Mot : - Tags -/pdf

Autres articles (35)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

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

Sur d’autres sites (5638)

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

  • No module named 'skvideo.io.ffmpeg' in the project

    12 juillet 2024, par kyobo

    Even though I have installed the scikit-video and installed ffmpeg, I still meet this problem :
    &#xA;No module named &#x27;skvideo.io.ffmpeg

    &#xA;

    Output :

    &#xA;

    (sd) huishi@huishi:~/workspace/projectsideo_python$ **pip install scikit-video**&#xA;Requirement already satisfied: scikit-video in /home/huishi/anaconda3/envs/sdb/python3.8/site-packages (1.1.11)&#xA;Requirement already satisfied: scipy in /home/huishi/anaconda3/envs/sdb/python3.8/site-packages (from scikit-video) (1.8.1)&#xA;Requirement already satisfied: pillow in /home/huishi/anaconda3/envs/sdb/python3.8/site-packages (from scikit-video) (9.2.0)&#xA;Requirement already satisfied: numpy in /home/huishi/anaconda3/envs/sdb/python3.8/site-packages (from scikit-video) (1.23.0)&#xA;(sd) huishi@huishi:~/workspace/projectsideo_python$ **sudo apt-get install ffmpeg**&#xA;正在读取软件包列表... 完成&#xA;正在分析软件包的依赖关系树       &#xA;正在读取状态信息... 完成       &#xA;ffmpeg 已经是最新版 (7:3.4.11-0ubuntu0.1)。&#xA;下列软件包是自动安装的并且现在不需要了:&#xA;  docker-scan-plugin gir1.2-goa-1.0 gir1.2-snapd-1&#xA;使用&#x27;sudo apt autoremove&#x27;来卸载它(它们)。&#xA;升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 20 个软件包未被升级。&#xA;(sd) huishi@huishi:~/workspace/projectsideo_python$ python RabbitMqUtils.py &#xA;The license has expired.&#xA;/home/huishi/workspace/projectsideo_python/train_resource/train_split.py:12: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.&#xA;  tr_configs = yaml.load(f)&#xA;INFO: Created TensorFlow Lite XNNPACK delegate for CPU.&#xA;/home/huishi/anaconda3/envs/sdb/python3.8/site-packages/skvideo/__init__.py:306: UserWarning: ffmpeg/ffprobe not found in path: /usr/local/bin&#xA;  warnings.warn("ffmpeg/ffprobe not found in path: " &#x2B; str(path), UserWarning)&#xA;Traceback (most recent call last):&#xA;  File "RabbitMqUtils.py", line 17, in <module>&#xA;    from video_postprocess import post_Process&#xA;  File "/home/huishi/workspace/projectsideo_pythonideo_postprocess/post_Process.py", line 12, in <module>&#xA;    import skvideo.io&#xA;  File "/home/huishi/anaconda3/envs/sdb/python3.8/site-packages/skvideo/io/__init__.py", line 8, in <module>&#xA;    from .ffmpeg import *&#xA;ModuleNotFoundError: **No module named &#x27;skvideo.io.ffmpeg&#x27;**&#xA;(sd) huishi@huishi:~/workspace/projectsideo_python$&#xA;</module></module></module>

    &#xA;

    I have tried to upgrade pip and skvideo but it doesn't work.

    &#xA;

    How can I solve this problem ?

    &#xA;

  • nginx rtmp-module can't execute ffmpeg

    6 juin 2023, par Nasir

    I am having an issue with nginx-rtmp-module exec ffmpeg command. i have followed the example on &#xA;www.github.com/arut/nginx-rtmp-module

    &#xA;&#xA;

    /home/junaid/bin/ffmpeg -f video4linux2 -i /dev/video1 -c:v libx264 -an -f flv rtmp://127.0.0.1:1935/myapp/mystream&#xA;

    &#xA;&#xA;

    the command is working fine in terminal

    &#xA;&#xA;

    Config file :

    &#xA;&#xA;

    rtmp {&#xA;server {&#xA;    listen 1935;&#xA;    ping 30s;&#xA;    notify_method get;&#xA;&#xA;    application myapp {&#xA;    live on;&#xA;    allow play all;&#xA;    exec_static /home/junaid/bin/ffmpeg -f video4linux2 -i /dev/video1 -c:v libx264 -an -f flv rtmp://127.0.0.1:1935/myapp/mystream;      &#xA; }&#xA;}&#xA;

    &#xA;&#xA;

    Error log :&#xA;http://www.codepad.org/enD4wlZ9

    &#xA;&#xA;

    I have tried :

    &#xA;&#xA;

      &#xA;
    • nginx running as root (have permission to execute ffmpeg)
    • &#xA;

    • using ip instead of localhost
    • &#xA;

    • using complete path to ffmpeg
    • &#xA;

    • executing bash file (having ffmpeg and echo commands : echo commands execute just fine) from nginx
    • &#xA;

    &#xA;&#xA;

    please help me resolve this issue

    &#xA;