Recherche avancée

Médias (91)

Autres articles (77)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

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

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (9414)

  • Matplotlib : 'module' object has no attribute 'FFMpegWriter' / 'Writer'

    23 février 2015, par osnoz

    I’m trying to animate a graph with Matplotlib, something which I’ve done on a previous system. My code, however, seems to fail with my current setup.

    Here’s the problem :

    Writer = animation.writers['ffmpeg']

    Traceback (most recent call last) :
    File "/Users/oliversanders/Documents/Code/PyCharm/plottools/animationTest.py", line 17, in
    Writer = animation.writers[’ffmpeg’]
    AttributeError : ’module’ object has no attribute ’writers’

    Or alternatively :

    mywriter = animation.FFMpegWriter(fps=15)

    Traceback (most recent call last) :
    File "/Users/oliversanders/Documents/Code/PyCharm/plottools/animatedPointPlotter.py", line 101, in
    mywriter = animation.FFMpegWriter(fps=15)
    AttributeError : ’module’ object has no attribute ’FFMpegWriter’

    I’ve just re-installed matplotlib (1.4.2) and ffmpeg (2.5.3) for good measure. I’ve also deleted all .pyc files from matplotlib’s directory to make sure they aren’t messing anything up.

    I’ve looked around but been unable to find a solution. See also :
    Using FFmpeg and IPython, What could be wrong in saving the following animation in Python ?.

    Thanks in advance.

  • Module not found, ffmpeg not found

    5 juin 2020, par Arsh Suri

    I have being trying to use the ffmpeg module on anaconda for my recent project.
I am unable to import the package for some reason. I have added/installed ffmpeg to my path environment.
I have tried installing the ffmpeg to the anaconda working file, still it shows

    



    ModuleNotFoundError Traceback (most recent call last)
 in 
----> 1 import ffmpeg

    



    ModuleNotFoundError : No module named 'ffmpeg'

    



    How do i proceed with this,

    


  • Exoplayer with FFmpeg module and filtering crash with aac and alac audio formats

    25 juin 2020, par Aleksej Otjan

    Have a code to play audio with exoplayer and ffmpeg decoder. It works. Then I was needed to add equalizer functionality. I did it with ffmpeg avfilters. But now, it crash at some audio formats(if dont use avfilters it works with this formats).

    


    Decode func :

    


    int decodePacket(AVCodecContext *context, AVPacket *packet,
                 uint8_t *outputBuffer, int outputSize) {
    int result = 0;
    // Queue input data.
    result = avcodec_send_packet(context, packet);
    if (result) {
        logError("avcodec_send_packet", result);
        return result == AVERROR_INVALIDDATA ? DECODER_ERROR_INVALID_DATA
                                             : DECODER_ERROR_OTHER;
    }

    // Dequeue output data until it runs out.
    int outSize = 0;
    if (EQUALIZER != nullptr) {
        LOGE("INIT FILTER GRAPH");
        init_filter_graph(context,  EQUALIZER);
    }

    while (true) {
        AVFrame *frame = av_frame_alloc();
        if (!frame) {
            LOGE("Failed to allocate output frame.");
            return -1;
        }
        result = avcodec_receive_frame(context, frame);
        if (result) {
            av_frame_free(&frame);
            if (result == AVERROR(EAGAIN)) {
                break;
            }
            logError("avcodec_receive_frame", result);
            return result;
        }

        // Resample output.
        AVSampleFormat sampleFormat = context->sample_fmt;
        int channelCount = context->channels;
        int channelLayout = context->channel_layout;
        int sampleRate = context->sample_rate;
        int sampleCount = frame->nb_samples;
        int dataSize = av_samples_get_buffer_size(NULL, channelCount, sampleCount,
                                                  sampleFormat, 1);
        SwrContext *resampleContext;
        if (context->opaque) {
            resampleContext = (SwrContext *) context->opaque;
        } else {
            resampleContext = swr_alloc();
            av_opt_set_int(resampleContext, "in_channel_layout", channelLayout, 0);
            av_opt_set_int(resampleContext, "out_channel_layout", channelLayout, 0);
            av_opt_set_int(resampleContext, "in_sample_rate", sampleRate, 0);
            av_opt_set_int(resampleContext, "out_sample_rate", sampleRate, 0);
            av_opt_set_int(resampleContext, "in_sample_fmt", sampleFormat, 0);
            // The output format is always the requested format.
            av_opt_set_int(resampleContext, "out_sample_fmt",
                           context->request_sample_fmt, 0);
            result = swr_init(resampleContext);
            if (result < 0) {
                logError("swr_init", result);
                av_frame_free(&frame);
                return -1;
            }
            context->opaque = resampleContext;
        }
        int inSampleSize = av_get_bytes_per_sample(sampleFormat);
        int outSampleSize = av_get_bytes_per_sample(context->request_sample_fmt);
        int outSamples = swr_get_out_samples(resampleContext, sampleCount);
        int bufferOutSize = outSampleSize * channelCount * outSamples;
        if (outSize + bufferOutSize > outputSize) {
            LOGE("Output buffer size (%d) too small for output data (%d).",
                 outputSize, outSize + bufferOutSize);
            av_frame_free(&frame);
            return -1;
        }
        if (EQUALIZER != nullptr && graph != nullptr) {
            result = av_buffersrc_add_frame_flags(src, frame,AV_BUFFERSRC_FLAG_KEEP_REF);
            if (result < 0) {
                av_frame_unref(frame);
                LOGE("Error submitting the frame to the filtergraph:");
                return -1;
            }
                // Get all the filtered output that is available.
                result = av_buffersink_get_frame(sink, frame);
                LOGE("ERROR SWR %s", av_err2str(result));
                if (result == AVERROR(EAGAIN) || result == AVERROR_EOF) {
                    av_frame_unref(frame);
                    break;
                }
                if (result < 0) {
                    av_frame_unref(frame);
                    return -1;
                }
                result = swr_convert(resampleContext, &outputBuffer, bufferOutSize,
                                     (const uint8_t **) frame->data, frame->nb_samples);
        }else{
            result = swr_convert(resampleContext, &outputBuffer, bufferOutSize,
                                 (const uint8_t **) frame->data, frame->nb_samples);
        }

        av_frame_free(&frame);
        if (result < 0) {
            logError("swr_convert", result);
            return result;
        }
        int available = swr_get_out_samples(resampleContext, 0);
        if (available != 0) {
            LOGE("Expected no samples remaining after resampling, but found %d.",
                 available);
            return -1;
        }
        outputBuffer += bufferOutSize;
        outSize += bufferOutSize;
    }
    avfilter_graph_free(&graph);
    return outSize;
}


    


    Init graph func :

    


    int init_filter_graph(AVCodecContext *dec_ctx,  const char *eq) {&#xA;    char args[512];&#xA;    int ret = 0;&#xA;    graph = avfilter_graph_alloc();&#xA;    const AVFilter *abuffersrc = avfilter_get_by_name("abuffer");&#xA;    const AVFilter *abuffersink = avfilter_get_by_name("abuffersink");&#xA;    AVFilterInOut *outputs = avfilter_inout_alloc();&#xA;    AVFilterInOut *inputs = avfilter_inout_alloc();&#xA;    static const enum AVSampleFormat out_sample_fmts[] = {dec_ctx->request_sample_fmt,&#xA;                                                          static_cast<const avsampleformat="avsampleformat">(-1)};&#xA;    static const int64_t out_channel_layouts[] = {static_cast(dec_ctx->channel_layout),&#xA;                                                  -1};&#xA;    static const int out_sample_rates[] = {dec_ctx->sample_rate, -1};&#xA;    const AVFilterLink *outlink;&#xA;    AVRational time_base = dec_ctx->time_base;&#xA;&#xA;    if (!outputs || !inputs || !graph) {&#xA;        ret = AVERROR(ENOMEM);&#xA;        goto end;&#xA;    }&#xA;&#xA;    /* buffer audio source: the decoded frames from the decoder will be inserted here. */&#xA;    if (!dec_ctx->channel_layout)&#xA;        dec_ctx->channel_layout = av_get_default_channel_layout(dec_ctx->channels);&#xA;    snprintf(args, sizeof(args),&#xA;             "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%" PRIx64,&#xA;             1, dec_ctx->sample_rate, dec_ctx->sample_rate,&#xA;             av_get_sample_fmt_name(dec_ctx->sample_fmt), dec_ctx->channel_layout);&#xA;    ret = avfilter_graph_create_filter(&amp;src, abuffersrc, "in",&#xA;                                       args, NULL, graph);&#xA;&#xA;    if (ret &lt; 0) {&#xA;        LOGE("Cannot create audio buffer source\n");&#xA;        goto end;&#xA;    }&#xA;&#xA;    /* buffer audio sink: to terminate the filter chain. */&#xA;    ret = avfilter_graph_create_filter(&amp;sink, abuffersink, "out",&#xA;                                       NULL, NULL, graph);&#xA;    if (ret &lt; 0) {&#xA;        LOGE("Cannot create audio buffer sink\n");&#xA;        goto end;&#xA;    }&#xA;&#xA;    ret = av_opt_set_int_list(sink, "sample_fmts", out_sample_fmts, -1,&#xA;                              AV_OPT_SEARCH_CHILDREN);&#xA;    if (ret &lt; 0) {&#xA;        LOGE("Cannot set output sample format\n");&#xA;        goto end;&#xA;    }&#xA;&#xA;    ret = av_opt_set_int_list(sink, "channel_layouts", out_channel_layouts, -1,&#xA;                              AV_OPT_SEARCH_CHILDREN);&#xA;    if (ret &lt; 0) {&#xA;        LOGE("Cannot set output channel layout\n");&#xA;        goto end;&#xA;    }&#xA;&#xA;    ret = av_opt_set_int_list(sink, "sample_rates", out_sample_rates, -1,&#xA;                              AV_OPT_SEARCH_CHILDREN);&#xA;    if (ret &lt; 0) {&#xA;        LOGE("Cannot set output sample rate\n");&#xA;        goto end;&#xA;    }&#xA;&#xA;    /*&#xA;     * Set the endpoints for the filter graph. The graph will&#xA;     * be linked to the graph described by filters_descr.&#xA;     */&#xA;&#xA;    /*&#xA;     * The buffer source output must be connected to the input pad of&#xA;     * the first filter described by filters_descr; since the first&#xA;     * filter input label is not specified, it is set to "in" by&#xA;     * default.&#xA;     */&#xA;    outputs->name = av_strdup("in");&#xA;    outputs->filter_ctx = src;&#xA;    outputs->pad_idx = 0;&#xA;    outputs->next = NULL;&#xA;&#xA;    /*&#xA;     * The buffer sink input must be connected to the output pad of&#xA;     * the last filter described by filters_descr; since the last&#xA;     * filter output label is not specified, it is set to "out" by&#xA;     * default.&#xA;     */&#xA;    inputs->name = av_strdup("out");&#xA;    inputs->filter_ctx = sink;&#xA;    inputs->pad_idx = 0;&#xA;    inputs->next = NULL;&#xA;&#xA;    if ((ret = avfilter_graph_parse_ptr(graph, eq,&#xA;                                        &amp;inputs, &amp;outputs, NULL)) &lt; 0) {&#xA;        goto end;&#xA;    }&#xA;&#xA;    if ((ret = avfilter_graph_config(graph, NULL)) &lt; 0)&#xA;        goto end;&#xA;&#xA;    /* Print summary of the sink buffer&#xA;     * Note: args buffer is reused to store channel layout string */&#xA;    outlink = sink->inputs[0];&#xA;    av_get_channel_layout_string(args, sizeof(args), -1, outlink->channel_layout);&#xA;    LOGE("Output: srate:%dHz  chlayout:%s\n",&#xA;         (int) outlink->sample_rate,&#xA;         args);&#xA;    end:&#xA;    avfilter_inout_free(&amp;inputs);&#xA;    avfilter_inout_free(&amp;outputs);&#xA;    return ret;&#xA;}&#xA;</const>

    &#xA;

    Crash when try to play aac, alac audio at this line :

    &#xA;

    result = swr_convert(resampleContext, &amp;outputBuffer, bufferOutSize,(const uint8_t **) frame->data, frame->nb_samples);&#xA;

    &#xA;

    with

    &#xA;

    Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 &#xA;

    &#xA;

    but work fine when play mp3, flac. What is wrong ? Thx for help.

    &#xA;