Recherche avancée

Médias (91)

Autres articles (69)

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

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

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

  • How to adjust audio volume with AVFilter API from FFmpeg in Linux ?

    20 décembre 2024, par wangt13

    I am working on an embedded Linux system (kernel-5.10.24), and developing an audio player by using FFmpeg and ALSA libraries.

    


    Now the basic functions are done, and I can play MP3 file by using AVCodec and SWresample interfaces of FFmpeg.

    


    int decode_play(void)
{
    .....
    while (1) {
        if (av_read_frame(pfmtctx, packet) < 0) {
            avcodec_flush_buffers(pcodectx);
            printf("Got end of media, breaking\n");
            break;
        }
        if (packet->stream_index != stream) {
            continue;
        }
        int res = avcodec_send_packet(pcodectx, packet);
        if (res < 0) {
            printf("Error in decoding audio frame.\n");
            break;
        }

        while (res >= 0) {
            res = avcodec_receive_frame(pcodectx, pframe);
            if (res == AVERROR(EAGAIN)) {
                break;
            } else if (res == AVERROR_EOF) {
                break;
            } else if (res >= 0) {
                int outsamples = swr_convert(swrctx, &buf, pcodectx->frame_size, (const uint8_t **)pframe->data, pframe->nb_samples);
                snd_pcm_write(pcm_handle, buf, outsamples);
            }
        }
    }
}


    


    Now, I want to add volume changing to this audio player.
    
I found that there is AVfilter functions in FFmpeg, which can be used to adjust audio's volume. How can I use it in current design ?
I am not sure what filters should I use, and where should I plugin the filters ?
Should I put the filters before swr_convert or after the swr_convert ?

    


    With Erdal's help, I changed the player as follows,

    


    int decode_play(void)
{
    /* Init filter graph as filter_audio.c does */
    init_filter_graph(&graph, &src, &sink);

    while (1) {
        if (av_read_frame(pfmtctx, packet) < 0) {
            avcodec_flush_buffers(pcodectx);
            printf("Got end of media, breaking\n");
            break;
        }
        if (packet->stream_index != stream) {
            continue;
        }
        int res = avcodec_send_packet(pcodectx, packet);
        if (res < 0) {
            printf("Error in decoding audio frame.\n");
            break;
        }

        while (res >= 0) {
            res = avcodec_receive_frame(pcodectx, pframe);
            if (res == AVERROR(EAGAIN)) {
                break;
            } else if (res == AVERROR_EOF) {
                break;
            } else if (res >= 0) {
                int ret = av_buffersrc_add_frame(src, pframe);
                if (ret < 0) {
                    continue;
                }
                while ((ret = av_buffersink_get_frame(sink, filt_frame)) >= 0) {
                    int nb_samples = av_rescale_rnd(filt_frame->nb_samples, RESAMPLE_SAMPLE_RATE, filt_frame->sample_rate, AV_ROUND_UP);
                    printf("nb_samples: %d, f.nb_sample: %d, f.sr: %d\n", nb_samples, filt_frame->nb_samples, filt_frame->sample_rate);

                    int outs = snd_pcm_writei(playback_handle, filt_frame->extended_data[0], nb_samples);
                    if (outs < 0) {
                        snd_pcm_prepare(playback_handle);
                    }
                }
            }
        }
    }
}


    


    The original audio in format of 44100 Hz, stereo, fltp. And I chose to use aformat to do resampling instead of swresample as follows.

    


        snprintf(options_str, sizeof(options_str),
            "sample_fmts=%s:sample_rates=%d:channel_layouts=stereo",
            av_get_sample_fmt_name(AV_SAMPLE_FMT_S16), 32000);
    if (avfilter_init_str(aformat_ctx, options_str) < 0) {
        printf("error init aformat filter");
        return -1;
    }


    


    I succeeded playing the resampled audio with Avfilter.

    


  • Revision 3826 : Pouvoir mettre le volume en cookie afin de pouvoir le réutiliser de pages ...

    20 août 2010, par kent1 — Log

    Pouvoir mettre le volume en cookie afin de pouvoir le réutiliser de pages en pages

  • How to change the .ts file names in side the m3u8 file

    13 août 2020, par Isuru Bandara

    Recently I am using FFmpeg for a project. I used FFmpeg to convert mp3 bitrates and other stuff. Those are working perfectly. But now I want to add mp3%2Fmusic%2F[outputN.ts] ?alt=media for every outputN.ts texts inside the m3u8 file. This my m3u8 file data structure,

    



    


    #EXTM3U

    


    #EXT-X-VERSION:3

    


    #EXT-X-TARGETDURATION:2

    


    #EXT-X-MEDIA-SEQUENCE:0

    


    #EXTINF:2.005333,

    


    'output000.ts'

    


    #EXTINF:2.005333,

    


    'output001.ts'

    



    


    For Example, Now I want to apply mp3%2Fmusic%2F and ?alt=media for every text (output000.ts,output001.ts and so on) inside this m3u8 file using windows cmd. For instance,

    



    


    #EXTINF:2.005333,

    


    mp3%2Fmusic%2Foutput000.ts ?alt=media

    


    #EXTINF:2.005333,

    


    mp3%2Fmusic%2Foutput001.ts ?alt=media