Recherche avancée

Médias (1)

Mot : - Tags -/sintel

Autres articles (32)

  • MediaSPIP Core : La Configuration

    9 novembre 2010, par

    MediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
    Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (5221)

  • ffmpeg crash when updating overlay file (c# console app)

    24 décembre 2024, par Vlad Stefan

    I am trying to develop a console app that can record the screen and have cpu/ram/gpu usage of the machine noted on the recording. The problem i am facing is that after a while (2-3 hours) the recording stops because ffmpeg is trying to read the file text while my C# code tries to update the file. I managed to find out that I should use a temp file and replace the original instead of rewriting the whole file but that way I encounter another problem, ffmpeg will try to read the file while the file is replaced or even for that split second when is considered deleted. Any ideas what I should do ? How should the method with the temp file be managed or how can I make the method that updates the same file stable ? I was even thinking to increment the ffmpeg reload frames since it might narrow the chances of crashing but it's not a 100% crash proof solution.

    


    Error message received from ffmpeg with updating only the text from the file :

    


    Error: [Parsed_drawtext_0 @ 000001e68fd95dc0] [FILE @ 0000009fb7ffee70] Error occurred in CreateFileMapping()
Error: [Parsed_drawtext_0 @ 000001e68fd95dc0] The text file 'OverlayFiles/OverlayFile_MyPC.txt' could not be read or is empty
Error: [vf#0:0 @ 000001e68fd48300] Error while filtering: Operation not permitted
Error: [vf#0:0 @ 000001e68fd48300] Task finished with error code: -1 (Operation not permitted)


    


    Error message received from ffmpeg with the use of a temp file that's replacing the original file :

    


    Error: [Parsed_drawtext_0 @ 0000014c815e6200] [FILE @ 000000253d7fee70] Cannot read file 'OverlayFiles/OverlayFile_MyPC.txt': Permission denied
Error: [Parsed_drawtext_0 @ 0000014c815e6200] The text file 'OverlayFiles/OverlayFile_MyPC.txt' could not be read or is empty
Error: [vf#0:0 @ 0000014c81597280] Error while filtering: Permission denied
Error: [vf#0:0 @ 0000014c81597280] Task finished with error code: -13 (Permission denied)
Error: [vf#0:0 @ 0000014c81597280] Terminating thread with return code -13 (Permission denied)


    


    ffmpeg arguments :

    


    string arguments = $"-video_size 1920x1080 -framerate 30 -f gdigrab -i desktop -c:v libx264rgb -crf 0 -preset ultrafast -color_range 2 " +
                   $"-vf \"drawtext=fontfile=C\\\\:/Windows/fonts/consola.ttf:fontsize=30:fontcolor='white':textfile={overlayFilePath_}:boxcolor=0x00000080:box=1:x=10:y=H-210:reload=1\" \"" + 
                   outputFile + "\"";


    


    The code that updates the overlay file (1st version) :

    


    public void UpdateOverlayText(string filePath)
{
    string usage = GetSystemUsage(filePath);  // Get the system usage data

    try
    {
        // Open the file with FileShare.ReadWrite to allow other processes to read it while writing
        using (var fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
        {
            using (var writer = new StreamWriter(fileStream))
            {
                writer.Write(usage);  // Write the system usage data to the file
            }
        }

        // Ensure file permissions are set correctly after writing
        SetFilePermissions(filePath);
    }
    catch (IOException ex)
    {
        Console.WriteLine($"Error updating overlay file: {ex.Message}");
    }
}


    


    (UPDATE)Code that updates overlay file using MemoryStream :

    


    public void UpdateOverlayText(string filePath)
{
    string usage = GetSystemUsage(filePath);

    try
    {
        using (var memoryStream = new MemoryStream())
        {
            using (var writer = new StreamWriter(memoryStream))
            {
                writer.Write(usage);
                writer.Flush();

                memoryStream.Position = 0;

                File.WriteAllBytes(filePath, memoryStream.ToArray());
            }
        }

        SetFilePermissions(filePath);
    }
    catch (IOException ex)
    {
        Console.WriteLine($"Error updating overlay file: {ex.Message}");
    }
}


    


    Code tested using MemoryStream and Temp file :

    


    public void UpdateOverlayText(string filePath)
{
    string usage = GetSystemUsage(filePath);
    string tempFilePath = filePath + ".tmp";
    try
    {
        // Write to a temporary file first
        using (var memoryStream = new MemoryStream())
        {
            using (var writer = new StreamWriter(memoryStream))
            {
                writer.Write(usage);
                writer.Flush();

                memoryStream.Position = 0;
                File.WriteAllBytes(tempFilePath, memoryStream.ToArray());
            }
        }
        File.Replace(tempFilePath, filePath, null);
    }
    catch (IOException ex)
    {
        Console.WriteLine($"Error updating overlay file: {ex.Message}");
    }
    finally
    {
        if (File.Exists(tempFilePath))
        {
            File.Delete(tempFilePath);
        }
    }
}


    


    Thanks in advance for your help and sorry for any typo or wrong phrases I used.

    


  • avformat/mov : fix crash when trying to get a fragment time for a non-existing fragment

    25 octobre 2024, par Eugene Zemtsov
    avformat/mov : fix crash when trying to get a fragment time for a non-existing fragment
    

    Reviewed-by : Dale Curtis <dalecurtis@chromium.org>
    Reviewed-by : Marth64 <marth64@proxyid.net>
    Signed-off-by : Marth64 <marth64@proxyid.net>

    • [DH] libavformat/mov.c
  • avutil/hwcontext_amf : fix crash on uninit after init failed

    6 février, par Kacper Michajłow
    avutil/hwcontext_amf : fix crash on uninit after init failed
    

    amf_device_create() calls amf_device_uninit() on errors, but if things
    were not initialized it will null deref amf_ctx->factory.

    Fixes : https://github.com/mpv-player/mpv/issues/15814

    Signed-off-by : Kacper Michajłow <kasper93@gmail.com>

    • [DH] libavutil/hwcontext_amf.c