Recherche avancée

Médias (91)

Autres articles (29)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

  • MediaSPIP Core : La Configuration

    9 novembre 2010, par

    MediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
    Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...)

Sur d’autres sites (4594)

  • Encoding webm with ffmpeg and libvorbis does not work

    24 janvier 2014, par AnthonyM

    I am attempting to run a modified version of the ffmpeg muxing example which outputs vorbis encoded audio to a webm container.

    The code works fine if I specify mp3 as the format, just not when I use vorbis

    THe code is similar to http://www.ffmpeg.org/doxygen/2.0/doc_2examples_2muxing_8c-example.html but with the video portions stripped out. I tested with video enabled and the example video was encoded properly, but with no audio.

    ffmpeg is compiled with libvorbis and libvpx support.

    #include
    #include
    #include
    #include
    #include <libavutil></libavutil>opt.h>
    #include <libavutil></libavutil>mathematics.h>
    #include <libavformat></libavformat>avformat.h>
    #include <libswscale></libswscale>swscale.h>
    #include <libswresample></libswresample>swresample.h>

    #define STREAM_DURATION 200.0
    extern AVCodec ff_libvorbis_encoder;

    static AVFrame *frame;
    static AVStream *add_stream(AVFormatContext *oc, AVCodec **codec,
                               enum AVCodecID codec_id)
    {
       AVCodecContext *c;
       AVStream *st;
       /* find the encoder */
       //*codec = &ff_libvorbis_encoder;
       *codec = avcodec_find_encoder(codec_id);
       if (!(*codec)) {
           fprintf(stderr, "Could not find encoder for &#39;%s&#39;\n",
                   avcodec_get_name(codec_id));
           exit(1);
       }
       st = avformat_new_stream(oc, *codec);
       if (!st) {
           fprintf(stderr, "Could not allocate stream\n");
           exit(1);
       }
       st->id = oc->nb_streams-1;
       c = st->codec;
       switch ((*codec)->type) {
       case AVMEDIA_TYPE_AUDIO:
           c->sample_fmt  = AV_SAMPLE_FMT_FLTP;
           c->bit_rate    = 64000;
           c->sample_rate = 44100;
           c->channels    = 2;
           break;
       default:
           break;
       }
       /* Some formats want stream headers to be separate. */
       if (oc->oformat->flags & AVFMT_GLOBALHEADER)
           c->flags |= CODEC_FLAG_GLOBAL_HEADER;
       return st;
    }

    static float t, tincr, tincr2;
    static uint8_t **src_samples_data;
    static int       src_samples_linesize;
    static int       src_nb_samples;
    static int max_dst_nb_samples;
    uint8_t **dst_samples_data;
    int       dst_samples_linesize;
    int       dst_samples_size;
    struct SwrContext *swr_ctx = NULL;
    static void open_audio(AVFormatContext *oc, AVCodec *codec, AVStream *st) {
     AVCodecContext *c;
       int ret;
       c = st->codec;
       /* open it */
       ret = avcodec_open2(c, codec, NULL);
       if (ret sample_rate;
       /* increment frequency by 110 Hz per second */
       tincr2 = 2 * M_PI * 110.0 / c->sample_rate / c->sample_rate;
       src_nb_samples = c->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE ?
           10000 : c->frame_size;
       ret = av_samples_alloc_array_and_samples(&src_samples_data, &src_samples_linesize, c->channels,
                                                src_nb_samples, c->sample_fmt, 0);
       if (ret sample_fmt != AV_SAMPLE_FMT_S16) {
           swr_ctx = swr_alloc();
           if (!swr_ctx) {
               fprintf(stderr, "Could not allocate resampler context\n");
               exit(1);
           }
           /* set options */
           av_opt_set_int       (swr_ctx, "in_channel_count",   c->channels,       0);
           av_opt_set_int       (swr_ctx, "in_sample_rate",     c->sample_rate,    0);
           av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt",      AV_SAMPLE_FMT_S16, 0);
           av_opt_set_int       (swr_ctx, "out_channel_count",  c->channels,       0);
           av_opt_set_int       (swr_ctx, "out_sample_rate",    c->sample_rate,    0);
           av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt",     AV_SAMPLE_FMT_FLTP,     0);
           /* initialize the resampling context */
           if ((ret = swr_init(swr_ctx)) channels,
                                                max_dst_nb_samples, c->sample_fmt, 0);
       if (ret channels, max_dst_nb_samples,
                                                     c->sample_fmt, 0);
    }

    static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels)
    {
       int j, i, v;
       int16_t *q;
       q = samples;
       for (j = 0; j codec;
       get_audio_frame((int16_t *)src_samples_data[0], src_nb_samples, c->channels);
       /* convert samples from native format to destination codec format, using the resampler */
       if (swr_ctx) {
           /* compute destination number of samples */
           dst_nb_samples = av_rescale_rnd(swr_get_delay(swr_ctx, c->sample_rate) + src_nb_samples,
                                           c->sample_rate, c->sample_rate, AV_ROUND_UP);
           if (dst_nb_samples > max_dst_nb_samples) {
               av_free(dst_samples_data[0]);
               ret = av_samples_alloc(dst_samples_data, &dst_samples_linesize, c->channels,
                                      dst_nb_samples, c->sample_fmt, 0);
               if (ret channels, dst_nb_samples,
                                                             c->sample_fmt, 0);
           }
           /* convert to destination format */
           ret = swr_convert(swr_ctx,
                             dst_samples_data, dst_nb_samples,
                             (const uint8_t **)src_samples_data, src_nb_samples);
           if (ret nb_samples = dst_nb_samples;
       avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt,
                                dst_samples_data[0], dst_samples_size, 0);
       ret = avcodec_encode_audio2(c, &pkt, frame, &got_packet);
       if (ret index;
       /* Write the compressed frame to the media file. */
       ret = av_interleaved_write_frame(oc, &pkt);
       if (ret != 0) {
           fprintf(stderr, "Error while writing audio frame: %s\n",
                   av_err2str(ret));
           exit(1);
       }
       avcodec_free_frame(&frame);
    }

    static void close_audio(AVFormatContext *oc, AVStream *st)
    {
       avcodec_close(st->codec);
       av_free(src_samples_data[0]);
       av_free(dst_samples_data[0]);
    }

    int main(int argc, char *argv[]) {
     AVOutputFormat *fmt;
     AVFormatContext *oc;
     AVStream *audio_st;
     AVCodec *audio_codec;
     double audio_time, video_time;
     int ret = 0;
     const char *input = argv[1];
     const char *output = argv[2];

     av_register_all();
     avformat_alloc_output_context2(&oc, NULL, NULL, output);
     if(!oc) {
       printf("Could not alloc the output context");
       return 1;
     }

     fmt = oc->oformat;

     audio_st = NULL;
     if(fmt->audio_codec != AV_CODEC_ID_NONE) {
       audio_st = add_stream(oc, &audio_codec, fmt->audio_codec);
       printf("Started audio stream with codec %s\n", audio_codec->name);
     }

     if(audio_st) {
       open_audio(oc, audio_codec, audio_st);
     }
     av_dump_format(oc, 0, output, 1);

     if (!(fmt->flags & AVFMT_NOFILE)) {
       ret = avio_open(&oc->pb, output, AVIO_FLAG_WRITE);
       if (ret pts = 0;
     for (;;) {
       audio_time = audio_st ? audio_st->pts.val * av_q2d(audio_st->time_base) : 0.0;
       if ((!audio_st || audio_time >= STREAM_DURATION))
         break;
       write_audio_frame(oc, audio_st);
     }
     av_write_trailer(oc);
     if(audio_st)
       close_audio(oc, audio_st);
     if(!(fmt->flags & AVFMT_NOFILE))
       avio_close(oc->pb);
     avformat_free_context(oc);
     return 0;

    }

    compiled with

    clang -o converter -lavcodec -lavformat -lavutil -lswresample -lvorbis converter.c

    output

    ~/v/converter> ./converter test.wav test.webm
    Started audio stream with codec libvorbis
    Output #0, webm, to &#39;test.webm&#39;:
       Stream #0:0: Audio: vorbis (libvorbis), 44100 Hz, 2 channels, fltp, 64 kb/s
    [libvorbis @ 0x7fdafb800600] 33 frames left in the queue on closing
  • Scaling and stacking 2 videos

    31 octobre 2019, par Gambit2007

    I have 2 inputs and I want to scale, crop and put them on top of each other at the same time. My command should look something like this :

    ffmpeg -i input1 -i input2 -filter_complex crop=10000:5000:1000:0,scale=3840:1536 vstack output.mp4

    I know I need to use chaining (?) but I tried to look it up online and couldn’t really get it to work.

    So what would be the correct syntax the scale and crop both inputs and then put them vertically on top of each other while using ’-filter_complex’ only once ?

  • Add two MP3 files to an MP4 file using ffmpeg

    26 septembre 2019, par sigur7

    I am using ffmpeg on Windows and getting the following error as I try to add two MP3

    Stream specifier '' in filtergraph description [1]adelay=1|1[b];[2]adelay=100|100[c];[0][b][c]amix=3 matches no streams.

    using the following command

    ffmpeg -i vidwithnoaudio.mp4 -i audio0.mp3 -i audio1.mp3 -filter_complex "[1]adelay=1|1[b];[2]adelay=100|100[c];[0][b][c]amix=3" vidwithaudio.mp4

    Here is an alternative command I have found I am trying to edit into working with this :

    ffmpeg -i 1.mp4 -i 1.3gp -i 2.3gp -i 1.mp3
     -filter_complex "[2]adelay=10000|10000[s2];[3:a][1:a][s2]amix=3[a]"
     -map 0:v -map "[a]" -c:v copy result.mp4