
Recherche avancée
Médias (1)
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (93)
-
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...)
Sur d’autres sites (4211)
-
How easy is it to create a YouTube to MP3 application using yt-dlp and ffmpeg ?
26 juin 2022, par fowlisI was thinking I could automate the process of downloading a video and converting it to mp3 (or other formats).

Instead of doing the process myself (which doesn't take that long and isn't too much hassle), which looks something like this :

•yt-dlp https://www.youtube.com/watch?v=dQw4w9WgXcQ

• wait for download then (find and) rename file to something simpler for next command

•ffmpeg -i video.mp4 video.mp3



I thought I could turn it into a simple JS (or other language) program instead, where it :


- 

- Asks for link and what format I want it in
- Downloads the video
- Renames it (not sure how easy this is)
- Turns it into requested format
- Opens file location












If something like this is possible, please let me know some things I should know since I've never written a windows app before, and some general guidance for how I could do this.

I apologise if questions like this aren't exactly allowed on this site, its my first time posting too.

Thanks in advance !

-
Execute my PowerShell script does not work via my C# application
15 février 2024, par NixirI'm currently working on IP cameras for my job, but I'm just starting out because I've never done anything like this before.
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.
To achieve this, I looked for several solutions and finally decided to use FFMPEG and two Powershell scripts.


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


StartRec.ps1


#Paramètres de la caméra IP
$cameraIP = $args[0]
$port = $args[1]
$username = $args[2]
$password = $args[3]

$ipfile = ${cameraIP} -replace "\.", ""
$namefile = "video_"+$ipfile+"_"+(Get-Date -Format "ddMMyyyy_HHmmss") + ".mp4"
$namepidfile = "PID_"+$ipfile+".txt"

# URL du flux vidéo de la caméra (exemple générique, adaptez-le à votre caméra)
$videoStreamUrl = "rtsp://${username}:${password}@${cameraIP}:${port}/videoMain"

# Répertoire de sortie pour la vidéo enregistrée
$outputDirectory = "C:\OutputDirectory"

# Chemin complet du fichier de sortie (nom de fichier avec horodatage actuel)
$outputFile = Join-Path $outputDirectory (${namefile})

# Commande FFmpeg pour enregistrer le flux vidéo en arrière-plan
$ffmpegCommand = "ffmpeg -rtsp_transport tcp -i `"$videoStreamUrl`" -c:v copy `"$outputFile`"" 

# Démarrer FFmpeg en arrière-plan
$process = Start-Process -FilePath "cmd.exe" -ArgumentList "/c $ffmpegCommand" -PassThru

$cheminFichier = Join-Path $outputDirectory $namepidfile

if (-not (Test-Path $cheminFichier)) {
 # Le fichier n'existe pas, créer le fichier
 New-Item -ItemType File -Path $cheminFichier -Force
 Write-Host "Fichier créé : $cheminFichier"
} else {
 Write-Host "Le fichier existe déjà : $cheminFichier"
}

Start-Sleep -Seconds 5

$processId = Get-WmiObject Win32_Process -Filter "Name='ffmpeg.exe'" | Select-Object -ExpandProperty ProcessId

# Enregistrez le PID dans un fichier
$process.Id | Out-File $cheminFichier

Write-Host "Enregistrement démarré. PID du processus : $($processId)"



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


StoptRec.ps1


$cameraIP = $args[0]
$ipfile = ${cameraIP} -replace "\.", ""
$namepidfile = "PID_"+$ipfile+".txt"
$outputDirectory = "C:\OutputDirectory"
$cheminFichier = Join-Path $outputDirectory $namepidfile

$pidcontent = Get-Content $cheminFichier -Raw 
if (-not $pidContent) {
 Write-Host "Erreur : Le fichier PID est vide. Assurez-vous que l'enregistrement est démarré."
 exit
}

$processId = $pidContent.Trim() -as [int]

if (-not $processId) {
 Write-Host "Erreur : Impossible de convertir le contenu du fichier PID en entier."
 exit
}

Get-Process -Id $processId

Stop-Process -Id $processId -PassThru | Foreach-Object { $_.CloseMainWindow() }

Write-Host "Enregistrement arrêté pour le processus PID $processId"
Start-Sleep -Seconds 15



The problem is that they work, except in one case that I'll explain :
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.
I then performed C# actions in my Controller, which calls and executes these scripts :


The action that calls StartRec.ps1


public void startRecordingCam1(string ipAddress)
 {
 string ps1File = @"C:\OutputDirectory\StartRec.ps1";
 string cameraIP = "Camera IP Adress";
 string port = "88";
 string username = "Username";
 string password = "Password";

 Process process = Process.Start(new ProcessStartInfo
 {
 FileName = "powershell.exe",
 Arguments = $"-NoProfile -ExecutionPolicy Bypass -File \"{ps1File}\" \"{cameraIP}\" \"{port}\" \"{username}\" \"{password}\"",
 UseShellExecute = false,
 RedirectStandardInput = true
 //CreateNoWindow = true
 });
 }



The action that calls StopRec.ps1


public void stopRecording(string ipAddress)
 {
 string ps1File = @"C:\Projet Valentin\CameraTest\StopRec_Csharp.ps1";
 string cameraIP = "10.0.1.10";

 ProcessStartInfo startInfo = new ProcessStartInfo()
 {
 FileName = "powershell.exe",
 Arguments = $"-NoProfile -ExecutionPolicy ByPass -File \"{ps1File}\" \"{cameraIP}\" ",
 UseShellExecute = true
 };
 Process.Start(startInfo);
 }



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).
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#".


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


One thing I can add that I discovered while debugging is that this :

Stop-Process -Id $processId -PassThru | Foreach-Object { $_.CloseMainWindow() }


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


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


-
How to trim a video using FFmpeg in Objective-C for iOS application
13 juillet 2015, par AnujAroshAI am trying to implement a sample iOS application that can trim a bundled video (.mp4) using FFmpeg library in Objective-C environment.
I used this script to compile and build the FFmpeg for iOS. Those libraries was added to the project but now I’m not sure how to continue it. How can I find which function do the trim behaviour and what are the supportive codecs and etc.
I am interesting do achieve this with out any wrapper but directly accessing the library functions. How can I do this ?
Update : 1
I believe following code snippet will contain the input video file details in a stream
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"KeseMase" ofType:@".mp4"];
AVInputFormat *inputFormat = av_find_input_format([@"mp4" UTF8String]);
const char *utf8FilePath = [filePath UTF8String];
avformat_open_input(&pFormatCtx, utf8FilePath, inputFormat, nil);Or does it contain only the header information of the video file ?
Update : 2
With following code, I was able to convert input video to a stream of AVPacket and store them in a NSMutableArray
- (BOOL)readFrameIntoPacket:(AVPacket *)packet error:(NSError *__autoreleasing *)error
{
BOOL continueReading = YES;
int frameReadValue = av_read_frame(pFormatCtx, packet);
if (frameReadValue == 0)
{
NSLog(@"%s - %d # Read next frame", __PRETTY_FUNCTION__, __LINE__);
continueReading = YES;
NSValue *value = [NSValue valueWithBytes:&packet objCType:@encode(AVPacket)];
[srcPktArr addObject:value];
}
else
{
continueReading = NO;
av_free_packet(packet);
}
return continueReading;
}Tasks remain to solve the question are :
1.) How to use those AVPackets to and write a Video file
2.) How to give a start time and end time and write only that part to a video file
Update : 3
Okay... then I try to write those packets to an out put file like below
- (BOOL)writePacket:(AVPacket *)packet error:(NSError *__autoreleasing *)error
{
int writeValue = av_write_frame(outputContext, packet);
if (writeValue == 0)
{
return YES;
}
else if (writeValue == 1)
{
return YES;
}
else
{
return NO;
}
}and ended up with following error
[mp4 @ 0x1c04a200] Invalid packet stream index : 17467852
Update : 4
Okay guys, I get this far.