Recherche avancée

Médias (0)

Mot : - Tags -/presse-papier

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

Autres articles (25)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

Sur d’autres sites (3983)

  • avcodec/videotoolboxenc : move pthread_cond_signal after add buffer to the queue

    28 août 2020, par Tian Qi
    avcodec/videotoolboxenc : move pthread_cond_signal after add buffer to the queue
    

    In the VT encoding insertion by FFmpeg,
    and vtenc_q_push is callback to add the encoded data
    to the singly linked list group in VTEncContext,
    and consumers are notified to fetch it.
    However, because it first informs consumers of pthread_cond_signal,
    and then inserts the data into the tail,
    there is a multi-thread safety hazard.

    Signed-off-by : Steven Liu <lq@chinaffmpeg.org>
    Signed-off-by : Rick Kern <kernrj@gmail.com>

    • [DH] libavcodec/videotoolboxenc.c
  • How extract JPEG image from H264 stream in constant time

    27 août 2021, par Ross Gardiner

    I want to extract a JPEG frame from a H264 stream on disk. The extraction needs to be as fast as possible for my real-time requirements.

    &#xA;

    Until now I have been using ffmpeg-python lib which is just a python wrapper for ffmpeg. Here is a code snippet :

    &#xA;

    out, _ = (&#xA;    ffmpeg&#xA;    .input(&#x27;./5sec.h264&#x27;)&#xA;    .filter(&#x27;select&#x27;, &#x27;gte(n,{})&#x27;.format(144))&#xA;    .output(&#x27;pipe:&#x27;, vframes=1, format=&#x27;image2&#x27;, vcodec=&#x27;h264&#x27;)&#xA;    .run(capture_stdout=True)&#xA;)&#xA;

    &#xA;

    This outputs the jpeg to stdout, with some effort I could read this into my program.

    &#xA;

    However, as I use larger and larger stream files the extraction time to grab the JPEG increases. I thought lookup time would be constant as ffmpeg is highly optimised ?

    &#xA;

    Is there a constant time solution to lookup and return a frame from a h264 (or even mjpeg) format stream on disk ?

    &#xA;

    Edit :&#xA;Heres the command I use without the python wrapper :&#xA;ffmpeg -i 5sec.h264 -frames:v 1 -filter:v "select=gte(n\,25)" -f image2 frame.jpg

    &#xA;

    here's output :

    &#xA;

    ffmpeg version 4.1.6-1~deb10u1&#x2B;rpt2 Copyright (c) 2000-2020 the FFmpeg developers&#xA;  built with gcc 8 (Raspbian 8.3.0-6&#x2B;rpi1)&#xA;  configuration: --prefix=/usr --extra-version=&#x27;1~deb10u1&#x2B;rpt2&#x27; --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm&#xA;  libavutil      56. 22.100 / 56. 22.100&#xA;  libavcodec     58. 35.100 / 58. 35.100&#xA;  libavformat    58. 20.100 / 58. 20.100&#xA;  libavdevice    58.  5.100 / 58.  5.100&#xA;  libavfilter     7. 40.101 /  7. 40.101&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  3.100 /  5.  3.100&#xA;  libswresample   3.  3.100 /  3.  3.100&#xA;  libpostproc    55.  3.100 / 55.  3.100&#xA;Input #0, h264, from &#x27;5sec.h264&#x27;:&#xA;  Duration: N/A, bitrate: N/A&#xA;    Stream #0:0: Video: h264 (High), yuv420p(progressive), 640x480, 25 fps, 25 tbr, 1200k tbn, 50 tbc&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))&#xA;Press [q] to stop, [?] for help&#xA;[swscaler @ 0x1a25390] deprecated pixel format used, make sure you did set range correctly&#xA;Output #0, image2, to &#x27;frame.jpg&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf58.20.100&#xA;    Stream #0:0: Video: mjpeg, yuvj420p(pc), 640x480, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc&#xA;    Metadata:&#xA;      encoder         : Lavc58.35.100 mjpeg&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1&#xA;frame=    1 fps=0.4 q=6.8 Lsize=N/A time=00:00:01.04 bitrate=N/A speed=0.467x    &#xA;video:63kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;

    &#xA;

    Note, achieved FPS is 0.4. When I increase the requested frame to be the 125th frame rather than the 25th, the FPS goes down to 0.1.

    &#xA;

  • ffmpeg how to ignore initial empty audio frames when decoding to loop a sound

    1er décembre 2020, par cs guy

    I am trying to loop a ogg sound file. The goal is to make a loopable audio interface for my mobile app.

    &#xA;

    I decode the given ogg file into a buffer and that buffer is sent to audio card for playing. All good until it the audio finishes (end of file). When it finishes I use av_seek_frame(avFormatContext, streamInfoIndex, 0, AVSEEK_FLAG_FRAME); to basically loop back to beginning. And continue decoding into writing to the same buffer. At first sight I thought this would give me perfect loops. One problem I had was, the decoder in the end gives me extra empty frames. So I ignored them by keeping track of how many samples are decoded :

    &#xA;

    durationInMillis = avFormatContext->duration * 1000;&#xA;numOfTotalSamples =&#xA;                (uint64_t) avFormatContext->duration *&#xA;                (uint64_t) pLocalCodecParameters->sample_rate *&#xA;                (uint64_t) pLocalCodecParameters->channels /&#xA;                (uint64_t) AV_TIME_BASE;&#xA;

    &#xA;

    When the threshold is reached I ignore the frames sent by the codec. I thought this was it and ran some test. I recorded 5 minutes of my app and in the end I compared the results in FL studio by customly adding the same sound clip several times to match the length of my audio recording :

    &#xA;

    Here it is after 5 minutes :

    &#xA;

    enter image description here

    &#xA;

    In the first loops the difference is very low I thought it was working and I used this for several days until I tested this on 5 minute recording. As the looping approached to 5 minutes mark the difference got very huge. My code is not looping the audio correctly. I suspect that the codec is adding 1 or 2 empty frames at the very beginning in each loop caused by av_seek_frame knowing that a frame can contain up several audio samples. These probably accumulate and cause the mismatch.

    &#xA;

    My question is : how can I drop the empty frames that is sent by codec while decoding so that I can create a perfect loop of the audio ?

    &#xA;

    My code is below here. Please be aware that I deleted lots of if checks that was inteded for safety to make it more readable in the code below, these removed checks are always false so it doesnt matter for the reader.

    &#xA;

    helper.cpp

    &#xA;

    int32_t&#xA;outputAudioFrame(AVCodecContext *avCodecContext, AVFrame *avResampledDecFrame, int32_t &amp;ret,&#xA;                 LockFreeQueue<float> *&amp;buffer, int8_t *&amp;mediaLoadPointer,&#xA;                 AVFrame *avDecoderFrame, SwrContext *swrContext,&#xA;                 std::atomic_bool *&amp;signalExitFuture,&#xA;                 uint64_t &amp;currentNumSamples, uint64_t &amp;numOfTotalSamples) {&#xA;    // resampling is done here but its boiler code so I removed it.&#xA;    auto *floatArrPtr = (float *) (avResampledDecFrame->data[0]);&#xA;&#xA;    int32_t numOfSamples = avResampledDecFrame->nb_samples * avResampledDecFrame->channels;&#xA;&#xA;    for (int32_t i = 0; i &lt; numOfSamples; i&#x2B;&#x2B;) {&#xA;        if (currentNumSamples == numOfTotalSamples) {&#xA;            break;&#xA;        }&#xA;&#xA;        buffer->push(*floatArrPtr);&#xA;        currentNumSamples&#x2B;&#x2B;;&#xA;        floatArrPtr&#x2B;&#x2B;;&#xA;    }&#xA;&#xA;    return 0;&#xA;}&#xA;&#xA;&#xA;&#xA;int32_t decode(int32_t &amp;ret, AVCodecContext *avCodecContext, AVPacket *avPacket,&#xA;               LockFreeQueue<float> *&amp;buffer,&#xA;               AVFrame *avDecoderFrame,&#xA;               AVFrame *avResampledDecFrame,&#xA;               std::atomic_bool *&amp;signalExitFuture,&#xA;               int8_t *&amp;mediaLoadPointer, SwrContext *swrContext,&#xA;               uint64_t &amp;currentNumSamples, uint64_t &amp;numOfTotalSamples) {&#xA;   &#xA;    ret = avcodec_send_packet(avCodecContext, avPacket);&#xA;    if (ret &lt; 0) {&#xA;        LOGE("decode: Error submitting a packet for decoding %s", av_err2str(ret));&#xA;        return ret;&#xA;    }&#xA;&#xA;    // get all the available frames from the decoder&#xA;    while (ret >= 0) {&#xA;&#xA;        // submit the packet to the decoder&#xA;        ret = avcodec_receive_frame(avCodecContext, avDecoderFrame);&#xA;        if (ret &lt; 0) {&#xA;            // those two return values are special and mean there is no output&#xA;            // frame available, but there were no errors during decoding&#xA;            if (ret == AVERROR_EOF || ret == AVERROR(EAGAIN)) {&#xA;                //LOGD("avcodec_receive_frame returned special %s", av_err2str(ret));&#xA;                return 0;&#xA;            }&#xA;&#xA;            LOGE("avcodec_receive_frame Error during decoding %s", av_err2str(ret));&#xA;            return ret;&#xA;        }&#xA;&#xA;        ret = outputAudioFrame(avCodecContext, avResampledDecFrame, ret, buffer,&#xA;                               mediaLoadPointer, avDecoderFrame, swrContext, signalExitFuture,&#xA;                               currentNumSamples, numOfTotalSamples);&#xA;&#xA;        av_frame_unref(avDecoderFrame);&#xA;        av_frame_unref(avResampledDecFrame);&#xA;&#xA;        if (ret &lt; 0)&#xA;            return ret;&#xA;    }&#xA;&#xA;    return 0;&#xA;}&#xA;</float></float>

    &#xA;

    Main.cpp

    &#xA;

    while (!*signalExitFuture) {&#xA;            while ((ret = av_read_frame(avFormatContext, avPacket)) >= 0) {&#xA;&#xA;                ret = decode(ret, avCodecContext, avPacket, buffer, avDecoderFrame,&#xA;                             avResampledDecFrame, signalExitFuture,&#xA;                             mediaLoadPointer, swrContext,&#xA;                             currentNumSamples, numOfTotalSamples);&#xA;&#xA;                // The packet must be freed with av_packet_unref() when it is no longer needed.&#xA;                av_packet_unref(avPacket);&#xA;&#xA;                if (ret &lt; 0) {&#xA;                    LOGE("Error! %s", av_err2str(ret));&#xA;&#xA;                    goto cleanup;&#xA;                }&#xA;            }&#xA;&#xA;            if (ret == AVERROR_EOF) {&#xA;&#xA;                ret = av_seek_frame(avFormatContext, streamInfoIndex, 0, AVSEEK_FLAG_FRAME);&#xA;&#xA;                currentNumSamples = 0;&#xA;                avcodec_flush_buffers(avCodecContext);&#xA;            }&#xA;        }&#xA;

    &#xA;