
Recherche avancée
Autres articles (48)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)
Sur d’autres sites (6076)
-
How to record/trim/combine audio seamlessly in a React/Node web app
16 mai 2021, par Rayhan MemonI've developed a digital audio workstation for the browser that you can check out here. Essentially it helps authors narrate their own audiobooks themselves at home.


I'm looking to dramatically improve the speed at which audio files are combined or trimmed.


Right now, the user records some variable amount of audio (a line, paragraph, or entire passage). When the user stops recording, this clip is added to the main audio file for the section using ffmpeg.wasm like so :


if (duration === 0) {
 //concatenate the two files (they should already be written to memory)
 await ffmpeg.run('-i', 'concat:fullAudio.mp3|clip.mp3', '-c', 'copy', 'fullAudio.mp3');

 } else {
 //Set the insert time to wherever the user's cursor is positioned
 let insertTime = duration;
 if (selectedObj) {
 insertTime = selectedObj.endTime;
 }

 //split the audio file into two parts at the point we want to insert the audio
 await ffmpeg.run('-i', 'fullAudio.mp3', '-t', `${insertTime}`, '-c', 'copy', 'part1.mp3', '-ss', `${insertTime}`, '-codec', 'copy', 'part2.mp3');

 //concatenate the three files
 await ffmpeg.run('-i', 'concat:part1.mp3|clip.mp3', '-acodec', 'copy', 'intermediate.mp3');
 await ffmpeg.run('-i', 'concat:intermediate.mp3|part2.mp3', '-acodec', 'copy', 'fullAudio.mp3');
 }

 //Read the result from memory
 const data = ffmpeg.FS('readFile', 'fullAudio.mp3');

 //Create URL so it can be used in the browser
 const url = URL.createObjectURL(new Blob([data.buffer], { type: 'audio/mp3' }));
 globalDispatch({ type: "setFullAudioURL", payload: url });



After every recorded clip, the user is forced to wait a few seconds for this concatenation process to finish up - and the longer the main file or recorded clip gets, the longer the user has to wait. Looking at other browser-based audio editors such as AudioMass, it clearly seems possible to make a seamless recording and editing experience with zero wait time, but I can't seem to figure out how to do the same within my react app.


Is it possible to seamlessly combine or trim audio data within a React app ? Is FFMPEG the best way to go about it, or are there simpler ways using pure javascript ?


-
How to solve Accord.Video.FFMPEG memory leak problem
26 mai 2021, par mfwooI am developing a digital billboard application that allow customer to click on the touch screen to go back and forth.


Screen 0 -> touch -> Screen 1 -> touch -> Screen 2 -> time out -> Screen 0


If no interaction happens Screen 0 will loop indefinitely. Every Screen is running its own MP4 file.


However, for every running cycle of Screen 1, it gobbled up memory and in no time the application crash.


Is it because of VideoFileSource's video object is not being dispose properly or because of some threading problem in video_NewFrame ?


Because I get this error occasionally - "Invoke or BeginInvoke cannot be called on a control until the windows handle is created"


I am using VS2017 .NET Framework 4.5 with Accord.Video.FFMPEG by Accord.NET version 3.8


Screen 0 MP4 size - 5.5MB
Screen 1 MP4 size - 5.6MB
Screen 2 MP4 size - 7.0MB


Here is my code :-
...


Bitmap image;
VideoFileSource video;
int screenIdx = 0;
bool enableClicking = true;
bool isTimeOut = false;
string VideoPath = @"d:\KioskApp\Bkgrnd\"

public frmMain()
 {
 InitializeComponent(); 
 StartFirstScreen();
 tmrScreen01.Interval = 10000;
 tmrScreen02.Interval = 10000;
 }
 
 private void StartFirstScreen()
 {
 try
 {
 string fileName = VideoPath + Screen00();
 video = new VideoFileSource(fileName);
 video.PlayingFinished += new Accord.Video.PlayingFinishedEventHandler(video_Finished);
 video.NewFrame += new Accord.Video.NewFrameEventHandler(video_NewFrame);
 video.Start();
 screenIdx = 1;
 }
 catch (Exception ex)
 {
 string strErrMsg = strMsg + " - " + ex.Message;
 MessageBox.Show(strErrMsg);
 }
 }
 
 private void video_NewFrame(object sender, Accord.Video.NewFrameEventArgs eventArgs)
 {
 try
 {
 Invoke(new Action(() =>
 {
 System.Drawing.Image OldImage;
 OldImage = pictureBox1.Image;
 pictureBox1.Image = AForge.Imaging.Image.Clone(eventArgs.Frame);
 if (OldImage != null)
 OldImage.Dispose();
 })); 
 }
 catch (Exception ex)
 {
 var strErrMsg = "video_NewFrame - " + ex.Message;
 MessageBox.Show(strErrMsg);
 }
 }
 
 private void video_Finished(object sender, Accord.Video.ReasonToFinishPlaying reason)
 {
 try
 {
 if (screenIdx == 1)
 {
 video.PlayingFinished -= video_Finished;
 video.NewFrame -= video_NewFrame;
 video = null; 
 StartFirstScreen();
 return;
 }
 enableClicking = true;

 }
 catch (Exception ex)
 {
 var strErrMsg = "video_Finished - " + ex.Message;
 MessageBox.Show(strErrMsg);

 }
 }
 
 void startLastScreen()
 {
 string fileName = string.Empty;
 video.SignalToStop();
 fileName = VideoPath + Screen02();
 screenIdx = 0;
 if (object.ReferenceEquals(null, video))
 {
 video = new VideoFileSource(fileName);
 }
 else
 {
 video = null;
 video = new VideoFileSource(fileName);
 }

 video.PlayingFinished += new Accord.Video.PlayingFinishedEventHandler(video_Finished);
 video.NewFrame += new Accord.Video.NewFrameEventHandler(video_NewFrame);
 video.Start();
 enableClicking = false;
 }
 
 private void pictureBox1_Click(object sender, EventArgs e)
 {
 if (!enableClicking && screenIdx != 1) return;

 tmrScreen01.Stop();
 tmrScreen02.Stop();
 
 // Check clickable area before allow to proceed to the next screen 
 string fileName = string.Empty;
 video.SignalToStop();
 video.Stop();

 if (screenIdx == 0)
 {
 fileName = VideoPath + Screen00();
 screenIdx = 1;
 }
 else if (screenIdx == 1)
 {
 fileName = VideoPath + Screen01();
 screenIdx = 2;
 
 }
 else if (screenIdx == 2)
 {
 fileName = VideoPath + Screen02();
 screenIdx = 0;
 
 }

 if (object.ReferenceEquals(null, video))
 {
 video = new VideoFileSource(fileName);
 }
 else
 {
 video = null;
 video = new VideoFileSource(fileName);
 }
 video.PlayingFinished += new Accord.Video.PlayingFinishedEventHandler(video_Finished);
 video.NewFrame += new Accord.Video.NewFrameEventHandler(video_NewFrame);
 enableClicking = false;
 isTimeOut = false;
 video.Start();
 }



...


-
How to convert AC3 audio to Wav audio ?
18 janvier 2023, par Joey JoestarI would like to convert a AC3 audio file (ATSC A/52 aka AC-3 aka Dolby Digital stream 6 channels) to Wave audio file (16khz mono/1 channel).


While searching on the internet, a lot of people just used
ffmpeg -i file.ac3 file.wav
however, i'm not sure if that even works.

I keep getting


[ac3 @ 0x55ac1a0b0660] exponent -1 is out-of-rangets/s speed= 125x
[ac3 @ 0x55ac1a0b0660] error decoding the audio block
[ac3 @ 0x55ac1a0b0660] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
etc



while I do the same command.
How do I convert ac3 to wav (16khz mono) ?


*Note :
I also tried
ffmpeg -i file.ac3 -codec:a:1 ac3 -codec copy -b:a 384 file.wav -ac 1 -ar 16000
. But this doesn't output an actual wav file.