Recherche avancée

Médias (0)

Mot : - Tags -/clipboard

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (46)

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

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (5264)

  • FFmpeg encoding aac audio, encoded file can not be played

    9 décembre 2020, par cs guy

    I am trying to encodea aac audio. Example of MP2 here. I followed this documentation. I encode the audio with the code below by calling startEncoding and after 2 seconds I call stopEncoding. Everything seems to work fine I get an file with some size but the problem is I can not open or play it. I dont know why. I must be doing something wrong in the code.

    


    header :

    


    class MediaEncoder {&#xA;public:&#xA;    MediaEncoder(char *filePath);&#xA;&#xA;    void startEncoding();&#xA;    void stopEncoding();&#xA;&#xA;    void encode(AVFrame *frame);&#xA;    bool isEncoding() const;&#xA;&#xA;    void startEncoderWorker();&#xA;&#xA;    int32_t check_sample_fmt(enum AVSampleFormat sample_fmt);&#xA;    &#xA;    bool signalExitFuture = false;&#xA;    int32_t ret;&#xA;&#xA;private:&#xA;    std::future<void> encodingFuture;&#xA;    AVCodecContext *avCodecContext;&#xA;    AVFrame *avFrame;&#xA;    AVPacket *avPacket;&#xA;    AVCodec *codec;&#xA;    FILE* file;&#xA;};&#xA;</void>

    &#xA;

    cpp :

    &#xA;

    MediaEncoder::MediaEncoder(char *filePath){&#xA;    buffer = std::make_unique>(recorderBufferSize);&#xA;&#xA;    /* find the encoder */&#xA;    codec = avcodec_find_encoder(AV_CODEC_ID_AAC);&#xA;    avCodecContext = avcodec_alloc_context3(codec);&#xA;&#xA;    avCodecContext->bit_rate = 64000;&#xA;&#xA;    /* check that the encoder supports given sample format */&#xA;    avCodecContext->sample_fmt = AVSampleFormat::AV_SAMPLE_FMT_FLTP;&#xA;    &#xA;    /* select other audio parameters supported by the encoder */&#xA;    avCodecContext->sample_rate = defaultSampleRate;&#xA;    avCodecContext->channel_layout = AV_CH_LAYOUT_STEREO;&#xA;    avCodecContext->channels = av_get_channel_layout_nb_channels(avCodecContext->channel_layout);&#xA;&#xA;    /* open it */&#xA;    avcodec_open2(avCodecContext, codec, nullptr)&#xA;    &#xA;    file = fopen(filePath, "wb");&#xA;    &#xA;    /* packet for holding encoded output */&#xA;    avPacket = av_packet_alloc();&#xA;    &#xA;    /* frame containing input raw audio */&#xA;    avFrame = av_frame_alloc();&#xA;    &#xA;    avFrame->nb_samples = avCodecContext->frame_size;&#xA;    avFrame->format = avCodecContext->sample_fmt;&#xA;    avFrame->channel_layout = avCodecContext->channel_layout;&#xA;&#xA;    /* allocate the data buffers */&#xA;    av_frame_get_buffer(avFrame, 0);&#xA;}&#xA;&#xA;&#xA;void MediaEncoder::startEncoding() {&#xA;    // set flags for decoding thread&#xA;    signalExitFuture = false;&#xA;&#xA;    encodingFuture = std::async(std::launch::async, &amp;MediaEncoder::startEncoderWorker, this);&#xA;}&#xA;&#xA;void MediaEncoder::stopEncoding() {&#xA;    signalExitFuture = true;&#xA;}&#xA;&#xA;bool MediaEncoder::isEncoding() const {&#xA;    return !signalExitFuture;&#xA;}&#xA;&#xA;void MediaEncoder::encode(AVFrame *frame) {&#xA;    /* send the frame for encoding */&#xA;    ret = avcodec_send_frame(avCodecContext, frame);&#xA;    if (ret &lt; 0) {&#xA;        LOGE("Error sending the frame to the encoder %s",&#xA;             av_err2str(ret));&#xA;        *recorderStatePointer = MediaEncoderState::RUNTIME_FAIL;&#xA;        return;&#xA;    }&#xA;&#xA;    /* read all the available output packets (in general there may be any&#xA;     * number of them */&#xA;    while (ret >= 0) {&#xA;        ret = avcodec_receive_packet(avCodecContext, avPacket);&#xA;        if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {&#xA;            return;&#xA;        } else if (ret &lt; 0) {&#xA;            LOGE("Error encoding audio frame %s",&#xA;                 av_err2str(ret));&#xA;            *recorderStatePointer = MediaEncoderState::RUNTIME_FAIL;&#xA;            return;&#xA;        }&#xA;       &#xA;        /* Solution begins here&#xA;        int aac_profile = 2;           // AAC LC&#xA;        int frequencey_index = 4;      // 44,100Hz&#xA;        int channel_configuration = 2; // stereo (left, right)&#xA;&#xA;        int frame_length = avPacket->size &#x2B; 7;              // your frame length&#xA;     &#xA;        unsigned char adts_header[7];&#xA;&#xA;        // fill in ADTS data&#xA;        adts_header[0] = (unsigned char) 0xFF;&#xA;        adts_header[1] = (unsigned char) 0xF9;&#xA;        adts_header[2] = (unsigned char) (((aac_profile -1) &lt;&lt; 6 ) &#x2B; (frequencey_index &lt;&lt; 2) &#x2B; (channel_configuration >> 2));&#xA;        adts_header[3] = (unsigned char) (((channel_configuration &amp; 3) &lt;&lt; 6) &#x2B; (frame_length >> 11));&#xA;        adts_header[4] = (unsigned char) ((frame_length &amp; 0x7FF) >> 3);&#xA;        adts_header[5] = (unsigned char) (((frame_length &amp; 7) &lt;&lt; 5) &#x2B; 0x1F);&#xA;        adts_header[6] = (unsigned char) 0xFC;&#xA;&#xA;        fwrite(adts_header, 1, 7, file); &#xA;        Solution ends here */ &#xA;        fwrite(avPacket->data, 1, avPacket->size, file);&#xA;        av_packet_unref(avPacket);&#xA;    }&#xA;}&#xA;&#xA;void MediaEncoder::startEncoderWorker() {&#xA;    try {&#xA;        float *leftChannel;&#xA;        float *rightChannel;&#xA;        float val;&#xA;&#xA;        while (!signalExitFuture) {&#xA;            ret = av_frame_make_writable(avFrame);&#xA;            if (ret &lt; 0) {&#xA;                LOGE("av_frame_make_writable Can not Ensure that the frame data is writable. %s",&#xA;                     av_err2str(ret));&#xA;                *recorderStatePointer = MediaEncoderState::RUNTIME_FAIL;&#xA;                return;&#xA;            }&#xA;&#xA;            leftChannel = (float *) avFrame->data[0];&#xA;            rightChannel = (float *) avFrame->data[1];&#xA;&#xA;            for (int32_t i = 0; i &lt; avCodecContext->frame_size; &#x2B;&#x2B;i) {&#xA;               &#xA;                leftChannel[i] = 0.4;&#xA;                rightChannel[i] = 0.4;&#xA;            }&#xA;&#xA;            encode(avFrame);&#xA;        }&#xA;&#xA;        /* flush the encoder */&#xA;        encode(nullptr);&#xA;&#xA;        fclose(file);&#xA;        LOGE("Encoding finished!");&#xA;&#xA;        av_frame_free(&amp;avFrame);&#xA;        av_packet_free(&amp;avPacket);&#xA;        avcodec_free_context(&amp;avCodecContext);&#xA;    } catch (std::exception &amp;e) {&#xA;        LOGE("startEncoderWorker uncaught exception %s", e.what());&#xA;    }&#xA;&#xA;    LOGE("Deleting Media Encoder!");&#xA;&#xA;}&#xA;

    &#xA;

    Here is an recorded 11 seconds of an aac file recorded with real float pcm data rather than 0.4 as it is in the code I posted. Google Drive Link

    &#xA;

    The code above works. Thanks to the legend @Markus-Schumann

    &#xA;

  • Evolution #4063 : Position de la prévisualisation / ergo presentation formulaire forum

    10 mars 2021, par cedric -

    b_b il y a pas de prévisu dans mon screenshot : mon propos c’est que de base le formulaire forum est bien bancal
    - il se prend des margin en cascade sur les fieldset qui laissent des gros espaces blancs
    - toutes les legend sont masquées et c’est du coup à peu près incompréhensible si tu as pas que le textarea (ie si tu as des mots clés notamment)
    - le textarea a été déplacé en bas, mais pas la legend, ou alors du coup c’est les mots clés qui sont plus au bon endroit, et du coup ça a ni queue ni tête si j’affiche les legend (tu as "Votre message", puis les mots clés, puis le textarea)

    - et cerise sur le gateau, quand je scroll pour aller cliquer sur le bouton "prévisualiser", la prévisu apparait en dessous - et donc hors écran chez moi je vois que le haut du fieldset - sans aucun scroll.

    Donc je veux bien qu’on dise "on va tout changer" mais alors please, prenez le temps de tester et d’ajuster visuellement pour les différents cas (avec / sans mot clé, avec/sans le bloc d’URL, avec/sans le bloc "votre nom", avec/sans les documents joints)

    C’est bien chiant, certes, et on est bien d’accord que le scénario nominal c’est plutôt une version simple, mais de là à accepter que ça ait l’air complètement cassé et incompréhensible quand on est dans un autre cas ça me parait pas OK.

    Donc pour moi soit quelqu’un prends le temps de mettre au propre et de remettre ça d’équerre, soit on revert et on revient à ce qu’on avait avant, qui certes n’était pas parfait mais au moins marchait à peu près dans tous les cas...

  • Anomalie #4623 : Styles des fieldset dans l’espace privé

    16 avril 2021, par RastaPopoulos ♥

    Je mets ici un essai fait un peu à l’arrache hier dans le navigateur que j’ai peaufiné un peu ce matin.

    Les arguments qui vont avec :

    • Je pense que c’est plus léger visuellement à la fois que le master et que dans la branche de cette PR, y compris pour les groupes racines, car il n’y a pas de coupure horizontale. Quand l’œil parcourt de haut en bas, il n’est pas bloqué par des bordures horizontales qui font que l’esprit s’arrête un instant.
    • Les groupes doivent tous être matérialisés par un début et une fin, y compris les groupes racines : il peut y avoir des champs hors groupe après n’importe quel fieldset, et donc on doit savoir où finit un fieldset.
    • Là je matérialise avec une fine ligne de la couleur du thème, que je fais terminer en dégradé vers le transparent afin de ce soit plus doux (ce n’est pas une border mais une background-image gradient de 1px)
    • De cette manière on voit à la fois le début et la fin, sans coupure de lecture, et avec une indication de 1px seulement. Notamment les groupes racines ne sont pas décalés du tout par rapport au reste : l’indication de 1px se superpose à la bordure existante des formulaires. Ainsi comme on le voit, les champs intérieur au premier groupe racine sont pile au même niveau que les champs en dehors du groupe.

    Commentaire supplémentaire : cette légère matérialisation ne se base pas sur la couleur mais sur la luminosité, ainsi ça marche même si on est daltonien. Pour appuyer on peut utiliser spip-color-theme-dark, ou si on veut faire plus neutre, on pourrait aussi virer totalement la couleur et utiliser spip-color-gray-dark aussi bien pour la ligne dégradé que pour le legend. Le principe restant le même.

    Version monochrome avec spip-color-gray-dark (plus foncé que précédemment), on voit quand même pas mal la diff à tous les niveaux.