Recherche avancée

Médias (91)

Autres articles (58)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    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 (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (10344)

  • How to resample an audio with ffmpeg API ?

    13 mai 2016, par tangren

    I’d like to decode audio file(.wav .aac etc.) into raw data(pcm) and then resample it with ffmpeg API.

    I try to do it with the help of the official examples. However, the result file always loses a little data at the end of the file compared to the file generated by ffmpeg command :

    ffmpeg -i audio.wav -f s16le -ac 1 -ar 8000 -acodec pcm_s16le out.pcm.

    In this case, the input audio metadata : pcm_s16le, 16000 Hz, 1 channels, s16, 256 kb/s

    And there are 32 bites lost at the end of result file.

    What’s more, I’d like to process audios in memory, so how do I calculate the size of audio’s raw data (pcm) ?

    My code :

    #include <libavutil></libavutil>opt.h>
    #include <libavutil></libavutil>imgutils.h>
    #include <libavutil></libavutil>samplefmt.h>
    #include <libavutil></libavutil>timestamp.h>
    #include <libavformat></libavformat>avformat.h>
    #include <libavutil></libavutil>channel_layout.h>
    #include <libswresample></libswresample>swresample.h>

    int convert_to_PCM(const char* src_audio_filename, const char* dst_pcm_filename, int dst_sample_rate)
    {
       FILE *audio_dst_file = NULL;

       // for demuxing and decoding
       int ret = 0, got_frame, decoded, tmp;
       AVFormatContext *fmt_ctx = NULL;
       AVCodecContext *audio_dec_ctx;
       AVStream *audio_stream = NULL;
       int audio_stream_idx = -1;
       AVFrame *frame = NULL;
       AVPacket pkt;

       // for resampling
       struct SwrContext *swr_ctx = NULL;
       int src_sample_rate;
       uint8_t **dst_data = NULL;
       int dst_nb_samples, max_dst_nb_samples;
       enum AVSampleFormat src_sample_fmt, dst_sample_fmt = AV_SAMPLE_FMT_S16;
       int nb_channels = 1;
       int dst_bufsize, dst_linesize;
       int64_t src_ch_layout, dst_ch_layout;
       dst_ch_layout = src_ch_layout = av_get_default_channel_layout(1);

       av_register_all();

       if (avformat_open_input(&amp;fmt_ctx, src_audio_filename, NULL, NULL) &lt; 0) {
           fprintf(stderr, "Could not open source file %s\n", src_audio_filename);
           return 1;
       }

       /* retrieve stream information */
       if (avformat_find_stream_info(fmt_ctx, NULL) &lt; 0) {
           fprintf(stderr, "Could not find stream information\n");
           return 1;
       }

       if (open_codec_context(&amp;audio_stream_idx, fmt_ctx, AVMEDIA_TYPE_AUDIO) >= 0) {
           audio_stream = fmt_ctx->streams[audio_stream_idx];
           audio_dec_ctx = audio_stream->codec;
           audio_dst_file = fopen(dst_pcm_filename, "wb");
           if (!audio_dst_file) {
               fprintf(stderr, "Could not open destination file %s\n", dst_pcm_filename);
               ret = 1;
               goto end;
           }
       }

       /* dump input information to stderr */
       av_dump_format(fmt_ctx, 0, src_audio_filename, 0);

       if (!audio_stream) {
           fprintf(stderr, "Could not find audio stream in the input, aborting\n");
           ret = 1;
           goto end;
       }

       src_sample_rate = audio_dec_ctx->sample_rate;
       if (src_sample_rate != dst_sample_rate) {
           /* create resampler context */
           swr_ctx = swr_alloc();
           if (!swr_ctx) {
               fprintf(stderr, "Could not allocate resampler context\n");
               ret = AVERROR(ENOMEM);
               goto end;
           }
           src_sample_fmt = audio_dec_ctx->sample_fmt;


           /* set options */
           av_opt_set_int(swr_ctx, "in_channel_layout",    src_ch_layout, 0);
           av_opt_set_int(swr_ctx, "in_sample_rate",       src_sample_rate, 0);
           av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", src_sample_fmt, 0);

           av_opt_set_int(swr_ctx, "out_channel_layout",    dst_ch_layout, 0);
           av_opt_set_int(swr_ctx, "out_sample_rate",       dst_sample_rate, 0);
           av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", dst_sample_fmt, 0);

           /* initialize the resampling context */
           if ((ret = swr_init(swr_ctx)) &lt; 0) {
               fprintf(stderr, "Failed to initialize the resampling context\n");
               goto end;
           }

       }

       frame = av_frame_alloc();
       if (!frame) {
           fprintf(stderr, "Could not allocate frame\n");
           ret = AVERROR(ENOMEM);
           goto end;
       }

       /* initialize packet, set data to NULL, let the demuxer fill it */
       av_init_packet(&amp;pkt);
       pkt.data = NULL;
       pkt.size = 0;

       printf("Convert audio from file '%s' into '%s'\n", src_audio_filename, dst_pcm_filename);

       /* read frames from the file */
       while (av_read_frame(fmt_ctx, &amp;pkt) >= 0) {
           AVPacket orig_pkt = pkt;
           do {
               decoded = pkt.size;
               got_frame = 0;
               tmp = 0;
               /* decode audio frame */
               tmp = avcodec_decode_audio4(audio_dec_ctx, frame, &amp;got_frame, &amp;pkt);
               if (tmp &lt; 0) {
                   fprintf(stderr, "Error decoding audio frame (%s)\n", av_err2str(tmp));
                   break;
               }
               decoded = FFMIN(tmp, pkt.size);
               if (got_frame) {
                   if (swr_ctx) {
                       if (dst_data == NULL) {
                           max_dst_nb_samples = dst_nb_samples = av_rescale_rnd(frame->nb_samples, dst_sample_rate, src_sample_rate, AV_ROUND_UP);
                           ret = av_samples_alloc_array_and_samples(&amp;dst_data, &amp;dst_linesize, nb_channels,
                                                                   dst_nb_samples, dst_sample_fmt, 0);
                           if (ret &lt; 0) {
                               fprintf(stderr, "Could not allocate destination samples\n");
                               goto end;
                           }
                       }
                       dst_nb_samples = av_rescale_rnd(swr_get_delay(swr_ctx, src_sample_rate) + frame->nb_samples, dst_sample_rate, src_sample_rate, AV_ROUND_UP);
                       if (dst_nb_samples > max_dst_nb_samples) {
                           av_freep(&amp;dst_data[0]);
                           ret = av_samples_alloc(dst_data, &amp;dst_linesize, nb_channels, dst_nb_samples, dst_sample_fmt, 1);
                           if (ret &lt; 0)
                               break;
                           max_dst_nb_samples = dst_nb_samples;
                       }

                       /* convert to destination format */
                       ret = swr_convert(swr_ctx, dst_data, dst_nb_samples, (const uint8_t **)frame->data, frame->nb_samples);
                       if (ret &lt; 0) {
                           fprintf(stderr, "Error while converting\n");
                           goto end;
                       }
                       dst_bufsize = av_samples_get_buffer_size(&amp;dst_linesize, nb_channels, ret, dst_sample_fmt, 1);
                       if (dst_bufsize &lt; 0) {
                           fprintf(stderr, "Could not get sample buffer size\n");
                           goto end;
                       }
                       printf("Decoded size: %d, dst_nb_samples: %d, converted size: %d, sample buffer size: %d\n", decoded, dst_nb_samples, ret, dst_bufsize);
                       fwrite(dst_data[0], 1, dst_bufsize, audio_dst_file);
                   }
                   else {
                       size_t unpadded_linesize = frame->nb_samples * av_get_bytes_per_sample(frame->format);
                       fwrite(frame->extended_data[0], 1, unpadded_linesize, audio_dst_file);
                   }
               }

               if (decoded &lt; 0)
                   break;
               pkt.data += tmp;
               pkt.size -= tmp;
           } while (pkt.size > 0);
           av_packet_unref(&amp;orig_pkt);
       }

       printf("Convert succeeded.\n");

    end:
       avcodec_close(audio_dec_ctx);
       avformat_close_input(&amp;fmt_ctx);
       if (audio_dst_file)
           fclose(audio_dst_file);
       av_frame_free(&amp;frame);
       if (dst_data)
           av_freep(&amp;dst_data[0]);
       av_freep(&amp;dst_data);
       swr_free(&amp;swr_ctx);

       return ret;
    }

    static int open_codec_context(int *stream_idx,
                               AVFormatContext *fmt_ctx, enum AVMediaType type)
    {
       int ret, stream_index;
       AVStream *st;
       AVCodecContext *dec_ctx = NULL;
       AVCodec *dec = NULL;
       AVDictionary *opts = NULL;

       ret = av_find_best_stream(fmt_ctx, type, -1, -1, NULL, 0);
       if (ret &lt; 0) {
           fprintf(stderr, "Could not find %s stream in input file.\n",
                   av_get_media_type_string(type));
           return ret;
       } else {
           stream_index = ret;
           st = fmt_ctx->streams[stream_index];

           /* find decoder for the stream */
           dec_ctx = st->codec;
           dec = avcodec_find_decoder(dec_ctx->codec_id);
           if (!dec) {
               fprintf(stderr, "Failed to find %s codec\n",
                       av_get_media_type_string(type));
               return AVERROR(EINVAL);
           }

           if ((ret = avcodec_open2(dec_ctx, dec, &amp;opts)) &lt; 0) {
               fprintf(stderr, "Failed to open %s codec\n",
                       av_get_media_type_string(type));
               return ret;
           }
           *stream_idx = stream_index;
       }

       return 0;
    }

    static int get_format_from_sample_fmt(const char **fmt,
                                       enum AVSampleFormat sample_fmt)
    {
       int i;
       struct sample_fmt_entry {
           enum AVSampleFormat sample_fmt; const char *fmt_be, *fmt_le;
       } sample_fmt_entries[] = {
           { AV_SAMPLE_FMT_U8,  "u8",    "u8"    },
           { AV_SAMPLE_FMT_S16, "s16be", "s16le" },
           { AV_SAMPLE_FMT_S32, "s32be", "s32le" },
           { AV_SAMPLE_FMT_FLT, "f32be", "f32le" },
           { AV_SAMPLE_FMT_DBL, "f64be", "f64le" },
       };
       *fmt = NULL;

       for (i = 0; i &lt; FF_ARRAY_ELEMS(sample_fmt_entries); i++) {
           struct sample_fmt_entry *entry = &amp;sample_fmt_entries[i];
           if (sample_fmt == entry->sample_fmt) {
               *fmt = AV_NE(entry->fmt_be, entry->fmt_le);
               return 0;
           }
       }

       fprintf(stderr,
               "sample format %s is not supported as output format\n",
               av_get_sample_fmt_name(sample_fmt));
       return -1;
    }
  • Join us at MatomoCamp 2024 world tour edition

    13 novembre 2024, par Daniel Crough — Uncategorized

    Join us at MatomoCamp 2024 world tour edition, our online conference dedicated to Matomo Analytics—the leading open-source web analytics platform that prioritises data privacy.

    • 🗓️ Date : 14 November 2024
    • 🌐 Format : 24-hour virtual conference accessible worldwide
    • 💰 Cost : Free and no need to register

    Event highlights

    Opening ceremony

    Begin the day with a welcome from Ronan Chardonneau, co-organiser of MatomoCamp and customer success manager at Matomo.

    View session | iCal link

    Keynote : “Matomo by its creator”

    Attend a special session with Matthieu Aubry, the founder of Matomo Analytics. Learn about the platform’s evolution and future developments.

    View session | iCal link

    Explore MatomoCamp 2024’s diverse tracks and topics

    MatomoCamp 2024 offers a wide range of topics across several tracks, including using Matomo, integration, digital analytics, privacy, plugin development, system administration, business, other free analytics, use cases, and workshops and panel talks.

    Featured sessions

    1. Using AI to fetch raw data with Python

    Speaker : Ralph Conti
    Time : 14 November, 12:00 PM UTC

    Discover how to combine AI and Matomo’s API to create unique reporting solutions. Leverage Python for advanced data analysis and unlock new possibilities in your analytics workflow.

    View session | iCal link

    2. Supercharge Matomo event tracking with custom reports

    Speaker : Thomas Steur
    Time : 14 November, 2:00 PM UTC

    Learn how to enhance event tracking and simplify data analysis using Matomo’s custom reports feature. This session will help you unlock the full potential of your event data.

    View session | iCal link

    3. GDPR with AI and AI Act

    Speaker : Stefanie Bauer
    Time : 14 November, 4:00 PM UTC

    Navigate the complexities of data protection requirements for AI systems under GDPR. Explore the implications of the new AI Act and receive practical tips for compliance.

    View session | iCal link

    4. A new data mesh era !

    Speaker : Jorge Powers
    Time : 14 November, 4:00 PM UTC

    Explore how Matomo supports the data mesh approach, enabling decentralised data ownership and privacy-focused analytics. Learn how to empower teams to manage and analyse data without third-party reliance.

    View session | iCal link

    5. Why Matomo has to create a MTM server side : The future of data privacy and user tracking

    Panel discussion
    Time : 14 November, 6:00 PM UTC

    Join experts in a discussion on the necessity of server-side tag management for enhanced privacy and compliance. Delve into the future of data privacy and user tracking.

    View session | iCal link

    6. Visualisation of Matomo data using external tools

    Speaker : Leticia Rodríguez Morado
    Time : 14 November, 8:00 PM UTC

    Learn how to create compelling dashboards using Grafana and Matomo data. Enhance your data visualisation skills and gain better insights.

    View session | iCal link

    7. Keep it simple : Tracking what matters with Matomo

    Speaker : Scott Fillman
    Time : 14 November, 9:00 PM UTC

    Discover how to focus on essential metrics and simplify your analytics setup for more effective insights. Learn tactics for a powerful, streamlined Matomo configuration.

    View session | iCal link

    Stay connected

    Stay updated with the latest news and announcements :

    Don’t miss out

    MatomoCamp 2024 world tour edition is more than a conference ; it’s a global gathering shaping the future of ethical analytics. Whether you aim to enhance your skills, stay informed about industry trends, or network with professionals worldwide, this event offers valuable opportunities.

    For any enquiries, please contact us at info@matomocamp.org. We look forward to your participation.

  • FFMPEG PNG sequence into mkv cause "inflate returned error -3" every 600-800 frames [closed]

    30 novembre 2023, par sergey9295

    I am new to ffmpeg. I try to use it for creating videos from png sequences. I have uncompressed pngs. All of them rgb24 format.

    &#xA;

    But during encoding process I get inflate errors. I compared PNG and video frame by frame. And video have approximately 1 dupe frame every 600-800 frames instead of the ones that should be on that places. I tried another codecs, tried to clear png's EXIF(it made things even worse), made sure that memory was enough. Doesn't matter.

    &#xA;

    The worst part is that this errors are pretty random. I encode one sequence 3 times and get 3 different sets of error-causing frames.

    &#xA;

    FFMPEG was downloaded from official site.

    &#xA;

    PS C:\Users\sergey9295\Desktop\Upscaler\bin> ./ffmpeg -framerate 24000/1001 -i 24o/frame%04d.png -c:v libx264 -qp 0 -r 24000/1001 -pix_fmt yuv420p BC108K.mkv&#xA;ffmpeg version N-112872-g67ce690bc6-20231128 Copyright (c) 2000-2023 the FFmpeg developers&#xA;  built with gcc 13.2.0 (crosstool-NG 1.25.0.232_c175b21)&#xA;  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20231128&#xA;  libavutil      58. 32.100 / 58. 32.100&#xA;  libavcodec     60. 35.100 / 60. 35.100&#xA;  libavformat    60. 18.100 / 60. 18.100&#xA;  libavdevice    60.  4.100 / 60.  4.100&#xA;  libavfilter     9. 13.100 /  9. 13.100&#xA;  libswscale      7.  6.100 /  7.  6.100&#xA;  libswresample   4. 13.100 /  4. 13.100&#xA;  libpostproc    57.  4.100 / 57.  4.100&#xA;Input #0, image2, from &#x27;24o/frame%04d.png&#x27;:&#xA;  Duration: 00:01:32.09, start: 0.000000, bitrate: N/A&#xA;  Stream #0:0: Video: png, rgb24(pc, gbr/bt709/iec61966-2-1), 7680x4320, 23.98 fps, 23.98 tbr, 23.98 tbn&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))&#xA;Press [q] to stop, [?] for help&#xA;[libx264 @ 00000231363c6280] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2&#xA;[libx264 @ 00000231363c6280] profile High 4:4:4 Predictive, level 6.0, 4:2:0, 8-bit&#xA;[libx264 @ 00000231363c6280] 64 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=0 mixed_ref=1 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0&#xA;Output #0, matroska, to &#x27;BC108K.mkv&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf60.18.100&#xA;  Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p(tv, unknown/bt709/iec61966-2-1, progressive), 7680x4320, q=2-31, 23.98 fps, 1k tbn&#xA;    Metadata:&#xA;      encoder         : Lavc60.35.100 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A&#xA;[png @ 00000231363c8880] inflate returned error -301:02.72 bitrate=698356.0kbits/s speed=0.171x&#xA;[vist#0:0/png @ 00000231363c16c0] Error submitting packet to decoder: Generic error in an external library&#xA;[png @ 00000231363c8880] inflate returned error -301:15.24 bitrate=679969.1kbits/s dup=1 drop=0 speed=0.172x&#xA;[vist#0:0/png @ 00000231363c16c0] Error submitting packet to decoder: Generic error in an external library3x&#xA;[png @ 00000231363f32c0] inflate returned error -301:16.65 bitrate=694583.2kbits/s dup=2 drop=0 speed=0.171x&#xA;[vist#0:0/png @ 00000231363c16c0] Error submitting packet to decoder: Generic error in an external library1x&#xA;[png @ 000002313646a100] inflate returned error -301:20.78 bitrate=742902.6kbits/s dup=3 drop=0 speed=0.167x&#xA;[vist#0:0/png @ 00000231363c16c0] Error submitting packet to decoder: Generic error in an external library6x&#xA;[png @ 000002313646ea00] inflate returned error -301:26.92 bitrate=839679.5kbits/s dup=4 drop=0 speed=0.159x&#xA;[vist#0:0/png @ 00000231363c16c0] Error submitting packet to decoder: Generic error in an external library8x&#xA;[png @ 00000231363cc740] inflate returned error -301:29.38 bitrate=874703.4kbits/s dup=5 drop=0 speed=0.156x&#xA;[vist#0:0/png @ 00000231363c16c0] Error submitting packet to decoder: Generic error in an external library6x&#xA;[out#0/matroska @ 00000231363a7200] video:9827779kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000442%&#xA;frame= 2208 fps=3.8 q=-1.0 Lsize= 9827822kB time=00:01:32.05 bitrate=874625.3kbits/s dup=6 drop=0 speed=0.158x&#xA;

    &#xA;

    IMO the problem is zlib from libpng. But I don't have skills to recompile it with libspng that doesn't require zlib. Maybe there is a ffmpeg version without this error ?

    &#xA;