Recherche avancée

Médias (1)

Mot : - Tags -/publier

Autres articles (91)

  • L’utiliser, en parler, le critiquer

    10 avril 2011

    La première attitude à adopter est d’en parler, soit directement avec les personnes impliquées dans son développement, soit autour de vous pour convaincre de nouvelles personnes à l’utiliser.
    Plus la communauté sera nombreuse et plus les évolutions seront rapides ...
    Une liste de discussion est disponible pour tout échange entre utilisateurs.

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Mediabox : ouvrir les images dans l’espace maximal pour l’utilisateur

    8 février 2011, par

    La visualisation des images est restreinte par la largeur accordée par le design du site (dépendant du thème utilisé). Elles sont donc visibles sous un format réduit. Afin de profiter de l’ensemble de la place disponible sur l’écran de l’utilisateur, il est possible d’ajouter une fonctionnalité d’affichage de l’image dans une boite multimedia apparaissant au dessus du reste du contenu.
    Pour ce faire il est nécessaire d’installer le plugin "Mediabox".
    Configuration de la boite multimédia
    Dès (...)

Sur d’autres sites (10008)

  • avcodec : add AVCodecContext.frame_num as 64 bit variant to frame_number

    23 janvier 2023, par Marton Balint
    avcodec : add AVCodecContext.frame_num as 64 bit variant to frame_number
    

    Frame counters can overflow relatively easily (INT_MAX number of frames is
    slightly more than 1 year for 60 fps content), so make sure we use 64 bit
    values for them.

    Also deprecate the old 32 bit frame_number attribute.

    Signed-off-by : Marton Balint <cus@passwd.hu>

    • [DH] doc/APIchanges
    • [DH] doc/examples/decode_video.c
    • [DH] fftools/ffmpeg.c
    • [DH] libavcodec/4xm.c
    • [DH] libavcodec/8svx.c
    • [DH] libavcodec/aacenc.c
    • [DH] libavcodec/ansi.c
    • [DH] libavcodec/atrac3plus.c
    • [DH] libavcodec/avcodec.c
    • [DH] libavcodec/avcodec.h
    • [DH] libavcodec/bfi.c
    • [DH] libavcodec/cdgraphics.c
    • [DH] libavcodec/cljrenc.c
    • [DH] libavcodec/decode.c
    • [DH] libavcodec/dvenc.c
    • [DH] libavcodec/eac3enc.c
    • [DH] libavcodec/encode.c
    • [DH] libavcodec/evrcdec.c
    • [DH] libavcodec/flashsv2enc.c
    • [DH] libavcodec/flashsvenc.c
    • [DH] libavcodec/g2meet.c
    • [DH] libavcodec/gif.c
    • [DH] libavcodec/h261dec.c
    • [DH] libavcodec/h264_slice.c
    • [DH] libavcodec/interplayvideo.c
    • [DH] libavcodec/ituh263dec.c
    • [DH] libavcodec/libwebpenc_animencoder.c
    • [DH] libavcodec/mjpegdec.c
    • [DH] libavcodec/mlpenc.c
    • [DH] libavcodec/mpegutils.c
    • [DH] libavcodec/nuv.c
    • [DH] libavcodec/options_table.h
    • [DH] libavcodec/opusenc.c
    • [DH] libavcodec/pngenc.c
    • [DH] libavcodec/pthread_frame.c
    • [DH] libavcodec/qcelpdec.c
    • [DH] libavcodec/qtrleenc.c
    • [DH] libavcodec/rv10.c
    • [DH] libavcodec/smcenc.c
    • [DH] libavcodec/snowenc.c
    • [DH] libavcodec/svq1enc.c
    • [DH] libavcodec/svq3.c
    • [DH] libavcodec/version.h
    • [DH] libavcodec/version_major.h
    • [DH] libavcodec/vp3.c
    • [DH] libavcodec/wcmv.c
    • [DH] libavcodec/wmaprodec.c
    • [DH] libavcodec/yop.c
    • [DH] tools/decode_simple.c
    • [DH] tools/scale_slice_test.c
    • [DH] tools/venc_data_dump.c
  • Trying to decode and encode audio files with the FFMPEG C API

    1er février 2023, par Giulio Iacomino

    My ultimate goal will be to split multi channel WAV files into single mono ones, after few days of experiments my plan is the sequence :

    &#xA;

      &#xA;
    1. Decode audio file into a frame.
    2. &#xA;

    3. Convert interleaved frame into a planar one. (in order to separate the data buffer into multiple ones)
    4. &#xA;

    5. Grab the planar frame buffers and encode each of them into a new file.
    6. &#xA;

    &#xA;

    So far I'm stuck trying to convert a wav file from interleaved to a planar one, and reprint the wav file.

    &#xA;

    edit :&#xA;I've turned on guard malloc and apparently the error is within the convert function

    &#xA;

    Here's the code :

    &#xA;

    AVCodecContext* initializeAndOpenCodecContext(AVFormatContext* formatContext, AVStream* stream){&#xA;     // grab our stream, most audio files only have one anyway&#xA;    const AVCodec* decoder = avcodec_find_decoder(stream->codecpar->codec_id);&#xA;    if (!decoder){&#xA;        std::cout &lt;&lt; "no decoder, can&#x27;t go ahead!\n";&#xA;        return nullptr;&#xA;    }&#xA;    AVCodecContext* codecContext = avcodec_alloc_context3(decoder);&#xA;    avcodec_parameters_to_context(codecContext, stream->codecpar);&#xA;    int err = avcodec_open2(codecContext, decoder, nullptr);&#xA;    if (err &lt; 0){&#xA;        std::cout &lt;&lt; "couldn&#x27;t open codex!\n";&#xA;    }&#xA;    return codecContext;&#xA;}&#xA;&#xA;void initialiseResampler(SwrContext* resampler, AVFrame* inputFrame, AVFrame* outputFrame){&#xA;    av_opt_set_chlayout(resampler, "in_channel_layout", &amp;inputFrame->ch_layout, 0);&#xA;    av_opt_set_chlayout(resampler, "out_channel_layout", &amp;outputFrame->ch_layout, 0);&#xA;    av_opt_set_int(resampler, "in_sample_fmt", inputFrame->format, 0);&#xA;    av_opt_set_int(resampler, "out_sample_fmt", AV_SAMPLE_FMT_FLTP, 0);&#xA;    av_opt_set_int(resampler, "in_sample_rate", inputFrame->sample_rate, 0);&#xA;    av_opt_set_int(resampler, "out_sample_rate", outputFrame->sample_rate, 0);&#xA;}&#xA;&#xA;AVFrame* initialisePlanarFrame(AVFrame* frameToInit, AVFrame* inputFrame){&#xA;    //AVFrame *planar_frame = av_frame_alloc();&#xA;    frameToInit->nb_samples = inputFrame->nb_samples;&#xA;    frameToInit->ch_layout = inputFrame->ch_layout;&#xA;    frameToInit->format = AV_SAMPLE_FMT_FLTP;&#xA;    frameToInit->sample_rate = inputFrame->sample_rate;&#xA;    return nullptr;&#xA;}&#xA;&#xA;int main() {&#xA;    AVCodecContext *codingContext= NULL;&#xA;    const AVCodec *codec;&#xA;    codec = avcodec_find_encoder(AV_CODEC_ID_PCM_F32LE);&#xA;    codingContext = avcodec_alloc_context3(codec);&#xA;    codingContext->bit_rate = 16000;&#xA;    codingContext->sample_fmt = AV_SAMPLE_FMT_FLT;&#xA;    codingContext->sample_rate = 48000;&#xA;    codingContext->ch_layout.nb_channels = 2;&#xA;    codingContext->ch_layout.order = (AVChannelOrder)0;&#xA;    uint8_t **buffer_ = NULL;&#xA;    AVFrame* planar_frame = NULL;&#xA;    &#xA;    // open input&#xA;    AVFormatContext* formatContext = nullptr;&#xA;    int err = avformat_open_input(&amp;formatContext, "/Users/tonytorm/Desktop/drum kits/DECAP - Drums That Knock Vol. 9/Kicks/Brash Full Metal Kick.wav", nullptr, nullptr);&#xA;    if (err &lt; 0){&#xA;        fprintf(stderr, "Unable to open file!\n");&#xA;        return;&#xA;    }&#xA;&#xA;    // find audio stream&#xA;    err = avformat_find_stream_info(formatContext, nullptr);&#xA;    if (err > 0){&#xA;        fprintf(stderr, "Unable to retrieve stream info!\n");&#xA;        return;&#xA;    }&#xA;    &#xA;    int index = av_find_best_stream(formatContext, AVMEDIA_TYPE_AUDIO, -1, -1, nullptr, 0);&#xA;    if (index &lt; 0){&#xA;        std::cout&lt;&lt;  "coudn&#x27;t find audio stream in this file" &lt;&lt; &#x27;\n&#x27;;&#xA;    }&#xA;    AVStream* stream = formatContext->streams[index];&#xA;    &#xA;    auto fileName = "/Users/tonytorm/Desktop/newFile.wav";&#xA;    FILE* newFile = fopen(fileName, "w&#x2B;");&#xA;    &#xA;    // find right codec and open it&#xA;    if (auto openCodecContext = initializeAndOpenCodecContext(formatContext, stream)){&#xA;        AVPacket* packet = av_packet_alloc();&#xA;        AVFrame* frame = av_frame_alloc();&#xA;        AVFrame* planar_frame = av_frame_alloc();&#xA;        SwrContext *avr = swr_alloc();  //audio resampling context&#xA;        AVChannelLayout monoChannelLayout{(AVChannelOrder)0};&#xA;        monoChannelLayout.nb_channels = 2;&#xA;        &#xA;&#xA;        while (!av_read_frame(formatContext, packet)){&#xA;            if (packet->stream_index != stream->index) continue;  // we only care about audio&#xA;            int ret = avcodec_send_packet(openCodecContext, packet);&#xA;            if ( ret &lt; 0) {&#xA;                if (ret != AVERROR(EAGAIN)){   // if error is actual error not EAGAIN&#xA;                    std::cout &lt;&lt; "can&#x27;t do shit\n";&#xA;                    return;&#xA;                }&#xA;            }&#xA;            while (int bret = avcodec_receive_frame(openCodecContext, frame) == 0){&#xA;                initialisePlanarFrame(planar_frame, frame);&#xA;                &#xA;   &#xA;                &#xA;                int buffer_size_in = av_samples_get_buffer_size(nullptr,&#xA;                                                                frame->ch_layout.nb_channels,&#xA;                                                                frame->nb_samples,&#xA;                                                                (AVSampleFormat)frame->format,&#xA;                                                                0);&#xA;                int buffer_size_out = buffer_size_in/frame->ch_layout.nb_channels;&#xA;&#xA;                //planar_frame->linesize[0] = buffer_size_out;&#xA;                &#xA;                int ret = av_samples_alloc(planar_frame->data,&#xA;                                           NULL,&#xA;                                           planar_frame->ch_layout.nb_channels,&#xA;                                           planar_frame->nb_samples,&#xA;                                           AV_SAMPLE_FMT_FLTP,&#xA;                                           0);&#xA;                &#xA;                initialiseResampler(avr, frame, planar_frame);&#xA;                if (int errRet = swr_init(avr) &lt; 0) {&#xA;                    fprintf(stderr, "Failed to initialize the resampling context\n");&#xA;                }&#xA;&#xA;                if (ret &lt; 0){&#xA;                    char error_message[AV_ERROR_MAX_STRING_SIZE];&#xA;                    av_strerror(ret, error_message, AV_ERROR_MAX_STRING_SIZE);&#xA;                    fprintf(stderr, "Error allocating sample buffer: %s\n", error_message);&#xA;                    return -1;&#xA;                }&#xA;                &#xA;                int samples_converted = swr_convert(avr,&#xA;                                                    planar_frame->data,&#xA;                                                    buffer_size_out,&#xA;                                                    (const uint8_t **)frame->data,&#xA;                                                    buffer_size_in);&#xA;                if (samples_converted &lt; 0) {&#xA;                    // handle error&#xA;                    std::cout &lt;&lt; "error in conversion\n";&#xA;                    return;&#xA;                }&#xA;                if (avcodec_open2(codingContext, codec, NULL) &lt; 0) {&#xA;                    std::cout &lt;&lt; "can&#x27;t encode!\n";&#xA;                    return;&#xA;                }&#xA;                AVPacket* nu_packet = av_packet_alloc();&#xA;                while (int copy = avcodec_send_frame(codingContext, planar_frame) != 0){&#xA;                    if (copy == AVERROR(EAGAIN) || copy == AVERROR_EOF){&#xA;                        std::cout &lt;&lt; "can&#x27;t encode file\n";&#xA;                        return;&#xA;                    }&#xA;                    if (avcodec_receive_packet(codingContext, nu_packet) >=0){&#xA;                        fwrite(nu_packet->data, 4, nu_packet->size, newFile);&#xA;                        //av_write_frame(avc, nu_packet);&#xA;                    }&#xA;                }&#xA;                av_freep(planar_frame->data);&#xA;                av_frame_unref(frame);&#xA;                av_frame_unref(planar_frame);&#xA;            }&#xA;//            av_packet_free(&amp;packet);&#xA;//            av_packet_free(&amp;nu_packet);&#xA;        }&#xA;        swr_free(&amp;avr);&#xA;        avcodec_free_context(&amp;codingContext);&#xA;        &#xA;    }&#xA;    fclose(newFile);&#xA;}&#xA;

    &#xA;

    I know i should write a header to the new wave file but for now I'm just trying to write the raw audio data. I'm getting always the same error but in different parts of the code (randomly), sometimes the code even compiles (writing the raw audio data, but filling it with some rubbish as well, i end up with a data file that is thrice the original one, sometimes i end up with a slightly smaller file - i guess the raw audio without the headers), results are basically random.

    &#xA;

    Here are some of the functions that trigger the error :

    &#xA;

    int ret = av_samples_alloc(); //(this the most common one)&#xA;swr_convert()&#xA;av_freep();&#xA;

    &#xA;

    the error is :

    &#xA;

    main(64155,0x101b5d5c0) malloc: Incorrect checksum for freed object 0x106802600: probably modified after being freed.&#xA;Corrupt value: 0x0&#xA;main(64155,0x101b5d5c0) malloc: *** set a breakpoint in malloc_error_break to debug */&#xA;

    &#xA;

  • avfilter/paletteuse : remove alternative search methods

    27 décembre 2022, par Clément Bœsch
    avfilter/paletteuse : remove alternative search methods
    

    This is a maintenance pain more than anything. It appears to make the
    code slightly faster as a side effect.

    • [DH] libavfilter/vf_paletteuse.c