Recherche avancée

Médias (0)

Mot : - Tags -/auteurs

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (21)

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

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Configuration spécifique d’Apache

    4 février 2011, par

    Modules spécifiques
    Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
    Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
    Création d’un (...)

Sur d’autres sites (6264)

  • Which OpenCV FOURCC codecs should I use for my Python program ?

    17 mars 2020, par Rainer H.

    I have implemented a Python script which displays a video to the user and records it. The video is saved either compressed or uncompressed.

    In an old program I have seen, that the "DIVX" MPEG-4 and the "IYUV" codecs were used. For some reason, they don’t work on my computer (OUTPUT_VIDEO is a MP4-file).

    OpenCV: FFMPEG: tag 0x58564944/'DIVX' is not supported with codec id 13 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x00000020/' ???'

    The "MPJPG" codec works with ".avi" files.

    Because I’m not sure about the codecs, I would like to ask, which codecs should I use for my script to achieve the following requirements :

    • the video sequence can be saved as .mp3, .mp4 file (both compressed) or as .avi file (uncompressed).
    • Python script should work on Windows and Linux platforms.

    This is my source code :
    main.py

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-

    import os
    import cv2
    import platform

    #=========== TO CHANGE ===========
    INPUT_VIDEO = os.path.join("..", "resources", "video.mp4")
    OUTPUT_VIDEO = os.path.join("..", "recorded", "recorded.avi")
    compress = False
    #=========== TO CHANGE ===========

    WINDOW_NAME = "Video Recorder"

    player = cv2.VideoCapture(INPUT_VIDEO)

    # Get the frames per second (fps) of the video.
    fps = player.get(cv2.CAP_PROP_FPS)

    # Get width and height via the video capture property.
    width = player.get(cv2.CAP_PROP_FRAME_WIDTH)
    height = player.get(cv2.CAP_PROP_FRAME_HEIGHT)

    # Define the codec and create VideoWriter object according to the used operating system.
    four_cc = None
    if platform.system() == "Windows":
       if compress:
           four_cc = cv2.VideoWriter_fourcc(*"MJPG")  # *"DIVX")  # DIVX MPEG-4 codec.
       else:
           four_cc = cv2.VideoWriter_fourcc(*"MJPG")  # *"IYUV")  # Uncompressed yuv420p in avi container.
    elif platform.system() == "Linux":
       if compress:
           four_cc = cv2.VideoWriter_fourcc(*"DIVX")  # DIVX MPEG-4 codec.
       else:
           four_cc = cv2.VideoWriter_fourcc(*"IYUV")  # Uncompressed yuv420p in avi container.

    recorder = cv2.VideoWriter(OUTPUT_VIDEO, four_cc, fps, (int(width), int(height)))

    if player is None:
       quit()

    while player.isOpened():
       ret, frame = player.read()

       if ret:
           cv2.imshow(WINDOW_NAME, frame)
           recorder.write(frame)
       else:
           break

       key_code = cv2.waitKey(1)

       # Closes the window if the ESC key was pressed.
       if key_code == 27:
           break

       # Closes the window if the X button of the window was clicked.
       if cv2.getWindowProperty(WINDOW_NAME, 1) == -1:
           break

    player.release()
    recorder.release()
    cv2.destroyAllWindows()

    I’m using a Windows 7 computer, with opencv-contrib-python 3.4.0.12 and Python 3.6.

  • C# execute external program and capture (stream) the output

    15 août 2018, par Roberto Correia

    I’m making a program to work with some video files.

    I’m using the ffmpeg executable to merge several files in a single file.
    This command takes several minutes to finish, so, I need a way to "monitor" the output, and show a progress bar on GUI.

    Looking at the following stackoverflow topics :

    I made this code :

    Process ffmpeg = new Process
    {
     StartInfo =
     {
       FileName = @"d:\tmp\ffmpeg.exe",
       Arguments = "-f concat -safe 0 -i __sync.txt -c copy output.mp4",
       UseShellExecute = false,
       RedirectStandardOutput = true,
       CreateNoWindow = true,
       WorkingDirectory = @"d:\tmp"
     }
    }

    ffmpeg.EnableRaisingEvents = true;
    ffmpeg.OutputDataReceived += (s, e) => Debug.WriteLine(e.Data);
    ffmpeg.ErrorDataReceived += (s, e) => Debug.WriteLine($@"Error: {e.Data}");
    ffmpeg.Start();
    ffmpeg.BeginOutputReadLine();
    ffmpeg.WaitForExit();

    When I run this code, the ffmpeg start to merge files, I can see the ffmpeg process on Windows Task Manager, and if I wait long enough, the ffmpeg finish the job without any error. But, the Debug.WriteLine(e.Data) is never called (no output on Debug window). Tried to change to Console.WriteLine too (again, no output).

    So, after this, I tried this another version :

    Process ffmpeg = new Process
    {
     StartInfo =
     {
       FileName = @"d:\tmp\ffmpeg.exe",
       Arguments = "-f concat -safe 0 -i __sync.txt -c copy output.mp4",
       UseShellExecute = false,
       RedirectStandardOutput = true,
       CreateNoWindow = true,
       WorkingDirectory = @"d:\tmp"
     }
    }

    ffmpeg.Start();
    while (!ffmpeg.StandardOutput.EndOfStream)
    {
     var line = ffmpeg.StandardOutput.ReadLine();
     System.Diagnostics.Debug.WriteLine(line);
     Console.WriteLine(line);
    }
    ffmpeg.WaitForExit();

    Again, the ffmpeg is started without any error, but the C# "hangs" on While (!ffmpeg.StandardOutput.EndOfStream) until ffmpeg is finished.

    If I execute the exact command on Windows prompt, a lot of output text is showed with progress of ffmpeg.

  • C# execute external program and capture (stream) the output

    22 mars 2017, par Roberto Correia

    I’m making a program to work with some video files.

    I’m using the ffmpeg executable to merge several files in a single file.
    This command takes several minutes to finish, so, I need a way to "monitor" the output, and show a progress bar on GUI.

    Looking at the following stackoverflow topics :

    I made this code :

    Process ffmpeg = new Process
    {
     StartInfo =
     {
       FileName = @"d:\tmp\ffmpeg.exe",
       Arguments = "-f concat -safe 0 -i __sync.txt -c copy output.mp4",
       UseShellExecute = false,
       RedirectStandardOutput = true,
       CreateNoWindow = true,
       WorkingDirectory = @"d:\tmp"
     }
    }

    ffmpeg.EnableRaisingEvents = true;
    ffmpeg.OutputDataReceived += (s, e) => Debug.WriteLine(e.Data);
    ffmpeg.ErrorDataReceived += (s, e) => Debug.WriteLine($@"Error: {e.Data}");
    ffmpeg.Start();
    ffmpeg.BeginOutputReadLine();
    ffmpeg.WaitForExit();

    When I run this code, the ffmpeg start to merge files, I can see the ffmpeg process on Windows Task Manager, and if I wait long enough, the ffmpeg finish the job without any error. But, the Debug.WriteLine(e.Data) is never called (no output on Debug window). Tried to change to Console.WriteLine too (again, no output).

    So, after this, I tried this another version :

    Process ffmpeg = new Process
    {
     StartInfo =
     {
       FileName = @"d:\tmp\ffmpeg.exe",
       Arguments = "-f concat -safe 0 -i __sync.txt -c copy output.mp4",
       UseShellExecute = false,
       RedirectStandardOutput = true,
       CreateNoWindow = true,
       WorkingDirectory = @"d:\tmp"
     }
    }

    ffmpeg.Start();
    while (!ffmpeg.StandardOutput.EndOfStream)
    {
     var line = ffmpeg.StandardOutput.ReadLine();
     System.Diagnostics.Debug.WriteLine(line);
     Console.WriteLine(line);
    }
    ffmpeg.WaitForExit();

    Again, the ffmpeg is started without any error, but the C# "hangs" on While (!ffmpeg.StandardOutput.EndOfStream) until ffmpeg is finished.

    If I execute the exact command on Windows prompt, a lot of output text is showed with progress of ffmpeg.