Recherche avancée

Médias (0)

Mot : - Tags -/xmp

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

Autres articles (47)

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

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (5029)

  • convert pcm stream data to encoded aac data

    24 décembre 2019, par Kumar

    I tried to convert pulse-audio pcm stream data to aac encoded data using ffmpeg.
    But after encoding I get noise-full data, not the correct one. Here I post my code, anyone help me with some ideas.

    Initial configuration :

       av_register_all();

       int error;
       if ((error = avio_open(&output_io_context,"out.aac",AVIO_FLAG_WRITE))<0) {
               printf("could not open output file\n");
       }

       if (!(output_format_context = avformat_alloc_context())) {
               printf("output_format_context error\n");
       }

       output_format_context->pb = output_io_context;

       if(!(output_format_context->oformat = av_guess_format(NULL, "out.aac", NULL))) {
               printf("guess format error\n");
       }

       codec = avcodec_find_encoder(AV_CODEC_ID_AAC);
       if (codec == NULL) {
               printf("avcodec_find_encoder: ERROR\n");
       }

       if (!(stream = avformat_new_stream(output_format_context, NULL))) {
               printf("stream create error\n");
       }
       output_codec_context = avcodec_alloc_context3(codec);
       if(!output_codec_context) {
               printf("output_codec_context is null\n");
       }

       output_codec_context->channels       = CHANNELS;
       output_codec_context->channel_layout = av_get_default_channel_layout(CHANNELS);
       output_codec_context->sample_rate    = SAMPLE_RATE; //input_codec_context->sample_rate;
       output_codec_context->sample_fmt     = codec->sample_fmts[0];
       output_codec_context->bit_rate       = 48000; //OUTPUT_BIT_RATE;

       stream->time_base.den = SAMPLE_RATE;//input_codec_context->sample_rate;
       stream->time_base.num = 1;

       if(output_format_context->oformat->flags & AVFMT_GLOBALHEADER)
               output_codec_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

       if ((error = avcodec_open2(output_codec_context, codec, NULL)) < 0) {
           printf("error");
       }

       error = avcodec_parameters_from_context(stream->codecpar, output_codec_context);

       if (write_output_file_header(output_format_context)) {
               printf("write header failure...\n");
       }

    Data encoding :

    AVFrame *output_frame;
    int frame_pos = 0, ctx_frame_size = output_codec_context->frame_size;
    int size = av_samples_get_buffer_size(NULL, CHANNELS,
                 output_codec_context->frame_size,output_codec_context->sample_fmt, 1);
    if((x =  avcodec_fill_audio_frame(output_frame, CHANNELS,
                  output_codec_context->sample_fmt, data, length, 1)) < 0) {
         printf("avcodec_fill_audio_frame error : %s\n", av_err2str(x));
    }

    int data_written;
    if (encode_audio_frame(output_frame, output_format_context,
               output_codec_context, &data_written)) {
           printf("encode_audio_frame error\n");
     }

     av_frame_free(&output_frame);

    helper_function :

    int encode_audio_frame(AVFrame *frame,AVFormatContext *output_format_context,
                 AVCodecContext *output_codec_context, int *data_present)
    {
      AVPacket output_packet;
      int error;
      init_packet(&output_packet);

      if (frame) {
         frame->pts = pts;
         pts += frame->nb_samples;
      }

      error = avcodec_send_frame(output_codec_context, frame);
      if (error == AVERROR_EOF) {
        error = 0;
        goto cleanup;
      } else if (error < 0) {
         fprintf(stderr, "Could not send packet for encoding (error '%s')\n",
               av_err2str(error));
         return error;
      }

      error = avcodec_receive_packet(output_codec_context, &output_packet);
      if (error == AVERROR(EAGAIN)) {
        error = 0;
        goto cleanup;
      } else if (error == AVERROR_EOF) {
         error = 0;
         goto cleanup;
      } else if (error < 0) {
         fprintf(stderr, "Could not encode frame (error '%s')\n",
               av_err2str(error));
         goto cleanup;
      } else {
         *data_present = 1;
     }

     if (*data_present &&
         (error = av_write_frame(output_format_context, &output_packet)) < 0) {
         fprintf(stderr, "Could not write frame (error '%s')\n",
                av_err2str(error));
         goto cleanup;
     }

     cleanup:
         av_packet_unref(&output_packet);
         return error;
    }
    • Do we need to fill AVFrame with sizeof(av_samples_get_buffer_size) or context->frame_size ?

    TYIA :) !!

  • Although ffmpeg installed, unable to save mp4 file on disk

    2 janvier 2020, par yannis

    Although I have installed ffmpeg, matplotlib reports that MovieWriter ffmpeg is unavailable and the MP4 file created is empty.

    import numpy as np
    from matplotlib import pyplot as plt
    from matplotlib import animation

    # First set up the figure, the axis, and the plot element we want to animate
    fig = plt.figure()
    ax = plt.axes(xlim=(0, 2), ylim=(-2, 2))
    line, = ax.plot([], [], lw=2)

    # initialization function: plot the background of each frame
    def init():
       line.set_data([], [])
       return line,

    # animation function.  This is called sequentially
    def animate(i):
       x = np.linspace(0, 2, 1000)
       y = np.sin(2 * np.pi * (x - 0.01 * i))
       line.set_data(x, y)
       return line,

    # call the animator.  blit=True means only re-draw the parts that have changed.
    anim = animation.FuncAnimation(fig, animate, init_func=init,
                                  frames=200, interval=20, blit=True)

    # save the animation as an mp4.  This requires ffmpeg or mencoder to be
    # installed.  The extra_args ensure that the x264 codec is used, so that
    # the video can be embedded in html5.  You may need to adjust this for
    # your system: for more information, see
    # http://matplotlib.sourceforge.net/api/animation_api.html
    anim.save('basic_animation.mp4', fps=30, extra_args=['-vcodec', 'libx264'])

    plt.show()

    I have even added the line plt.switch_backend('TkAgg') proposed in another post, nothing changed. Here is my matplotlib :

    Name: matplotlib
    Version: 2.1.0
    Summary: Python plotting package
    Home-page: http://matplotlib.org

    my ffmpeg :

    Name: ffmpeg
    Version: 1.4
    Summary: ffmpeg python package url [https://github.com/jiashaokun/ffmpeg]
    Home-page: https://github.com/jiashaokun/ffmpeg

    and my Python version :

    Python 3.6.5

    The error I get is :

    /usr/local/lib/python3.6/site-packages/matplotlib/animation.py:1218: UserWarning: MovieWriter ffmpeg unavailable
     warnings.warn("MovieWriter %s unavailable" % writer)

    This error has been reported many times on stackoverflow, each time the solution is either to install ffmpeg (mine is installed) or to add that extra line about the backend, which hasn’t changed anything for me.

    Curiously enough the plt.show()command works and I do preview an animation, but the only file format to save it is (nonanimated) PNG.

  • vp9lpf/x86 : save one register in loopfilter surface coverage.

    20 décembre 2014, par Ronald S. Bultje
    vp9lpf/x86 : save one register in loopfilter surface coverage.
    

    Signed-off-by : Anton Khirnov <anton@khirnov.net>

    • [DBH] libavcodec/x86/vp9lpf.asm