Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (47)

  • (Dés)Activation de fonctionnalités (plugins)

    18 février 2011, par

    Pour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
    SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
    Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
    MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)

  • Activation de l’inscription des visiteurs

    12 avril 2011, par

    Il est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
    Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
    Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

Sur d’autres sites (6001)

  • Encoding with FFMPEG stretches frames

    24 août 2017, par micropro.cz

    I am trying to encode video with FFMPEG into H.265, but I have a problem with a weird stretching. Input video is 1920x1080 and output has the same resolution, but when I compare both images on same timestamp, encoded video seems to be stretched by few pixels (it is visibly wider on both sizes despite the fact resolution is same). It seems that this stretching introduces ugly bluriness in whole video. It seems like FFMPEG crop few pixels from left and right (probably black pixels at the edge of video) and stretches content to fill those missing pixels and preserve same resolution.

    I did not find any way how to disable this behavior. I tried to change encoder from x265 to x264 to see if that is the problem, but result was still stretched.

    I used this command line parameters :

    ffmpeg -i input.mkv -c:v libx265 -preset medium -crf 23 -t 30 output.mp4

    -t 30 is there to test result visual quality on small sample of length 30 seconds.

    Does anyone have any idea why this happens and how to fix it ? Most visual quality is lost because of this deformation and not because of recompression, which I proved by encoding with -crf 0, which is basically lossless and result was still blurred.

    EDIT : Link to full console output : https://pastebin.com/gpMD5Qec

  • ffmpeg does not decode some h264 streams

    12 janvier 2016, par Andrey

    I have some ip of cameras on the local network.I receive video stream with live555 library (I took testRtspClient as a basis) and decode frames with ffmpeg (avcodec_decode_video2). Everything perfectly works.
    Problems begin when I try to decode a stream from an internet.

    The first problem - some packets lost, so defects appears. But it’s not a problem. Problem - after stop and start video stream it is necessary to wait for about 5 minutes of streaming before ffmpeg is able to decode something from the same ip camera. If packets doesn’t lost then everithing ok.

    The second problem - there is camera which sends video with resolution 2048х1538. The frame of such resolution is sent by several packets. live555 normally brings together them but when the frame is transferred to the decoder, the decoder returns the packet length, but got frame always 0.

    Here some my code :

    #define RECEIVE_BUFFER_SIZE 1000000
    AVCodecContext* avCodecContext; //definition
    AVFrame *frame;  //definition
    ...
    //init code
    _fReceiveBuffer = new uint8_t[RECEIVE_BUFFER_SIZE+512]; //buffer to receive frame
    ZeroMemory(_fReceiveBuffer, RECEIVE_BUFFER_SIZE + 512); //zeros
    _bufferSize = RECEIVE_BUFFER_SIZE * sizeof(uint8_t); //buffer size

    static const  uint8_t startCode[4] = { 0x00, 0x00, 0x00, 0x01 }; //this is for 0 0 0 1
    //before frame will transfer to decoder
    memcpy(_fReceiveBuffer, (void*)startCode, sizeof(uint8_t)* 4);
    _fReceiveBuffer += sizeof(sizeof(uint8_t)* 4);
    _bufferSize -= sizeof(sizeof(uint8_t)* 4);

    AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_H264); //find codec

    avCodecContext = avcodec_alloc_context3(codec);
    avCodecContext->flags |= AV_PKT_FLAG_KEY;
    avcodec_open2(avCodecContext, codec, NULL);

    frame = av_frame_alloc();

    //frame
    void DummySink::afterGettingFrame(unsigned frameSize, unsigned numTruncatedBytes,
    struct timeval presentationTime, unsigned durationInMicroseconds) {

    if (strcmp(fSubsession.codecName(), "H264") == 0)
    {
       //code from onvif device manager
       static const uint8_t startCode3[] = { 0x00, 0x00, 0x01 };
       static const uint8_t startCode4[] = { 0x00, 0x00, 0x00, 0x01 };
       auto correctedFrameSize = frameSize;
       auto correctedBufferPtr = fPlObj->_fReceiveBuffer;
       if (frameSize < sizeof(startCode4) || memcmp(startCode4, correctedBufferPtr, sizeof(startCode4)) != 0){
           if (frameSize < sizeof(startCode3) || memcmp(startCode3, correctedBufferPtr, sizeof(startCode3)) != 0){
               correctedFrameSize += sizeof(uint8_t)* 4;
               correctedBufferPtr -= sizeof(uint8_t)* 4;
           }
       }

       ProcessFrame(correctedBufferPtr, correctedFrameSize, presentationTime, durationInMicroseconds);
    }
    continuePlaying();
    }

    void DummySink::ProcessFrame(unsigned char* framePtr, int frameSize, struct timeval presentationTime, unsigned duration)    {

    AVPacket avpkt;
    av_init_packet(&avpkt);
    avpkt.data = framePtr;
    avpkt.size = frameSize;
    while (avpkt.size > 0) {
       int got_frame = 0;

       int len = avcodec_decode_video2(avCodecContext, frame, &got_frame, &avpkt);
       if (len < 0) {
           //TODO: log error
           return;
       }
       else if (got_frame == 0)
       {
    //I tried this code, bacause "codecs which have the AV_CODEC_CAP_DELAY capability set have a delay between input and output"
    //but it didn't help
           /*AVPacket emptyPacket;
           av_init_packet(&emptyPacket);
           emptyPacket.data = NULL;
           emptyPacket.size = 0;
           emptyPacket.stream_index = avpkt.stream_index;
           len = avcodec_decode_video2(avCodecContext, frame, &got_frame, &emptyPacket);
           if ( got_frame == 1) goto next;*/
           return;
       }
    next:
       //... here code for view with DirectDraw - everithing ok with it
       avpkt.size -= len;
       avpkt.data += len;
    }
    }

    I alsa tried to send frame to decoder with sps and pps information :

    0 0 0 1 sps 0 0 0 1 pps 0 0 0 1 frame

    but it is not help.

    Interesting that avcodec_decode_video2 does not return frame with second problem (return all size of frame), but width and height in avCodecContext are set correctly. I can’t understart why it doesn’t return frame.

    Can anyone help with these problems ?

  • ffmpeg - Overlay webm video (with alpha channel) over a static background image

    24 février 2023, par Aran

    I'm trying to overlay a webm video over an image. The video has opacity where the image should show through. All my attempts to do this via ffmpeg so far have shown the image in the first frame, then cut to the video only where the alpha part shows black (image behind is not visible).

    


    The resolutions of the overlay and background image are both the same (1920x1080).

    


    The closest command I've had was this however all transparency is lost and you just see the background image :

    


    ffmpeg -y \
  -i transparent_overlay_video.webm \
  -i background_image.png \
  -filter_complex "[0:v]format=argb,geq=r='r(X,Y)':a='1.0*alpha(X,Y)'[zork]; \
  [1:v][zork]overlay" \
  -vcodec libx264 outputvideo.mp4


    


    Solution

    


    ffmpeg -y \
  -c:v libvpx \
  -i transparent_overlay_video.webm \
  -i background_image.png \
  -filter_complex "[0:v]format=argb,geq=r='r(X,Y)':a='1.0*alpha(X,Y)'[zork]; \
  [1:v][zork]overlay" \
  -vcodec libx264 outputvideo.mp4


    


    Thanks to Баяр-Гончикжапов below for the solution