Recherche avancée

Médias (1)

Mot : - Tags -/book

Autres articles (57)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

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

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (9227)

  • FFmpeg.swr_convert : audio to raw 16 bit pcm, to be used with xna SoundEffect. Audio cuts out when i convert

    21 mars 2019, par Robert Russell

    I want to resample mkv(vp8/ogg) and also raw 4 bit adpcm to raw 16bit pcm byte[] to be loaded into SoundEffect from xna library. So I can play it out while I’m using other code to display the frames (the video side is working).
    I can read a 16 bit wav file and play it. But when I goto resample something it doesn’t play 100%. One file is 3 mins and 15 secs. I only get 13 sec and 739 ms before it quits playing. I have been learning to do this by finding code samples in c++ and correcting it to work in c# using ffmpeg.autogen.

    the below is my best attempt at resampling.

               int nb_samples = Frame->nb_samples;
                       int output_nb_samples = nb_samples;
                       int nb_channels = ffmpeg.av_get_channel_layout_nb_channels(ffmpeg.AV_CH_LAYOUT_STEREO);
                       int bytes_per_sample = ffmpeg.av_get_bytes_per_sample(AVSampleFormat.AV_SAMPLE_FMT_S16) * nb_channels;
                       int bufsize = ffmpeg.av_samples_get_buffer_size(null, nb_channels, nb_samples,
                                                                AVSampleFormat.AV_SAMPLE_FMT_S16, 1);

                       byte*[] b = Frame->data;
                       fixed (byte** input = b)
                       {
                           byte* output = null;
                           ffmpeg.av_samples_alloc(&output, null,
                               nb_channels,
                               nb_samples,
                               (AVSampleFormat)Frame->format, 0);//

                           // Buffer input

                           Ret = ffmpeg.swr_convert(Swr, &output, output_nb_samples / 2, input, nb_samples);
                           CheckRet();
                           WritetoMs(output, 0, Ret * bytes_per_sample);
                           output_nb_samples -= Ret;

                           // Drain buffer
                           while ((Ret = ffmpeg.swr_convert(Swr, &output, output_nb_samples, null, 0)) > 0)
                           {
                               CheckRet();
                               WritetoMs(output, 0, Ret * bytes_per_sample);
                               output_nb_samples -= Ret;
                           }
                       }

    I changed that all to this but it cuts off sooner.

     Channels = ffmpeg.av_get_channel_layout_nb_channels(OutFrame->channel_layout);
                       int nb_channels = ffmpeg.av_get_channel_layout_nb_channels(ffmpeg.AV_CH_LAYOUT_STEREO);
                       int bytes_per_sample = ffmpeg.av_get_bytes_per_sample(AVSampleFormat.AV_SAMPLE_FMT_S16) * nb_channels;

                       if((Ret = ffmpeg.swr_convert_frame(Swr, OutFrame, Frame))>=0)
                           WritetoMs(*OutFrame->extended_data, 0, OutFrame->nb_samples * bytes_per_sample);
                       CheckRet();

    Both code use a function to set Swr it runs one time after the first frame is decoded.

           private void PrepareResampler()
       {
           ffmpeg.av_frame_copy_props(OutFrame, Frame);
           OutFrame->channel_layout = ffmpeg.AV_CH_LAYOUT_STEREO;
           OutFrame->format = (int)AVSampleFormat.AV_SAMPLE_FMT_S16;
           OutFrame->sample_rate = Frame->sample_rate;
           OutFrame->channels = 2;
           Swr = ffmpeg.swr_alloc();
           if (Swr == null)
               throw new Exception("SWR = Null");
           Ret = ffmpeg.swr_config_frame(Swr, OutFrame, Frame);
           CheckRet();
           Ret = ffmpeg.swr_init(Swr);
           CheckRet();
           Ret = ffmpeg.swr_is_initialized(Swr);
           CheckRet();
       }

    This is where I take the output and put it in the sound effect

    private void ReadAll()
       {

           using (Ms = new MemoryStream())
           {
               while (true)
               {
                   Ret = ffmpeg.av_read_frame(Format, Packet);
                   if (Ret == ffmpeg.AVERROR_EOF)
                       break;
                   CheckRet();
                   Decode();
               }
               if (Ms.Length > 0)
               {
                   se = new SoundEffect(Ms.ToArray(), 0, (int)Ms.Length, OutFrame->sample_rate, (AudioChannels)Channels, 0, 0);
                   //se.Duration; Stream->duration;


                   see = se.CreateInstance();
                   see.Play();
               }
           }
       }
  • Disable image resizing on the Basic Plus and AngularJS demo for Android and Opera.

    12 juin 2013, par blueimp
    Disable image resizing on the Basic Plus and AngularJS demo for Android and Opera.
  • mpegaudiodec : cosmetics : basic pretty-printing

    27 septembre 2011, par Justin Ruggles

    mpegaudiodec : cosmetics : basic pretty-printing