Recherche avancée

Médias (0)

Mot : - Tags -/albums

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

Autres articles (51)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

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

  • How to read frames of a video and write them on another video output using FFMPEG and nodejs

    29 décembre 2023, par Aviato

    I am working on a project where I need to process video frames one at a time in Node.js. I aim to avoid storing all frames in memory or the filesystem due to resource constraints. I plan to use the ffmpeg from child processes for video processing.
I tried reading a video file and then output frames of it in the filesystem first for testing purposes :-

    


    const ffmpegProcess = spawn('ffmpeg', [
  '-i', videoFile,
  'testfolder/%04d.png' // Output frames to stdout
]);


    


    and the above code works fine, it saves the video frames as png files in the filesystem. Now instead of saving them in the file system, I want to read the frames on at a time and use a image manipulation library and than write the final edited frames to another video as output

    


    I tried this :-

    


    const ffmpegProcess = spawn('ffmpeg', [
  '-i', videoFile,
  'pipe:1' // Output frames to stdout
]);

const ffmpegOutputProcess = spawn('ffmpeg', [
  '-i', '-',
  'outputFileName.mp4'
  ]);

ffmpegProcess.stdout.on('data', (data) => {
  // Process the frame data as needed
  console.log('Received frame data:');
  ffmpegOutputProcess.stdin.write(data)
});

ffmpegProcess.on('close', (code) => {
  if (code !== 0) {
    console.error(`ffmpeg process exited with code ${code}`);
  } else {
    console.log('ffmpeg process successfully completed');
    
  }
});

// Handle errors
ffmpegProcess.on('error', (err) => {
  console.error('Error while spawning ffmpeg:', err);
});


    


    But when I tried above code and also some other modifications in the input and output suffix in the command I got problems as below :-

    


      

    1. ffmpeg process exited with code 1
    2. 


    3. The final output video was corrupted when trying to initializing the filters for commands :-
    4. 


    


    
const ffmpegProcess = spawn('ffmpeg', [
 '-i', videoFile,
 '-f', 'rawvideo',
 '-pix_fmt', 'rgb24',
 'pipe:1' // Output frames to stdout
]);

const ffmpegOutputCommand = [
 '-f', 'rawvideo',
 '-pix_fmt', 'rgb24',
 '-s', '1920x1080',
 '-r', '30',
 '-i', '-',
 '-c:v', 'libx264',
 '-pix_fmt', 'yuv420p',
 outputFileName
];


    


    Thank you so much in advance :)

    


  • avcodec/libjxl.h : include version.h

    23 janvier 2024, par Leo Izen
    avcodec/libjxl.h : include version.h
    

    This file has been exported since our minimum required version (0.7.0),
    but it wasn't documented. Instead it was transitively included by
    <jxl/decode.h> (but not jxl/encode.h), which ffmpeg relied on.

    libjxl broke its API in libjxl/libjxl@66b959239355aef5255 by removing
    the transitive include of version.h, and they do not plan on adding
    it back. Instead they are choosing to leave the API backwards-
    incompatible with downstream callers written for some fairly recent
    versions of their API.

    As a result, we include <jxl/version.h> to continue to build against
    more recent versions of libjxl. The version macros removed are also
    present in that file, so we no longer need to redefine them.

    Signed-off-by : Leo Izen <leo.izen@gmail.com>

    • [DH] libavcodec/libjxl.h
  • Execute my PowerShell script does not work via my C# application

    15 février 2024, par Nixir

    I'm currently working on IP cameras for my job, but I'm just starting out because I've never done anything like this before.&#xA;The aim is very simple, to start recording a specific camera via a user action, and to stop the same camera via another user action.&#xA;To achieve this, I looked for several solutions and finally decided to use FFMPEG and two Powershell scripts.

    &#xA;

    The first starts recording using FFMPEG and stores the process PID in a .txt file.

    &#xA;

    StartRec.ps1

    &#xA;

    #Param&#xE8;tres de la cam&#xE9;ra IP&#xA;$cameraIP = $args[0]&#xA;$port = $args[1]&#xA;$username = $args[2]&#xA;$password = $args[3]&#xA;&#xA;$ipfile = ${cameraIP} -replace "\.", ""&#xA;$namefile = "video_"&#x2B;$ipfile&#x2B;"_"&#x2B;(Get-Date -Format "ddMMyyyy_HHmmss") &#x2B; ".mp4"&#xA;$namepidfile = "PID_"&#x2B;$ipfile&#x2B;".txt"&#xA;&#xA;# URL du flux vid&#xE9;o de la cam&#xE9;ra (exemple g&#xE9;n&#xE9;rique, adaptez-le &#xE0; votre cam&#xE9;ra)&#xA;$videoStreamUrl = "rtsp://${username}:${password}@${cameraIP}:${port}/videoMain"&#xA;&#xA;# R&#xE9;pertoire de sortie pour la vid&#xE9;o enregistr&#xE9;e&#xA;$outputDirectory = "C:\OutputDirectory"&#xA;&#xA;# Chemin complet du fichier de sortie (nom de fichier avec horodatage actuel)&#xA;$outputFile = Join-Path $outputDirectory (${namefile})&#xA;&#xA;# Commande FFmpeg pour enregistrer le flux vid&#xE9;o en arri&#xE8;re-plan&#xA;$ffmpegCommand = "ffmpeg -rtsp_transport tcp -i `"$videoStreamUrl`" -c:v copy `"$outputFile`"" &#xA;&#xA;# D&#xE9;marrer FFmpeg en arri&#xE8;re-plan&#xA;$process = Start-Process -FilePath "cmd.exe" -ArgumentList "/c $ffmpegCommand" -PassThru&#xA;&#xA;$cheminFichier = Join-Path $outputDirectory $namepidfile&#xA;&#xA;if (-not (Test-Path $cheminFichier)) {&#xA;    # Le fichier n&#x27;existe pas, cr&#xE9;er le fichier&#xA;    New-Item -ItemType File -Path $cheminFichier -Force&#xA;    Write-Host "Fichier cr&#xE9;&#xE9; : $cheminFichier"&#xA;} else {&#xA;    Write-Host "Le fichier existe d&#xE9;j&#xE0; : $cheminFichier"&#xA;}&#xA;&#xA;Start-Sleep -Seconds 5&#xA;&#xA;$processId = Get-WmiObject Win32_Process -Filter "Name=&#x27;ffmpeg.exe&#x27;" | Select-Object -ExpandProperty ProcessId&#xA;&#xA;# Enregistrez le PID dans un fichier&#xA;$process.Id | Out-File $cheminFichier&#xA;&#xA;Write-Host "Enregistrement d&#xE9;marr&#xE9;. PID du processus : $($processId)"&#xA;

    &#xA;

    The second reads the contents of this .txt file, stores it in a variable as a PID and stops the process via its Id, then closes the command window associated with this process (which tells the camera that the recording is finished).

    &#xA;

    StoptRec.ps1

    &#xA;

    $cameraIP = $args[0]&#xA;$ipfile = ${cameraIP} -replace "\.", ""&#xA;$namepidfile = "PID_"&#x2B;$ipfile&#x2B;".txt"&#xA;$outputDirectory = "C:\OutputDirectory"&#xA;$cheminFichier = Join-Path $outputDirectory $namepidfile&#xA;&#xA;$pidcontent = Get-Content $cheminFichier -Raw &#xA;if (-not $pidContent) {&#xA;    Write-Host "Erreur : Le fichier PID est vide. Assurez-vous que l&#x27;enregistrement est d&#xE9;marr&#xE9;."&#xA;    exit&#xA;}&#xA;&#xA;$processId  = $pidContent.Trim() -as [int]&#xA;&#xA;if (-not $processId) {&#xA;    Write-Host "Erreur : Impossible de convertir le contenu du fichier PID en entier."&#xA;    exit&#xA;}&#xA;&#xA;Get-Process -Id $processId&#xA;&#xA;Stop-Process -Id $processId -PassThru | Foreach-Object { $_.CloseMainWindow() }&#xA;&#xA;Write-Host "Enregistrement arr&#xEA;t&#xE9; pour le processus PID $processId"&#xA;Start-Sleep -Seconds 15&#xA;

    &#xA;

    The problem is that they work, except in one case that I'll explain :&#xA;First, I tried to run them via PowerShell, the recording starts up and the script works as expected, as does the shutdown. My final file is usable.&#xA;I then performed C# actions in my Controller, which calls and executes these scripts :

    &#xA;

    The action that calls StartRec.ps1

    &#xA;

            public void startRecordingCam1(string ipAddress)&#xA;        {&#xA;            string ps1File = @"C:\OutputDirectory\StartRec.ps1";&#xA;            string cameraIP = "Camera IP Adress";&#xA;            string port = "88";&#xA;            string username = "Username";&#xA;            string password = "Password";&#xA;&#xA;            Process process = Process.Start(new ProcessStartInfo&#xA;            {&#xA;                FileName = "powershell.exe",&#xA;                Arguments = $"-NoProfile -ExecutionPolicy Bypass -File \"{ps1File}\" \"{cameraIP}\" \"{port}\" \"{username}\" \"{password}\"",&#xA;                UseShellExecute = false,&#xA;                RedirectStandardInput = true&#xA;                //CreateNoWindow = true&#xA;            });&#xA;        }&#xA;

    &#xA;

    The action that calls StopRec.ps1

    &#xA;

           public void stopRecording(string ipAddress)&#xA;        {&#xA;            string ps1File = @"C:\Projet Valentin\CameraTest\StopRec_Csharp.ps1";&#xA;            string cameraIP = "10.0.1.10";&#xA;&#xA;            ProcessStartInfo startInfo = new ProcessStartInfo()&#xA;            {&#xA;                FileName = "powershell.exe",&#xA;                Arguments = $"-NoProfile -ExecutionPolicy ByPass -File \"{ps1File}\" \"{cameraIP}\" ",&#xA;                UseShellExecute = true&#xA;            };&#xA;            Process.Start(startInfo);&#xA;        }&#xA;

    &#xA;

    When I run the two scripts via these actions, StartRec.ps1 works well, but StopRec.ps1 doesn't work completely : the process is stopped, but the command window isn't closed, so camera recording continues (despite the end of the process).&#xA;As both scripts worked perfectly when launched with Powershell, but not with the C# application, I tried several combinations of "Start-Stop" with "PowerShell/C#".

    &#xA;

    If I run StartRec.PS1 with the C# application and StopRec.PS1 with PowerShell, it works.&#xA;If I run StartRec.PS1 with PowerShell and StopRec.PS1 with the C# application, it works.&#xA;If I run StartRec.PS1 with PowerShell and StopRec.PS1 with PowerShell, it works.&#xA;The only case that doesn't work is when I run both via the C# application

    &#xA;

    One thing I can add that I discovered while debugging is that this :&#xA;Stop-Process -Id $processId -PassThru | Foreach-Object { $_.CloseMainWindow() }

    &#xA;

    Returns false in the only case where it doesn't work, and true in all other cases

    &#xA;

    That's all the details I can give you, thanks for your help !

    &#xA;