Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (51)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

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

Sur d’autres sites (9364)

  • how to play audio from a video file in c#

    10 août 2014, par Ivan Lisovich

    For read video file I use ffmpeg libraries(http://ffmpeg.zeranoe.com/builds/) build ffmpeg-2.2.3-win32-dev.7z.
    manage c++ code for read video file :

    void VideoFileReader::Read( String^ fileName, System::Collections::Generic::List^ imageData, System::Collections::Generic::List^>^ audioData )
    {
       char *nativeFileName = ManagedStringToUnmanagedUTF8Char(fileName);
       libffmpeg::AVFormatContext *pFormatCtx = NULL;
       libffmpeg::AVCodec         *pCodec = NULL;
       libffmpeg::AVCodec         *aCodec = NULL;

       libffmpeg::av_register_all();
       if(libffmpeg::avformat_open_input(&pFormatCtx, nativeFileName, NULL, NULL) != 0)
       {    
           throw gcnew System::Exception( "Couldn't open file" );
       }
       if(libffmpeg::avformat_find_stream_info(pFormatCtx, NULL) < 0)
       {
           throw gcnew System::Exception( "Couldn't find stream information" );
       }
       libffmpeg::av_dump_format(pFormatCtx, 0, nativeFileName, 0);
       int videoStream = libffmpeg::av_find_best_stream(pFormatCtx, libffmpeg::AVMEDIA_TYPE_VIDEO, -1, -1, &pCodec, 0);
       int audioStream = libffmpeg::av_find_best_stream(pFormatCtx, libffmpeg::AVMEDIA_TYPE_AUDIO, -1, -1, &aCodec, 0);
       if(videoStream == -1)
       {
           throw gcnew System::Exception( "Didn't find a video stream" );
       }
       if(audioStream == -1)
       {
           throw gcnew System::Exception( "Didn't find a audio stream" );
       }
       libffmpeg::AVCodecContext *aCodecCtx = pFormatCtx->streams[audioStream]->codec;
       libffmpeg::avcodec_open2(aCodecCtx, aCodec, NULL);
       m_channels = aCodecCtx->channels;
       m_sampleRate = aCodecCtx->sample_rate;
       m_bitsPerSample = aCodecCtx->bits_per_coded_sample;
       libffmpeg::AVCodecContext *pCodecCtx = pFormatCtx->streams[videoStream]->codec;
       if(libffmpeg::avcodec_open2(pCodecCtx, pCodec, NULL) < 0)
       {
           throw gcnew System::Exception( "Could not open codec" );
       }
       m_width  = pCodecCtx->width;
       m_height = pCodecCtx->height;
       m_framesCount = pFormatCtx->streams[videoStream]->nb_frames;
       if (pFormatCtx->streams[videoStream]->r_frame_rate.den == 0)
       {    
           m_frameRate = 25;
       }
       else
       {
           m_frameRate = pFormatCtx->streams[videoStream]->r_frame_rate.num / pFormatCtx->streams[videoStream]->r_frame_rate.den;
           if (m_frameRate == 0)
           {    
               m_frameRate = 25;
           }
       }

       libffmpeg::AVFrame *pFrame = libffmpeg::av_frame_alloc();
       int numBytes = libffmpeg::avpicture_get_size(libffmpeg::PIX_FMT_RGB24, pCodecCtx->width, pCodecCtx->height);
       libffmpeg::uint8_t *buffer = (libffmpeg::uint8_t *)libffmpeg::av_malloc(numBytes*sizeof(libffmpeg::uint8_t));
       struct libffmpeg::SwsContext *sws_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height, libffmpeg::PIX_FMT_RGB24, SWS_BILINEAR, NULL,    NULL,    NULL);
       libffmpeg::AVPacket packet;
       libffmpeg::AVFrame *filt_frame = libffmpeg::av_frame_alloc();
       while(av_read_frame(pFormatCtx, &packet) >= 0)
       {
           if(packet.stream_index == videoStream)
           {
               System::Drawing::Bitmap ^bitmap = nullptr;
               int frameFinished;
               avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
               if(frameFinished)
               {
                   bitmap = gcnew System::Drawing::Bitmap( pCodecCtx->width, pCodecCtx->height, System::Drawing::Imaging::PixelFormat::Format24bppRgb );
                   System::Drawing::Imaging::BitmapData^ bitmapData = bitmap->LockBits( System::Drawing::Rectangle( 0, 0, pCodecCtx->width, pCodecCtx->height ), System::Drawing::Imaging::ImageLockMode::ReadOnly, System::Drawing::Imaging::PixelFormat::Format24bppRgb );
                   libffmpeg::uint8_t* ptr = reinterpret_cast( static_cast( bitmapData->Scan0 ) );
                   libffmpeg::uint8_t* srcData[4] = { ptr, NULL, NULL, NULL };
                   int srcLinesize[4] = { bitmapData->Stride, 0, 0, 0 };
                   libffmpeg::sws_scale( sws_ctx, (libffmpeg::uint8_t const * const *)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, srcData, srcLinesize );
                   bitmap->UnlockBits( bitmapData );
               }
               imageData->Add(bitmap);
           }
           else if(packet.stream_index == audioStream)
           {
               int b = av_dup_packet(&packet);
               if(b >= 0) {
                   int audio_pkt_size = packet.size;
                   libffmpeg::uint8_t* audio_pkt_data = packet.data;
                   while(audio_pkt_size > 0)
                   {
                       int got_frame = 0;
                       int len1 = libffmpeg::avcodec_decode_audio4(aCodecCtx, pFrame, &got_frame, &packet);

                       if(len1 < 0)
                       {
                           audio_pkt_size = 0;
                           break;
                       }

                       audio_pkt_data += len1;
                       audio_pkt_size -= len1;

                       if (got_frame)
                       {
                           int data_size = libffmpeg::av_samples_get_buffer_size ( NULL, aCodecCtx->channels, pFrame->nb_samples, aCodecCtx->sample_fmt, 1 );
                           array<byte>^ managedBuf = gcnew array<byte>(data_size);
                           System::IntPtr iptr = System::IntPtr( pFrame->data[0] );
                           System::Runtime::InteropServices::Marshal::Copy( iptr, managedBuf, 0, data_size );
                           audioData->Add(managedBuf);
                       }
                   }
               }
           }
           libffmpeg::av_free_packet(&amp;packet);
       }

       libffmpeg::av_free(buffer);
       libffmpeg::av_free(pFrame);
       libffmpeg::avcodec_close(pCodecCtx);
       libffmpeg::avformat_close_input(&amp;pFormatCtx);
       delete [] nativeFileName;
    }
    </byte></byte>

    This function returns my images in imageData list and audio in audioData list ;
    I normal draw image in my c# code, but i don’t playing audio data.
    I try playing audio in NAudio library. But I hear crackle in speakers instead of sounds.
    Code in c# playing audio :

    var WaveFormat = new WaveFormat(m_sampleRate, 16, m_channels)
    var _waveProvider = new BufferedWaveProvider(WaveFormat) { DiscardOnBufferOverflow = true, BufferDuration = TimeSpan.FromMilliseconds(_fileReader.Length) };
    var _waveOut = new DirectSoundOut();
    _waveOut.Init(_waveProvider);
    _waveOut.Play();
    foreach (var data in audioData)
    {
       _waveProvider.AddSamples(data, 0, data.Length);
    }

    What am I doing wrong ?

  • Get image from direct show device [duplicate]

    13 août 2014, par user2663781

    This question already has an answer here :

    I want to get image from direct show device in Java but I can’t find a good solution for it.
    My device is screen-capture-recorder which is easy to get with ffmpeg, so my first idea was to use Xuggler.
    I tried this code :

    String driverName = "dshow";
    String deviceName= "screen-capture-recorder";
    // Let's make sure that we can actually convert video pixel formats.
    if (!IVideoResampler.isSupported(IVideoResampler.Feature.FEATURE_COLORSPACECONVERSION))
             throw new RuntimeException("you must install the GPL version of Xuggler (with IVideoResampler support) for this demo to work");
    // Create a Xuggler container object
    IContainer container = IContainer.make();
    // Tell Xuggler about the device format
    IContainerFormat format = IContainerFormat.make();
    if (format.setInputFormat(driverName) &lt; 0)
             throw new IllegalArgumentException("couldn't open webcam device: " + driverName);
    // devices, unlike most files, need to have parameters set in order
    // for Xuggler to know how to configure them, for a webcam, these
    // parameters make sense
    IMetaData params = IMetaData.make();
    params.setValue("framerate", "30/1");
    params.setValue("video_size", "320x240");

    // Open up the container
    int retval = container.open(deviceName, IContainer.Type.READ, format,
    false, true, params, null);

    But when I try to open the device (by his device name) it is not working :
    0 [main] ERROR org.ffmpeg - [dshow @ 05168820] Malformed dshow input string.
    0 [main] DEBUG com.xuggle.xuggler - Could not open output url : screen-capture-recorder (../../../../../../../csrc/com/xuggle/xuggler/Container.cpp:436)
    Exception in thread "main" java.lang.IllegalArgumentException : could not open file : screen-capture-recorder ; Error : Input/output error
    at DisplayWebcamVideo.main(DisplayWebcamVideo.java:99)
    Java Result : 1

    After searching a bit I found DSJ, but it is for non-commercial use only and we need a registry version, so impossible to use for me.

    I also found LTI-CIVIL but it could not detect the "screen-capture-recorder".
    I tried FMJ and JMF but it does not find the device too.

    I tried VLCj but the container with the video must be open if I want to get image and it is not what I need.

    I tried webcam-recorder (github.sarxos.webcam), it detects the device but i got this error when I try to open it :

    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x5faf910d, pid=2552, tid=9780
    #

    I am a bit stuck now, I don’t know how to solve this problem someone can help me ?
    Or give me a simple DLL that I can use through JNA to get an image from direct show device...

  • Anomalie #3325 : (array) n’est pas suffisant pour convertir l’objet récupéré par l’itérateur YQL

    29 octobre 2014, par Sylvain Lesage

    L’URL est mal écrite, c’est : http://core.spip.org/projects/spip/repository/entry/spip/ecrire/iterateur/data.php#L563.

    J’ai pas le dépôt SVN sous la main, mais le patch en gros pourrait être remplacer à la ligne 547

    /**
     * yql -> tableau
     * @throws Exception
     * @param  string $u
     * @return array|bool
     */
    function inc_yql_to_array_dist($u) 
        define(’_YQL_ENDPOINT’, ’http://query.yahooapis.com/v1/public/yql?&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&q=’) ;
        $v = recuperer_url($url = _YQL_ENDPOINT.urlencode($u).’&format=json’) ;
        if (!$v[’page’]
          OR !$w = json_decode($v[’page’],true)) 
            throw new Exception(’YQL : r&#233 ;ponse vide ou mal form&#233 ;e’) ;
        
        if (isset($w[’error’]))
            throw new Exception($w[’error’][’description’]) ;
        
        return (array) $w ;
    
    

    par

    /**
     *
     * Convert an object to an array
     *
     * @param    object  $object The object to convert
     * @return   array
     *
     */
    function inc_object_to_array( $object ) 
        if( !is_object( $object ) && !is_array( $object ) ) 
            return $object ;
        
        if( is_object( $object ) ) 
            $object = get_object_vars( $object ) ;
        
        return array_map( ’inc_object_to_array’, $object ) ;
    
    

    /**
    * yql -> tableau
    * @throws Exception
    * @param string $u
    * @return array|bool
    */
    function inc_yql_to_array($u)
    define(’_YQL_ENDPOINT’, ’http://query.yahooapis.com/v1/public/yql?&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&q=’) ;
    $v = recuperer_page($url = _YQL_ENDPOINT.urlencode($u).’&format=json’) ;
    $w = json_decode($v) ;
    if (!$w)
    throw new Exception(’YQL : r&#233 ;ponse vide ou mal form&#233 ;e’) ;
    return false ;

    return inc_object_to_array($w) ;