
Recherche avancée
Médias (1)
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
Autres articles (111)
-
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...) -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
-
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 (10799)
-
import moviepy error issue with python3.9+ and matplotlib on latest MacOS M1
4 décembre 2022, par Arya KeniFor python 3.9+ there seems to be an error when I import moviepy after a pip install for moviepy with the correct command as per docs. I am trying an alternative to save animated plots from matplotlib from .gif format to .mp4 format, but matplotlib on MacOS (M1 chip) supports only .gif due to a lack of the "FFMpeg" process (which stays unresolved after pip installs as well). Any clue what to do here ?


Repeat :


For python 3.9+ there seems to be an error when I import moviepy after a pip install for moviepy with the correct command as per docs. I am trying an alternative to save animated plots from matplotlib from .gif format to .mp4 format, but matplotlib on MacOS (M1 chip) supports only .gif due to a lack of the "FFMpeg" process (which stays unresolved after pip installs as well). Any clue what to do here ?


-
Python aiortc : How to record audio and video come from client in the same file ? [closed]
22 décembre 2024, par Chris PI have an aiortc app, which html5 client send data (microphone,camera) into server.


In server side i sucessfully played this two streams seperatly.


But when i try to record using aiortc MediaRecorder helper class, only the voice is recording, and the video is dropped (mp4 format).


I think this is due sync issue.


The audio_frame and the video_frame (each pair of them) have different time_base.
(I don't know if this is strange).
But it also has different time.


I can share code, but couldn't help at all right now.


Edit : I also tried to synchronize them client side with no luck


// Synchronize tracks
async function synchronizeTracks(localStream) {
 const videoTrack = localStream.getVideoTracks()[0];
 const audioTrack = localStream.getAudioTracks()[0];

 const syncedStream = new MediaStream();

 // Add tracks to the synchronized stream
 syncedStream.addTrack(videoTrack);
 syncedStream.addTrack(audioTrack);

 // Video and audio processors
 const videoProcessor = new MediaStreamTrackProcessor({ track: videoTrack });
 const audioProcessor = new MediaStreamTrackProcessor({ track: audioTrack });

 const videoReader = videoProcessor.readable.getReader();
 const audioReader = audioProcessor.readable.getReader();

 const videoWriter = new MediaStreamTrackGenerator({ kind: "video" }).writable.getWriter();
 const audioWriter = new MediaStreamTrackGenerator({ kind: "audio" }).writable.getWriter();

 const syncThreshold = 5; // Maximum allowable time difference in milliseconds
 let baseTimestamp = null;

 async function processTracks() {
 try {
 while (true) {
 const [videoResult, audioResult] = await Promise.all([
 videoReader.read(),
 audioReader.read(),
 ]);

 if (videoResult.done || audioResult.done) break;

 const videoFrame = videoResult.value;
 const audioFrame = audioResult.value;

 // Initialize base timestamp if needed
 if (baseTimestamp === null) {
 baseTimestamp = Math.min(videoFrame.timestamp, audioFrame.timestamp);
 }

 const videoRelativeTimestamp = videoFrame.timestamp - baseTimestamp;
 const audioRelativeTimestamp = audioFrame.timestamp - baseTimestamp;

 const timeDifference = videoRelativeTimestamp - audioRelativeTimestamp;

 if (Math.abs(timeDifference) <= syncThreshold) {
 // Frames are in sync
 await videoWriter.write(videoFrame);
 await audioWriter.write(audioFrame);
 } else if (timeDifference > 0) {
 // Video is ahead, wait for audio to catch up
 await audioWriter.write(audioFrame);
 // Reuse video frame on the next loop
 videoReader.releaseLock();
 } else {
 // Audio is ahead, wait for video to catch up
 await videoWriter.write(videoFrame);
 // Reuse audio frame on the next loop
 audioReader.releaseLock();
 }

 // Release frames
 videoFrame.close();
 audioFrame.close();
 }
 } catch (error) {
 console.error("Error in track synchronization:", error);
 } finally {
 videoReader.releaseLock();
 audioReader.releaseLock();
 videoWriter.close();
 audioWriter.close();
 }
 }

 processTracks();

 return syncedStream;
}




python code to improve :


class SyncClientTracksForRecording:
 def __init__(self, audio_track, video_track, audio_track_sync_q, video_track_sync_q):
 self.audio_track = audio_track
 self.video_track = video_track
 self.audio_track_sync_q = audio_track_sync_q
 self.video_track_sync_q = video_track_sync_q

 # Time bases
 self.audio_time_base = fractions.Fraction(1, 48000) # 48 kHz audio
 self.video_time_base = fractions.Fraction(1, 90000) # 90 kHz video

 # Elapsed time tracking
 self.audio_elapsed_time = 0.0
 self.video_elapsed_time = 0.0

 # Stop signal for synchronization loop
 self.stop_signal = False

 async def sync(self):
 while not self.stop_signal:
 try:
 # Receive audio and video frames concurrently
 audio_task = asyncio.create_task(self.audio_track.recv())
 video_task = asyncio.create_task(self.video_track.recv())

 audio_frame, video_frame = await asyncio.gather(audio_task, video_task)

 # Set time bases
 audio_frame.time_base = self.audio_time_base
 video_frame.time_base = self.video_time_base

 # Calculate and assign PTS values
 audio_frame.pts = int(self.audio_elapsed_time / float(self.audio_time_base))
 video_frame.pts = int(self.video_elapsed_time / float(self.video_time_base))

 # Increment elapsed time
 self.audio_elapsed_time += 0.020 # Assuming 20 ms audio frame duration
 self.video_elapsed_time += 1 / 30 # Assuming 30 fps video frame rate

 # Enqueue frames
 await asyncio.gather(
 self.audio_track_sync_q.put(audio_frame),
 self.video_track_sync_q.put(video_frame),
 )

 except Exception as e:
 print(f"Error in sync loop: {e}")
 break

 def stop(self):
 """Stop the synchronization loop."""
 self.stop_signal = True




-
Anomalie #3930 : Moteur de recherche : combinaison de DEUX mots avec accents ne retourne rien
1er octobre 2018, par - EquipementPour information, j’ai effectué les tests suivants sur SPIP 3.2.1 [23954] (installation neuve puis ajout d’une rubrique "secrétariat général" et de son article publié) :
- sous PHP 7.0 avec mariaDB : la recherche sur "secrétariat général" trouve bien la rubrique.
- sous PHP 5.6 avec mysql 5.6 : la recherche sur "secrétariat général" ne trouve pas la rubrique.Je précise que dans les deux cas, les bases sont en utf8 et que l’interclassement des tables est utf8_general_ci.
A titre de test (ce n’est pas une proposition de correctif), au début de la fonction inc_recherche_to_array_dist, j’ai ajouté :
- <span class="CodeRay"><span class="local-variable">$recherche</span> = ci_rewrite(<span class="local-variable">$recherche</span>);
- </span>
puis j’ai ajouté la fonction :- <span class="CodeRay"><span class="keyword">function</span> <span class="function">ci_rewrite</span>(<span class="local-variable">$chaine</span>){
- <span class="local-variable">$rewrite</span> = <span class="predefined">strtr</span>(
- <span class="local-variable">$rewrite</span>,
- <span class="string"><span class="delimiter">'</span><span class="content">@ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ</span><span class="delimiter">'</span></span>,
- <span class="string"><span class="delimiter">'</span><span class="content">aAAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy</span><span class="delimiter">'</span></span>
- );
- <span class="keyword">return</span> <span class="local-variable">$rewrite</span>;
- }
- </span>
Avec ce bout de code, la recherche sur "secrétariat général" trouve alors la rubrique, sous PHP 5.6 avec mysql 5.6.Remarque : j’ai aussi essayé avec la fonction translitteration de SPIP, mais cela ne marche pas.