Recherche avancée

Médias (1)

Mot : - Tags -/intégration

Autres articles (100)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

  • Problèmes fréquents

    10 mars 2010, par

    PHP et safe_mode activé
    Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
    La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

Sur d’autres sites (10923)

  • html5 video wont play ANY mp4 encodes on ipad

    12 mars 2019, par nickg

    Im trying to embed a mp4 on a page with the HTML5 video tag. Everything works fine on Desktop but nothing will work on an iPad Version 9.3.4.
    I have the mime types in an .htaccess file. I’ve tried various encodes with handbrake, Miro and FFmpeg conversions.

    Even sample videos like at w3schools and videojs don’t play.
    The video will play if i actually sync it to the iPad, but nothing works over the web. An older iPad actually plays mp4s through the HTML5 video player.
    I’m ready to throw this POS iPad through a window.

    <video autoplay="false" width="320" height="240" controls="true">
     <source src="http://webnamehere.com/video/bunny.mp4" type="video/mp4; codecs=&quot;avc1.42E01E, mp4a.40.2&quot;">

    Your browser does not support the video tag.
    </source></video>

    Has anyone found a way to fix this ? Is there ANY encoding that this thing will actually play ? Thank you in advance for any help.

  • 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(&amp;output, null,
                               nb_channels,
                               nb_samples,
                               (AVSampleFormat)Frame->format, 0);//

                           // Buffer input

                           Ret = ffmpeg.swr_convert(Swr, &amp;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, &amp;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();
               }
           }
       }
  • Decoding YUYV422 raw images using FFmpeg

    12 avril 2019, par user373864q

    I have a collection of sequential YUYV422 raw images that I wish to turn into a video. The problem seems to be that when the frame is created in the avcodec_receive_frame. The frame only contains one channel instead of four in the YUYV format. This results in Input picture width &lt;640> is greater then stride (0) since only the zeroth index of data and linesize is set in the frame. I don’t know if this is a ffmpeg bug or a misconfiguration on my part.

    #include "icsFfmpegImageDecoder.h"
    #include <stdexcept>

    ImageDecoder::ImageDecoder(std::string filename)
    {
       AVInputFormat* iformat;
       if (!(iformat = av_find_input_format("image2")))
           throw std::invalid_argument(std::string("input Codec not found\n"));

       this->fctx = NULL;
       if (avformat_open_input(&amp;this->fctx, filename.c_str(), iformat, NULL) &lt; 0)
       {
           std::string error = "Failed to open input file ";
           error += filename;
           error += "\n";
           throw std::invalid_argument(error);
       }
    #ifdef LIB_AVFORMAT_STREAM_CODEC_DEPRECATED
       if (!(this->codec = avcodec_find_decoder(this->fctx->streams[0]->codecpar->codec_id)))
           throw std::invalid_argument(std::string("Failed to find codec\n"));

       if (!(this->cctx = avcodec_alloc_context3(this->codec)))
           throw std::invalid_argument(std::string("could not create image read context codec"));

       if (avcodec_parameters_to_context(this->cctx, this->fctx->streams[0]->codecpar) &lt; 0)
           throw std::invalid_argument(std::string("could not get contest codec from stream"));
    #else
       this->cctx = this->fctx->streams[0]->codec;
       if (!(this->codec = avcodec_find_decoder(this->cctx->codec_id)))
           throw std::invalid_argument(std::string("Failed to find codec\n"));
    #endif

       if (this->cctx->codec_id == AV_CODEC_ID_RAWVIDEO) {
           // TODO Make Dynamic
           this->cctx->pix_fmt = AV_PIX_FMT_YUYV422 ;
           this->cctx->height = 800;
           this->cctx->width = 1280;
       }

       if (avcodec_open2(this->cctx, this->codec, NULL) &lt; 0)
           throw std::invalid_argument(std::string("Failed to open codec\n"));

    #ifdef USING_NEW_AVPACKET_SETUP
       if (!(this->pkt = av_packet_alloc()))
           throw std::invalid_argument(std::string("Failed to alloc frame\n"));
    #else
       this->pkt = new AVPacket();
       av_init_packet(this->pkt);
    #endif
       read_file();
    }

    ImageDecoder::~ImageDecoder()
    {
       avcodec_close(this->cctx);
       avformat_close_input(&amp;this->fctx);
    #ifdef USING_NEW_AVPACKET_SETUP
       av_packet_free(&amp;this->pkt);
    #else
       av_free_packet(this->pkt);
       delete this->pkt;
    #endif
    }

    void ImageDecoder::read_file()
    {
       if (av_read_frame(this->fctx, this->pkt) &lt; 0)
           throw std::invalid_argument(std::string("Failed to read frame from file\n"));

       if (this->pkt->size == 0)  
           this->ret = -1;
    }

    #ifdef LIB_AVCODEC_USE_SEND_RECEIVE_NOTATION
    void ImageDecoder::send_next_packet() {

       if ((this->ret = avcodec_send_packet(this->cctx, this->pkt)) &lt; 0)
           throw std::invalid_argument("Error sending a packet for decoding\n");
    }

    bool ImageDecoder::receive_next_frame(AVFrame* frame)
    {
       if (this->ret >= 0)
       {
           this->ret = avcodec_receive_frame(this->cctx, frame);
           if (this->ret == AVERROR_EOF)
               return false;
           else if (this->ret == AVERROR(11))//11 == EAGAIN builder sucks
               return false;
           else if (this->ret &lt; 0)
               throw std::invalid_argument("Error during decoding\n");
           return true;
       }
       return false;
    }
    #else
    void ImageDecoder::decode_frame(AVFrame* frame)
    {
       int got_frame = 0;
       if (avcodec_decode_video2(this->cctx, frame, &amp;got_frame, this->pkt) &lt; 0)
           throw std::invalid_argument("Error while decoding frame %d\n");
    }
    #endif
    </stdexcept>