Recherche avancée

Médias (91)

Autres articles (33)

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (2755)

  • using ffmpeg to capture the screen why it's not saving the output file to the folder and not saving the output file at all ?

    17 juillet 2023, par Shelly Ron

    at the top

    


    private bool recordFullScreen = true;
private Process ffmpegProcess;


    


    Load event

    


    private void Form1_Load(object sender, EventArgs e)
        {
            // Hide the FFmpeg console window
            var ffmpegStartInfo = new ProcessStartInfo
            {
                FileName = @"D:\Captured Videos\ffmpeg.exe",
                Arguments = "-hide_banner -loglevel panic",
                UseShellExecute = false,
                CreateNoWindow = true,
                RedirectStandardInput = true
            };

            ffmpegProcess = Process.Start(ffmpegStartInfo);
        }


    


    Closing event

    


    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Terminate FFmpeg process before closing the application
            ffmpegProcess.StandardInput.WriteLine("q");
            ffmpegProcess.WaitForExit();
            ffmpegProcess.Close();
        }


    


    recording button click event

    


    private void btnRecord_Click(object sender, EventArgs e)
        {
            if (recordFullScreen)
            {
                // Record the whole screen
                RecordScreen();
            }
        }


    


    the method recordscreen

    


    private void RecordScreen()
        {
            // Set the output folder path
            string outputFolder = @"D:\Captured Videos\";

            // Generate a unique file name based on the current date and time
            string fileName = DateTime.Now.ToString("Screen_yyyyMMdd_HHmmss") + ".mp4";

            // Set the output file path
            string outputFile = Path.Combine(outputFolder, fileName);

            // FFmpeg command to record the whole screen
            string ffmpegCommand = $"-f gdigrab -framerate 24 -i desktop -preset ultrafast -pix_fmt yuv420p \"{outputFile}\"";

            StartFFmpeg(ffmpegCommand);
        }


    


    the method startffmpeg

    


    private void StartFFmpeg(string command)
        {
            // Send the FFmpeg command to the process for execution
            ffmpegProcess.StandardInput.WriteLine(command);
            ffmpegProcess.StandardInput.Flush();
        }


    


    but when running the application pressing the button to record after some seconds i click the form red X on the top right to close it but it's not saving the mp4 output file. not sure if it's even recording at all.

    


  • PHP readfile on a file which is increasing in size

    13 février 2013, par Sathiya Sundaram

    Is it possible to use PHP readfile function on a remote file whose size is unknown and is increasing in size ? Here is the scenario :

    I'm developing a script which downloads a video from a third party website and simultaneously trans-codes the video into MP3 format. This MP3 is then transferred to the user via readfile.

    The query used for the above process is like this :

    wget -q -O- "VideoURLHere" | ffmpeg -i - "Output.mp3" > /dev/null 2>&1 &

    So the file is fetched and encoded at the same time.
    Now when the above process is in progress I begin sending the output mp3 to the user via readfile. The problem is that the encoding process takes some time and therefore depending on the users download speed readfile reaches an assumed EoF before the whole file is encoded, resulting in the user receiving partial content/incomplete files.

    My first attempt to fix this was to apply a speed limit on the users download, but this is not foolproof as the encoding time and speed vary with load and this still led to partial downloads.

    So is there a way to implement this system in such a way that I can serve the downloads simultaneously along with the encoding and also guarantee sending the complete file to the end user ?

    Any help is appreciated.

    EDIT :
    In response to Peter, I'm actually using fread(read readfile_chunked) :

    <?php
    function readfile_chunked($filename,$retbytes=true) {
               $chunksize = 1*(1024*1024); // how many bytes per chunk
               $totChunk = 0;
               $buffer = '';
               $cnt =0;
               $handle = fopen($filename, 'rb');
               if ($handle === false) {
                   return false;
               }
               while (!feof($handle)) {
                   //usleep(120000); //Used to impose an artificial speed limit
                   $buffer = fread($handle, $chunksize);
                   echo $buffer;
                   ob_flush();
                   flush();
                   if ($retbytes) {
                       $cnt += strlen($buffer);
                   }
               }
                   $status = fclose($handle);
               if ($retbytes && $status) {
                   return $cnt;        // return num. bytes delivered like readfile() does.
               }
               return $status;
           }
           readfile_chunked($linkToMp3);
       ?>

    This still does not guarantee complete downloads as depending on the users download speed and the encoding speed, the EOF() may be reached prematurely.

    Also in response to theJeztah's comment, I'm trying to achieve this without having to make the user wait..so that's not an option.

  • Getting realtime output from ffmpeg to be used in progress bar (PyQt4, stdout)

    8 septembre 2023, par Jason O'Neil

    I've looked at a number of questions but still can't quite figure this out. I'm using PyQt, and am hoping to run ffmpeg -i file.mp4 file.avi and get the output as it streams so I can create a progress bar.

    



    I've looked at these questions :
Can ffmpeg show a progress bar ?
catching stdout in realtime from subprocess

    



    I'm able to see the output of a rsync command, using this code :

    



    import subprocess, time, os, sys

cmd = "rsync -vaz -P source/ dest/"
p, line = True, 'start'


p = subprocess.Popen(cmd,
                     shell=True,
                     bufsize=64,
                     stdin=subprocess.PIPE,
                     stderr=subprocess.PIPE,
                     stdout=subprocess.PIPE)

for line in p.stdout:
    print("OUTPUT>>> " + str(line.rstrip()))
    p.stdout.flush()


    



    But when I change the command to ffmpeg -i file.mp4 file.avi I receive no output. I'm guessing this has something to do with stdout / output buffering, but I'm stuck as to how to read the line that looks like

    



    frame=   51 fps= 27 q=31.0 Lsize=     769kB time=2.04 bitrate=3092.8kbits/s


    



    Which I could use to figure out progress.

    



    Can someone show me an example of how to get this info from ffmpeg into python, with or without the use of PyQt (if possible)

    




    



    EDIT :
I ended up going with jlp's solution, my code looked like this :

    



    #!/usr/bin/python
import pexpect

cmd = 'ffmpeg -i file.MTS file.avi'
thread = pexpect.spawn(cmd)
print "started %s" % cmd
cpl = thread.compile_pattern_list([
    pexpect.EOF,
    "frame= *\d+",
    '(.+)'
])
while True:
    i = thread.expect_list(cpl, timeout=None)
    if i == 0: # EOF
        print "the sub process exited"
        break
    elif i == 1:
        frame_number = thread.match.group(0)
        print frame_number
        thread.close
    elif i == 2:
        #unknown_line = thread.match.group(0)
        #print unknown_line
        pass


    



    Which gives this output :

    



    started ffmpeg -i file.MTS file.avi
frame=   13
frame=   31
frame=   48
frame=   64
frame=   80
frame=   97
frame=  115
frame=  133
frame=  152
frame=  170
frame=  188
frame=  205
frame=  220
frame=  226
the sub process exited


    



    Perfect !