Recherche avancée

Médias (91)

Autres articles (22)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Problèmes fréquents

    10 mars 2010, par

    PHP et safe_mode activé
    Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
    La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site

  • Liste des distributions compatibles

    26 avril 2011, par

    Le tableau ci-dessous correspond à la liste des distributions Linux compatible avec le script d’installation automatique de MediaSPIP. Nom de la distributionNom de la versionNuméro de version Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    Si vous souhaitez nous aider à améliorer cette liste, vous pouvez nous fournir un accès à une machine dont la distribution n’est pas citée ci-dessus ou nous envoyer le (...)

Sur d’autres sites (2821)

  • Collect AVFrames into buffer

    24 novembre 2020, par mgukov

    I'm collect AVFrames into array and then free them but this causes memory leak.

    



    extern "C" {&#xA;#include <libavutil></libavutil>frame.h>&#xA;#include <libavutil></libavutil>imgutils.h>&#xA;}&#xA;&#xA;#include <vector>&#xA;#include <iostream>&#xA;&#xA;AVFrame * createFrame() {&#xA;    int width = 1280;&#xA;    int height = 720;&#xA;    AVPixelFormat format = AV_PIX_FMT_YUV420P;&#xA;    int buffer_size = av_image_get_buffer_size(format, width, height, 1);&#xA;    uint8_t * buffer = (uint8_t *)av_malloc(buffer_size * sizeof(uint8_t));&#xA;    memset(buffer, 1, buffer_size);&#xA;&#xA;    uint8_t *src_buf[4];&#xA;    int      src_linesize[4];&#xA;    av_image_fill_arrays(src_buf, src_linesize, buffer, format, width, height, 1);&#xA;&#xA;    AVFrame * frame = av_frame_alloc();&#xA;    frame->width = width;&#xA;    frame->height = height;&#xA;    frame->format = format;&#xA;    av_frame_get_buffer(frame, 0);&#xA;    av_image_copy(frame->data, frame->linesize,&#xA;                  const_cast<const>(src_buf), const_cast<const>(src_linesize),&#xA;                  format, width, height);&#xA;    av_free(buffer);&#xA;    return frame;&#xA;}&#xA;&#xA;int main(int argc, char *argv[]) {&#xA;    uint32_t count = 1024;&#xA;&#xA;    // fill array with frames&#xA;    std::vector list;&#xA;    for (uint64_t i = 0; i &lt; count; &#x2B;&#x2B;i) {&#xA;        list.push_back(createFrame());&#xA;    }&#xA;    // allocated 1385 mb in heap&#xA;&#xA;    // clear all allocated data&#xA;    for (auto i = list.begin(); i &lt; list.end(); &#x2B;&#x2B;i) {&#xA;        if (*i != NULL) {&#xA;            av_frame_free(&amp;(*i));&#xA;        }&#xA;    }&#xA;    list.clear();&#xA;&#xA;    // memory-leak of > 360 Mb&#xA;}&#xA;</const></const></iostream></vector>

    &#xA;&#xA;

    But if just create frame and immediatly free it without saving it into vector, no memory leak, despite the fact that the same number of frames was created.

    &#xA;&#xA;

    What i'm doing wrong ?

    &#xA;&#xA;

    UPDATE :

    &#xA;&#xA;

    I was wrong. There is no memory leak here(checked by valgrind), but the freed memory does not immediately return to the operating system, this confused me.

    &#xA;

  • Collect decoded audio from libav as doubles

    29 juillet 2015, par gapc

    I’m currently trying to gather decoded audio data (from multiple formats) to perform certain audio manipulations (using a *.wav file for testing).

    I have a class that handles all the decoding via FFmpeg libav. If I extract the data as unit8_t into a vector, and

    for (int i = 0; i &lt; bytevector.size(); i++) {
       fwrite(&amp;bytevector[i], sizeof (uint8_t), 1, outfile2);
    }

    to a raw file and play it via
    play -t raw -r 44100 -b16 -c 1 -e signed sound.raw it sounds perfectly fine.

    However, how is it possible to have all the correct information as doubles when the file for example is 2 bytes per sample and the frame->data information is given as uint8_t ? The wav files I’ve tested are 44100/16bits/1 channel. (I already have code that will change uint8_t* into a double)

    Opening the same files with Scilab will show half the size of the byte vector as doubles.

    wav file in Scilab as an array of doubles shows :

    -0.1, -0.099, -0.098, ..., 0.099, +0.1

    versus byte vector :
    51, 243, 84, 243, 117, 243, ...

    Can 51 and 243 really form a double ? Any suggestions on how to get past this issue ?

    Code below for reference :

    while ((av_read_frame(formatContext, &amp;readingPacket)) == 0) {
           if (readingPacket.stream_index == audioStreamIdx) {
               AVPacket decodingPacket = readingPacket;

               while (decodingPacket.size > 0) {
                   int gotFrame = 0;
                   int result = avcodec_decode_audio4(context, frame, &amp;gotFrame, &amp;decodingPacket);

                   if (result &lt; 0) {
                       break;
                   }

                   decoded = FFMIN(result, decodingPacket.size);

                   if (gotFrame) {
                       data_size = (av_get_bytes_per_sample(context->sample_fmt));
                       if (data_size &lt; 0) {
                       }

                       // Only for 1 channel temporarily
                       for (int i = 0; i &lt; frame->nb_samples; i++) {
                           for (int ch = 0; ch &lt; context->channels; ch++) {
                               for (int j = 0; j &lt; data_size; j++) {
                                   bytevector.push_back(*(frame->data[ch] + data_size * i + j));
                               }
                           }
                       }
                   } else {
                       decodingPacket.size = 0;
                       decodingPacket.data = NULL;
                   }
                   decodingPacket.size -= result;
                   decodingPacket.data += result;
               }
           }
           av_free_packet(&amp;readingPacket);
       }
  • Is it possible to stream netflix in either an embedded version of chromium or using ffmpeg ?

    24 février 2015, par OzBarry

    I’m looking into building an all-in-one media streaming application for my raspberry pi2, since there are currently very few options, and it’s scalable to other systems. The biggest hurdle I’ve found in requirements gathering is being able to stream netflix.

    There have been very few attempts at getting chromium to stream netflix, and even fewer on armv7h systems, so I’m trying to look at alternatives.

    My first thought is using a combination of curl and ffmpeg, and I think this would somehow work, however this doesn’t solve the issue with the DRM.

    Another option would be to stream from another computer into my application. This solves the DRM issue, but encumbers my software setup, burdens users to have at least one computer that can also stream netflix, and will suffer from lag (netflix -> computer a -> computer b). The last point can be sorted out with buffering, but that may not be ideal, since it adds stress to the raspberry pi machine.

    As a side note, I am using SDL2 for rendering, so I would be fine with a binary library that decodes the frames and audio, and sends it directly to a SDL renderer ad audio stream without allowing me to modify/copy it.

    Does anything like these options exist ? I really just want to get a legit stream from netflix if possible, while not interferring with the DRM.