Recherche avancée

Médias (91)

Autres articles (19)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

Sur d’autres sites (2462)

  • Android : BitmapFactory.decodeStream() returns null after first success

    27 avril 2014, par giraffe

    My code is intended to update an ImageView with an image from a server when a UI button is pressed.

    The client side code shown below is a Runnable that runs when the button is pressed. The server is a desktop Java application with ffmpeg running in the background, continuously updating image.png with an image from the webcam. When the button is pressed on the Android app, the Android app attempts to receive image.png from the server, and because ffmpeg is constantly updating this image, it should be the most recent image taken with the server’s webcam.

    My problem is that the first button press shows the correct image, but every subsequent button press will just clear out my ImageView. BitmapFactory.decodeStream() is returning null every time I call it after the first time.

    Client side (runs when button is pressed) :

    InputStream inputStream = s.getInputStream();
    img = BitmapFactory.decodeStream(inputStream);          
    jpgView.setImageBitmap(img);        
    jpgView.invalidate();

    Server side :

    ServerSocket sock = new ServerSocket(PORT_NUMBER);
    Socket clientSocket = sock.accept();
    for (;;) {
       File f = new File("C:/folder/image.png");
       FileInputStream fileInput = new FileInputStream(f);
       BufferedInputStream bufferedInput = new BufferedInputStream(fileInput);
       OutputStream outStream = clientSocket.getOutputStream();
       try {
           byte[] outBuffer = new byte[fSize];
           int bRead = bufferedInput.read(outBuffer, 0, outBuffer.length);
           outStream.write(outBuffer, 0, bRead);
           outStream.flush();
           } catch (Exception e) {
               e.printStackTrace();
           } finally {
               bufferedInput.close();
           }
       }
  • subprocess.py returns a File Not Found error

    7 avril 2021, par wasneeplus

    As part of a video analysis script I wanted to find the duration of a video file. For this I found the script offered in the first answer to this question : How to get the duration of a video in Python ?

    


    import subprocess

def get_length(filename):
    result = subprocess.run(["ffprobe", "-v", "error", "-show_entries",
                             "format=duration", "-of",
                             "default=noprint_wrappers=1:nokey=1", filename],
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT)
    return float(result.stdout)


    


    This code works fine when my friend runs it in a Jupyter server environment, but when I try it on my laptop the trouble starts.

    


    When I imput the following filename into the function :

    


    filename = "C:\\Users\\benja\\OneDrive - De Haagse Hogeschool\\Onderzoeken 3\\8V.mp4"


    


    I get the following error :

    


        Traceback (most recent call last):&#xA;  File "c:/Users/benja/OneDrive - De Haagse Hogeschool/Onderzoeken 3/python_script.py", line 9, in <module>&#xA;    num_of_frames = math.floor((pf.get_length(filename) - 1)) * 30&#xA;  File "c:\Users\benja\OneDrive - De Haagse Hogeschool\Onderzoeken 3\python_funcs.py", line 21, in get_length&#xA;    stderr=subprocess.STDOUT)&#xA;  File "C:\Users\benja\Anaconda3\lib\subprocess.py", line 466, in run&#xA;    with Popen(*popenargs, **kwargs) as process:&#xA;  File "C:\Users\benja\Anaconda3\lib\subprocess.py", line 769, in __init__&#xA;    restore_signals, start_new_session)&#xA;  File "C:\Users\benja\Anaconda3\lib\subprocess.py", line 1172, in _execute_child&#xA;    startupinfo)&#xA;FileNotFoundError: [WinError 2] Het systeem kan het opgegeven bestand niet vinden&#xA;</module>

    &#xA;

    I do realise that my problem is almost identical to that of several other questions on here. However, their solutions don't seem to work for me. I have tried to :

    &#xA;

      &#xA;
    • Add the location of ffmpeg-win64-4.2.2.exe to the Path system variable.
    • &#xA;

    • Add the location of python.exe to the ComSpec system variable.
    • &#xA;

    • Put the videofile in the same directory as the script.
    • &#xA;

    &#xA;

    I would be most grateful if someone could point me in the right direction. Thank you in advance.

    &#xA;

  • Why process output reader returns null data ? When same code in other process works correct

    26 août 2019, par Владимир Водов

    I try to get output from ffmpeg process but cant get output.
    In another processes and commands it works correctly but output returns immideately when start !

           using (var process = new Process())
           {
               process.StartInfo = new ProcessStartInfo()
               {
                   FileName = LinkHelper.IPFS_PATH,
                   Arguments = cmd,
                   UseShellExecute = false,
                   CreateNoWindow = true,
                   RedirectStandardOutput = true
               };

               process.ErrorDataReceived += FfmpegErrorRecieved;
               process.Start();

               using (StreamReader reader = process.StandardOutput)
               {
                   string output = await reader.ReadToEndAsync();
                   Console.WriteLine(output);
               }              
               process.WaitForExit();
           }

    Before output handle !

    Update :
    As szatmary said ffmpeg use output error instead standard output, so when you initialize process.StandartInfo don’t forget initialize property "RedirectStandardError" to TRUE !

    Here is correct code :

    private async Task DetectFFmpegCamerasAsync()
       {
           var cmd = "-list_devices true -f dshow -i dummy";
           using (var process = new Process())
           {
               process.StartInfo = new ProcessStartInfo()
               {
                   FileName = LinkHelper.FFMPEG_PATH,
                   Arguments = cmd,
                   UseShellExecute = false,
                   CreateNoWindow = true,
                   RedirectStandardError = true
               };

               process.Start();

               using (StreamReader reader = process.StandardError)
               {
                   string output = await reader.ReadToEndAsync();
                   Console.WriteLine($"Camera detection output: \n {output}");
               }              
               process.WaitForExit();
           }
       }