Recherche avancée

Médias (2)

Mot : - Tags -/rotation

Autres articles (107)

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

  • Ajout d’utilisateurs manuellement par un administrateur

    12 avril 2011, par

    L’administrateur d’un canal peut à tout moment ajouter un ou plusieurs autres utilisateurs depuis l’espace de configuration du site en choisissant le sous-menu "Gestion des utilisateurs".
    Sur cette page il est possible de :
    1. décider de l’inscription des utilisateurs via deux options : Accepter l’inscription de visiteurs du site public Refuser l’inscription des visiteurs
    2. d’ajouter ou modifier/supprimer un utilisateur
    Dans le second formulaire présent un administrateur peut ajouter, (...)

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

Sur d’autres sites (13980)

  • Is there a way to apply a curve bend in ffmpeg ?

    25 mars 2020, par stevendesu

    I have four cameras each feeding me a different portion of a basketball court. Due to the slight offset of the cameras physical locations and lens distortion around the edges of the camera, I cannot simply stitch the videos together without some kind of correction.

    I’ve looked into ffmpeg’s perspective filter, as well as the lenscorrection filter. In the former case it was only able to create a trapezoid, not the curved image I want. In the latter case using negative values to k1 and k2 seemed to be heading in the right direction, but it either disorted the top and bottom of the image to the point of being nonsensical noise, or it zoomed in to the image so much that I lost important details.

    For the sample picture below, ultimately I want the midcourt line (the blue vertical line on the right side) to be vertical, and I want the mess of wires on the white desk at the bottom to remain visible and identifiable.

    Given a video which looks like the following :

    enter image description here

    I wish to produce something like the following :

    enter image description here

    This image was made using the "Curve Bend" filter in GIMP, but I just eye-balled it - so it’s not perfect. Ideally once I get the exact parameters the midcourt line will be perfectly vertical

    When using the lenscorrection filter, no values for k1 and k2 seemed to get the effect I want :

    Negative k1, negative k2 :

    enter image description here

    Negative k1, positive k2 :

    enter image description here

    Positive k1, negative k2 :

    enter image description here

    Positive k1, positive k2 :

    enter image description here

    In general :

    • negative / negative distorted the image beyond recognition
    • negative / positive looked alright, but the midcourt line was off the screen and it wasn’t clear if any distortion had been applied
    • positive / negative looked the best, but while the top and bottom curved in the middle of the left and right actually bulged out, leaving the midcourt line distorted
    • positive / positive was the opposite of the desired effect
  • AVFrame with NV12 format breaks using D3D11 HW acceleration

    5 décembre 2024, par faith0058

    I have a ffmpeg-autogen video decoder, im trying to use a D3D11 as HW accelerator, but the frame i get in result(with NV12 format) is broken. If im doing the same with Vulkan as accelerator, everything works fine, but vulkan uses more graphic card resources..

    


    For rendering i use OpenTK, received frames i convert to RGB with textures and shaders.

    


    Below my decoder initialization.

    


    public VideoStreamDecoder(AVCodecParameters* parameters, AVCodec* codec)
{
    AVCodec* _codec = codec;
    
    _pCodecContext = ffmpeg.avcodec_alloc_context3(_codec);

    ffmpeg.av_hwdevice_ctx_create(&_pCodecContext->hw_device_ctx, AVHWDeviceType.AV_HWDEVICE_TYPE_D3D11VA, null, null, 0).ThrowExceptionIfError();

    ffmpeg.avcodec_parameters_to_context(_pCodecContext, parameters).ThrowExceptionIfError();
    ffmpeg.avcodec_open2(_pCodecContext, _codec, null).ThrowExceptionIfError();

    CodecName = ffmpeg.avcodec_get_name(_codec->id);
    FrameSize = new Size(_pCodecContext->width, _pCodecContext->height);
    PixelFormat = _pCodecContext->pix_fmt;

    _pFrame = ffmpeg.av_frame_alloc();
    _receivedFrame = ffmpeg.av_frame_alloc();
}


    


    And frames reading function

    


    public bool TryReadNextFrame(out AVFrame frame, AVPacket packet)
{
    int error;

    do
    {
        ffmpeg.avcodec_send_packet(_pCodecContext, &packet).ThrowExceptionIfError();

        error = ffmpeg.avcodec_receive_frame(_pCodecContext, _pFrame);

    } while (error == ffmpeg.AVERROR(ffmpeg.EAGAIN));

    error.ThrowExceptionIfError();

    ffmpeg.av_hwframe_transfer_data(_receivedFrame, _pFrame, 0);
    //here i get NV12 frame

    var clonedFrame = ffmpeg.av_frame_clone(_receivedFrame);

    frame = *clonedFrame;

    return true;
}


    


    And here is result i get with both accelerators :

    


    Vulkan
normally working

    


    The same camera, but D3D11
broken

    


    One more intresting moment, is that cameras, that dont work have yuv420p format, the only one working with D3D11 has yuvj420.

    


    I tried changing format using sws_scale from NV12 to NV12, and it worked, but it uses too much CPU.
Also tried changin format to rgb before av_hwframe_transfer_data function and rendering it using Vulkan rendering, it sort of works with Vulkan, but with D3D11 it doesnt.

    


    UPDATE

    


    I noticed, that frame linesize was bigger, than width and tried

    


    _receivedFrame->linesize[0] = _receivedFrame->width;


    


    And it helped, now image looks better, but still not perfect.

    


    UPDATE 2

    


    I triead also
_receivedFrame->linesize[1] = _receivedFrame->width; and now everything works just as it should, took me whole day to write two lines of code :)

    


  • Creating Thumbnails From Ffmpeg Hangs Php

    30 octobre 2012, par Piyush Arora

    I have been working on a php webservice, which receives videos(uploaded) from iphone and upload them to Amazon cloudFront. After uploading videos, I need to generate thumbnails for video from the Amazon link generated. I am using ffmpeg with shell_exec command for it. Here is the code for the same :

    public function createThumbnail($userId,$fileUrl,$imageName){
       //$imageUrl = 'http://184.168.116.177:81/json_api/json/bin/';
       if(!is_dir("images/".$userId)){
           mkdir("images/".$userId);
       }
       // path of installed ffmpeg
       $ffmpeg = $_SERVER['DOCUMENT_ROOT'] .'bin/ffmpeg';
       $cmd = "$ffmpeg  -itsoffset -1 -i $fileUrl -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 images/".$userId."/".$imageName;

       shell_exec($cmd);

       return "images/".$userId."/".$imageName;
    }

    The above code generates the thumbnail, but script does not execute after shell_exec command. So, there is no response sent to iphone end about the thumbnail link. This function works well video is uploaded from web browser of pc. If I comment, shell_exec command, then response is sent to iphone end, but obviousely image is not created.

    Thanks in advance.