Recherche avancée

Médias (1)

Mot : - Tags -/3GS

Autres articles (84)

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

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (11962)

  • how to explain this C language code from ffmpeg remuxing

    20 avril 2017, par Fidona

    can someone help me what the meaning of this code ? this is a code from ffmpeg remuxing code.

    static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt, const char *tag, int hours, int mins, int secs, int us, int *time )
    {
       AVRational *time_base = &fmt_ctx->streams[pkt->stream_index]->time_base;
       total = total + pkt->duration;
     //  printf( "%d:%d:%d.%d \n", hours,  mins,  secs, us );
       *time = av_q2d(*time_base) * pkt->pts ;
    }

    I’m kind of new to C language. thank you !

  • Is there another way to export a frame in ffmpeg to a texture2d ? My code working in Windows but not Linux

    5 décembre 2024, par Robert Russell

    Sound is working in Linux the same as it did in Windows. But the video is just a black screen and when I attempt to save the frames as BMP files all of them were corrupt/empty files. I am using Ffmpeg.Autogen to interface with the libraries. https://github.com/Ruslan-B/FFmpeg.AutoGen. The file is VP8 and OGG in a MKV container. Though the extension is AVI for some reason.

    



    I tried messing with the order of the code a bit. I checked to make sure the build of Ffmpeg on Linux had VP8. I was searching online but was having trouble finding another way to do what I am doing. This is to contribute to the OpenVIII project. My fork-> https://github.com/Sebanisu/OpenVIII

    



    This just preps the scaler to change the pixelformat or else people have blue faces.

    



            private void PrepareScaler()
        {

            if (MediaType != AVMediaType.AVMEDIA_TYPE_VIDEO)
            {
                return;
            }

            ScalerContext = ffmpeg.sws_getContext(
                Decoder.CodecContext->width, Decoder.CodecContext->height, Decoder.CodecContext->pix_fmt,
                Decoder.CodecContext->width, Decoder.CodecContext->height, AVPixelFormat.AV_PIX_FMT_RGBA,
                ffmpeg.SWS_ACCURATE_RND, null, null, null);
            Return = ffmpeg.sws_init_context(ScalerContext, null, null);

            CheckReturn();
        }


    



    Converts Frame to BMP
I am thinking this is where the problem is. Because I had added bitmap.save to this and got empty BMPs.

    



    public Bitmap FrameToBMP()
        {
            Bitmap bitmap = null;
            BitmapData bitmapData = null;

            try
            {
                bitmap = new Bitmap(Decoder.CodecContext->width, Decoder.CodecContext->height, PixelFormat.Format32bppArgb);
                AVPixelFormat v = Decoder.CodecContext->pix_fmt;

                // lock the bitmap
                bitmapData = bitmap.LockBits(new Rectangle(0, 0, Decoder.CodecContext->width, Decoder.CodecContext->height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);

                byte* ptr = (byte*)(bitmapData.Scan0);

                byte*[] srcData = { ptr, null, null, null };
                int[] srcLinesize = { bitmapData.Stride, 0, 0, 0 };

                // convert video frame to the RGB bitmap
                ffmpeg.sws_scale(ScalerContext, Decoder.Frame->data, Decoder.Frame->linesize, 0, Decoder.CodecContext->height, srcData, srcLinesize); //sws_scale broken on linux?
            }
            finally
            {
                if (bitmap != null && bitmapData != null)
                {
                    bitmap.UnlockBits(bitmapData);
                }
            }
            return bitmap;

        }


    



    After I get a bitmap we turn it into a Texture2D so we can draw it.

    



     public Texture2D FrameToTexture2D()
        {
            //Get Bitmap. there might be a way to skip this step.
            using (Bitmap frame = FrameToBMP())
            {
                //string filename = Path.Combine(Path.GetTempPath(), $"{Path.GetFileNameWithoutExtension(DecodedFileName)}_rawframe.{Decoder.CodecContext->frame_number}.bmp");

                //frame.Save(filename);
                BitmapData bmpdata = null;
                Texture2D frameTex = null;
                try
                {
                    //Create Texture
                    frameTex = new Texture2D(Memory.spriteBatch.GraphicsDevice, frame.Width, frame.Height, false, SurfaceFormat.Color); //GC will collect frameTex
                                                                                                                                        //Fill it with the bitmap.
                    bmpdata = frame.LockBits(new Rectangle(0, 0, frame.Width, frame.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);// System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                    byte[] texBuffer = new byte[bmpdata.Width * bmpdata.Height * 4]; //GC here
                    Marshal.Copy(bmpdata.Scan0, texBuffer, 0, texBuffer.Length);

                    frameTex.SetData(texBuffer);


                }
                finally
                {
                    if (bmpdata != null)
                    {
                        frame.UnlockBits(bmpdata);
                    }
                }
                return frameTex;

            }
        }


    



    I can post more if you want it's pretty much all up on my fork

    



    Video will play back as it does in Windows. As smooth as 15 fps can be. :)

    


  • KeyError : 1 on Python when the code points to a value that exists [closed]

    10 décembre 2020, par oo92

    I am using the following code to traverse a list JSON output. There are about 100 streamers I want to take screens from but the code fails after the first one where I call the ffmpeg. I put a code after the ffmpeg to see if Python is running it at all and it does :

    


    Traceback (most recent call last):&#xA;  File "/home/onur/Desktop/pythonProject/main.py", line 12, in <module>&#xA;    username = streams_now[i][&#x27;channel&#x27;][&#x27;display_name&#x27;]&#xA;KeyError: 1&#xA;auronplay it is &#xA;</module>

    &#xA;

    This is my code :

    &#xA;

    import streamlink, os&#xA;from twitch import TwitchClient&#xA;&#xA;client = TwitchClient(client_id=&#x27;frl3dqgn21bbpp6tajjvg5pdevczac&#x27;)&#xA;&#xA;streams_now = client.streams.get_live_streams(limit=100)&#xA;&#xA;print(streams_now[2][&#x27;channel&#x27;][&#x27;display_name&#x27;])&#xA;&#xA;for i in range(0, 99):&#xA;  username = streams_now[i][&#x27;channel&#x27;][&#x27;display_name&#x27;]&#xA;  streams_now = streamlink.streams(&#x27;http://twitch.tv/&#x27; &#x2B; username)&#xA;  stream = streams_now["best"].url&#xA;  dir_path = os.getcwd() &#x2B; &#x27;/&#x27; &#x2B; username&#xA;  os.mkdir(dir_path)&#xA;  os.system(&#x27;ffmpeg -i &#x27; &#x2B; stream &#x2B; f&#x27; -ss 20 -vframes 10 -r 0.2 -f image2 {dir_path}/&#x27; &#x2B; username &#x2B; &#x27;_output_%09d.jpg&#x27;)&#xA;  print(username &#x2B; &#x27; it is &#x27;)&#xA;

    &#xA;

    The line that throws the error is username = streams_now[i][&#x27;channel&#x27;][&#x27;display_name&#x27;]. However, this line cannot throw an error because I am testing it before the for loop :

    &#xA;

    print(streams_now[2][&#x27;channel&#x27;][&#x27;display_name&#x27;])

    &#xA;

    and I get this : shroud

    &#xA;