Recherche avancée

Médias (9)

Mot : - Tags -/soundtrack

Autres articles (107)

  • Soumettre améliorations et plugins supplémentaires

    10 avril 2011

    Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
    Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (14193)

  • How to fallback the media data of file while writing by FFMPEG ?

    10 février 2017, par Jerikc XIONG

    How to delete part of the media content end of the file while writing by FFMPEG ?

    • The file is being writing by write_packet
    • The media data is end of the file
    • Using FFMPEG 2.8

    Writing packet at this moment like this :

    // the fd doesn't close
    1 2 3 4 5 6 7 8 9
                   |
                   fd

    I need to delete 7 8 9 and the fd pointing 6 and ready to write the next one.

    // ready to write the next one
    1 2 3 4 5 6
             |
             fd

    Any suggestion is prefered, thanks.

  • Sending Pictures over Network with Unity C#

    30 septembre 2020, par TobiGG B.

    I am currently working with the HoloLens and thus Unity. The idea is to make a webcam Livestream with as little delay as possible to an instance of FFmpeg on a different device for encoding. However, I run into some issues.

    


    My first problem is the Conversion from a Color32 Array to a Byte Array. It creates a huge amount of bandwidth, especially when I am trying to record and stream with 30fps and a 1280x720 resolution.
Here is some code :

    


    IEnumerator Init()
    {
        webCam = new WebCamTexture(1280, 720, 30);
        webCam.Play();
        image.texture = webCam;
        Debug.Log("WebCam Width: " + webCam.width);
        Debug.Log("WebCam Height: " + webCam.height);
        currentTexture = new Texture2D(webCam.width, webCam.height);
        
        data = new Color32[webCam.width * webCam.height];
        listener = new TcpListener(IPAddress.Any, 10305);
        listener.Start();



        while (webCam.width < 100)
        {
            
             yield return null;
        }

        StartCoroutine("Recording");
    }

    WaitForEndOfFrame endOfFrame = new WaitForEndOfFrame();

    IEnumerator Recording()
    {

        TcpClient tcpClient = null;
        NetworkStream tcpStream = null;
        bool isConnected = false;

        Loom.RunAsync(() =>
        {
            while(!stopCapture)
            {
                tcpClient = listener.AcceptTcpClient();
                Debug.Log("Client Connected!");
                isConnected = true;
                tcpStream = tcpClient.GetStream();
            }
        });
        while(!isConnected)
        {
            yield return endOfFrame;
        }
        readyToGetFrame = true;
        byte[] messageLength = new byte[SEND_RECEIVE_COUNT];
        while(!stopCapture)
        {
            yield return endOfFrame;

            webCam.GetPixels32(data);
            byte[] webCamBytes = Utilities.Color32ArrayToByteArray(data);
                                
            readyToGetFrame = false;
            Loom.RunAsync(() => {
                tcpStream.Write(webCamBytes, 0, webCamBytes.Length);
                readyToGetFrame = true;
            });

            while (!readyToGetFrame)
            {
                yield return endOfFrame;
            }
        }
    }


    


    public static class Utilities
{
    public static byte[] Color32ArrayToByteArray(Color32[] colors)
    {
        if (colors == null || colors.Length == 0)
        {
            return null;
        }

        int lengthOfColor32 = Marshal.SizeOf(typeof(Color32));
        int byteArrayLength = lengthOfColor32 * colors.Length;
        byte[] bytes = new byte[byteArrayLength];

        GCHandle handle = default(GCHandle);

        try
        {
            handle = GCHandle.Alloc(colors, GCHandleType.Pinned);
            IntPtr ptr = handle.AddrOfPinnedObject();
            Marshal.Copy(ptr, bytes, 0, byteArrayLength);
        }
        finally
        {
            if(handle != default(GCHandle))
            {
                handle.Free();
            }
        }

        return bytes;
    }
}


    


    To fix this problem, I tried to use EncodePNG and EncodeJPG instead. But there is my second problem. If I use these methods, I got a big loss of performance.

    


    So instead of this

    


            webCam.GetPixels32(data);
        byte[] webCamBytes = Utilities.Color32ArrayToByteArray(data);


    


    I use this

    


            currentTexture.SetPixels(webCam.GetPixels());
        byte[] webCamBytes = currentTexture.EncodeToJPG();


    


    Thus my question :
Is there any way to reduce the bandwith by maybe cutting off the alpha values as they are not needed ? Or is there another good way such as converting to a different color or picture format ?

    


    Because right now I ran out of usable ideas and feel kinda stuck. Might just be me though ;-)

    


    PS : Using external libraries is a tad difficult as it needs to run on HoloLens and due to other regulations.

    


    Thank you in advance !

    


  • Making a movie out of pictures in correct order

    6 novembre 2022, par astrogab

    Short version

    


    How can one combine files img1000.png, img5000.png, img10000.png, img11000.png in the right order into a movie ?

    


    Longer version

    


    I am using ffmpeg to make a movie out of snapshots of a simulation. There should be for instance 5 images per second. The names are :

    


    image0200.png
image0300.png
image0400.png
image0500.png
image1000.png
image1500.png
image2000.png
...
image8500.png
image9000.png
image9500.png
image10000.png
image15000.png


    


    i.e., they are sequential but there are irregular gaps in the numbers. The numbers are formatted according to '%04d' but go above 9999. I have tried

    


    ffmpeg -y -loglevel debug -nostats \
-r:v 5 -thread_queue_size 1024 -f image2 \
-pattern_type glob -i "*[0-9][0-9][0-9][0-9].png" \
-r:v 30 -preset veryslow -pix_fmt yuv420p -crf 28 \
-an  AMDG.mp4


    


    and many, many other variations but either only two frames end up being visible in the movie (even though the images are found when using -debug) or only the files up to image9500.png are used (and glob does not seem to allow [0-9]{4,} as for regex), or, with

    


        ffmpeg -y -loglevel debug -nostats \
    -r:v 5 \
    -thread_queue_size 1024 -f image2 -pattern_type glob \
       -i "image[0-9][0-9][0-9][0-9].png" \
    -r:v 5 \
    -thread_queue_size 1024 -f image2 -pattern_type glob \
       -i "image[1-9][0-9][0-9][0-9][0-9].png" \
    -r:v 30 -preset veryslow -pix_fmt yuv420p -crf 28 \
    -map 0 -map 1 \
    -an  AMDG.mp4


    


    there are apparently two streams in the output movie and only one of them is being played. (I realised in the process -map 0 -map 1 was needed in order for both input streams to be used.)

    


    In one of the variations of options I found (now I have lost what it was exactly !) all images were included but the order was not the desired one : image1000.png was shown before image10000.png. Apparently a newer version of ffmpeg (I have ffmpeg version 3.4.8-0ubuntu0.2) has the ability to sort like sort -V, so that image10000 come after image1000, but reinstalling ffmpeg is in general not a practical option. Also renaming the files is not practical and creating e.g. soft links with sequential names in the format '%05d' starting at 0 and in steps of 1 (so that -i '%05d' could be used) is of course not elegant.

    


    With the -concat filter as in https://unix.stackexchange.com/questions/77016/ffmpeg-pattern-type-glob-not-loading-files-in-correct-order, i.e.,

    


      ffmpeg -y -loglevel debug -nostats -r:v 5 \
    -thread_queue_size 1024 -f image2 -f concat \
    -safe 0 -i <(find . -maxdepth 1 -regex 'image*.png' \
       -exec echo "file $(pwd)/"{} \; | sort -V) \
    -r:v 30 -codec:v libx264 -preset veryslow -pix_fmt yuv420p -crf 28 \
    -an \
    AMDG.mp4


    


    the processing took a long time and made the whole system sluggish, while producing a movie of 60 kB showing only two different images.

    


    I have the impression that there are several issues at once... Thanks if you can help !