Advanced search

Medias (0)

Tag: - Tags -/formulaire

No media matches your criterion on the site.

Other articles (36)

  • Websites made ​​with MediaSPIP

    2 May 2011, by

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 April 2011, by

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

  • Personnaliser les catégories

    21 June 2013, by

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

On other websites (3199)

  • Revision 115849: Depuis [115027] il était devenu impossible de ne pas remplir les ...

    2 July 2019, by rastapopoulos@… — Log

    Depuis [115027] il était devenu impossible de ne pas remplir les dates, même si on n’avait jamais dit que c’était obligatoire. Le test d’obligation se fait dans Saisies en amont, mais si ce n’est pas le cas, on DOIT pouvoir laisser les champs vides. On change donc pour ne faire une erreur que si la date est vide alors qu’on a remplit l’heure. Si c’est le contraire, on considère que l’heure est 00:00. Et si tout est vide, ya rien du tout, puisqu’on n’a jamais demandé obligatoire, donc ça reste vide et ça sera possiblement normalisé avec tout à zéro.

  • Revision 115849: Depuis [115027] il était devenu impossible de ne pas remplir les ...

    2 July 2019, by rastapopoulos@… — Log

    Depuis [115027] il était devenu impossible de ne pas remplir les dates, même si on n’avait jamais dit que c’était obligatoire. Le test d’obligation se fait dans Saisies en amont, mais si ce n’est pas le cas, on DOIT pouvoir laisser les champs vides. On change donc pour ne faire une erreur que si la date est vide alors qu’on a remplit l’heure. Si c’est le contraire, on considère que l’heure est 00:00. Et si tout est vide, ya rien du tout, puisqu’on n’a jamais demandé obligatoire, donc ça reste vide et ça sera possiblement normalisé avec tout à zéro.

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

    9 December 2020, by 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;