Recherche avancée

Médias (39)

Mot : - Tags -/audio

Autres articles (51)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • 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

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

Sur d’autres sites (10014)

  • ValueError When Reading Video Frame

    28 juin 2017, par Bassie

    I am following this article, from where I got this code :

    FFMPEG_BIN ="Z:\ffmpeg\bin\ffmpeg.exe"

    import subprocess as sp
    command = [ FFMPEG_BIN,
               '-i', 'video.mp4',
               '-f', 'image2pipe',
               '-pix_fmt', 'rgb24',
               '-vcodec', 'rawvideo', '-']
    pipe = sp.Popen(command, stdout = sp.PIPE, bufsize=10**8, shell=True)

    import numpy
    # read 420*360*3 bytes (= 1 frame)
    raw_image = pipe.stdout.read(420*360*3)
    # transform the byte read into a numpy array
    image =  numpy.fromstring(raw_image, dtype='uint8')
    image = image.reshape((360,420,3))
    # throw away the data in the pipe's buffer.
    pipe.stdout.flush()

    When I run it I see this error :

    Traceback (most recent call last):
     File "Z:\py\ffmtest\test.py", line 16, in <module>
       image = image.reshape((360,420,3))
    ValueError: total size of new array must be unchanged
    </module>

    Where line 16 is image = image.reshape((360,420,3)). I think this error is produced by numpy, but probably because I am calculating the values for my video incorrectly.

    Output :

    raw_image : b’ ’

    len(raw_image) : 0

    image : [ ]

    len(image) : 0

    I am not sure whether I am passing in the correct values for read or reshape functions - any help at all is much appreciated !

  • ffmpeg Unrecognized option 'hls_enc'

    16 juin 2017, par riubin

    Does anyone have a ffmpeg problem that Unrecognized option ’hls_enc’ ?

    when I use ffmpeg to convert videos to hls with option ’hls_enc’,followed the document : https://www.ffmpeg.org/ffmpeg-formats.html#Options-5
    but throw error:Unrecognized option ’hls_enc’

    Is it missing any configure options ?

    configuration : —enable-gpl —enable-nonfree —yasmexe=/data/ffmpeg.src/_release/bin/yasm —prefix=/data/ffmpeg.src/_release —cc= —enable-static —disable-shared —enable-debug —extra-cflags=’-I/data/ffmpeg.src/_release/include’ —extra-ldflags=’-L/data/ffmpeg.src/_release/lib -lm -ldl’ —enable-postproc —enable-bzlib —enable-zlib —enable-parsers —enable-pthreads —enable-libx264 —enable-libmp3lame —enable-libfdk_aac —enable-libspeex —extra-libs=-lpthread —enable-encoders —enable-decoders —enable-avfilter —enable-muxers —enable-demuxers

  • Some bugs when using SDL2 and ffmpeg to make a video player

    1er juin 2017, par trycatch

    used sws_scale to resize the image, and SDL2.0 to render, pixel format is YUV420P.

    1.When I Create SDL Render with SDL_RENDERER_SOFTWARE, I Get a black image like this :enter image description here, the top-left corner has a green point ;
    But When I Create SDL Render with SDL_RENDERER_ACCELERATED, I can See normal image ;

    2.When I resize the window, the player will crash on SDL_UpdateYUVTexture. I check width, height and linesize of the data, everything is OK.

    WHY ?

    Key Code :

    if (swscale_.frame.width % 2)
     swscale_.frame.width -= 1;

    swscale_.free();
    swscale_.context = sws_getContext(
           vcodec->width, vcodec->height, vcodec->pix_fmt,
           swscale_.frame.width, swscale_.frame.height,
           AV_PIX_FMT_YUV420P, SWS_BICUBIC, nullptr, nullptr, nullptr);

    if (!swscale_.context)
       throw std::runtime_error("sws_getContext.");

    if (swscale_.frame.avframe)
     av_frame_free(&amp;swscale_.frame.avframe);
    swscale_.frame.avframe = av_frame_alloc();
    unsigned char* out_buffer = (unsigned char *)av_malloc(av_image_get_buffer_size(AV_PIX_FMT_YUV420P, swscale_.frame.width, swscale_.frame.height, 1)+16);
    unsigned char* tmp = &amp;out_buffer[16 - (unsigned long long)out_buffer % 16];
    av_image_fill_arrays(swscale_.frame.avframe->data, swscale_.frame.avframe->linesize, tmp,
     AV_PIX_FMT_YUV420P, swscale_.frame.width, swscale_.frame.height, 1);

    sws_scale(swscale_.context, (const unsigned char* const*)vframe_->data, vframe_->linesize,
     0, vframe_->height,
     swscale_.frame.avframe->data, swscale_.frame.avframe->linesize);

    self.onRenderHandle(swscale_.frame);

    Code of SDL rendering :

    void Player::onRender(const frame&amp; frame)
    {
     if (sdl_lock_.try_lock()) {
       ::ValidateRect(native_window_, NULL);
       if (frame.width != scr_width_ || frame.height != scr_height_) {
         scr_width_ = frame.width; scr_height_ = frame.height;
         SDL_SetWindowSize(screen_, scr_width_ + 2, scr_height_ + 2);
         SDL_DestroyRenderer(sdl_renderer_);
         sdl_renderer_ = SDL_CreateRenderer(screen_, -1, 0);
         video_texture_ = SDL_CreateTexture(sdl_renderer_, SDL_PIXELFORMAT_IYUV,
           SDL_TEXTUREACCESS_STREAMING, scr_width_, scr_height_);
       }
       SDL_UpdateYUVTexture(video_texture_, NULL,
         frame.avframe->data[0], frame.avframe->linesize[0],
         frame.avframe->data[1], frame.avframe->linesize[1],
         frame.avframe->data[2], frame.avframe->linesize[2]);
       sdl_lock_.unlock();
       ::InvalidateRect(native_window_, NULL, false);
     }
    }
    void Player::onPaint()
    {
     std::lock_guard lock(sdl_lock_);
     SDL_RenderClear(sdl_renderer_);
     SDL_RenderCopy(sdl_renderer_, video_texture_, NULL, NULL);
     SDL_RenderPresent(sdl_renderer_);
    }