
Recherche avancée
Médias (91)
-
Spoon - Revenge !
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
My Morning Jacket - One Big Holiday
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Zap Mama - Wadidyusay ?
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
David Byrne - My Fair Lady
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Beastie Boys - Now Get Busy
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Granite de l’Aber Ildut
9 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
Autres articles (37)
-
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 -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
Configuration spécifique pour PHP5
4 février 2011, parPHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
Modules spécifiques
Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...)
Sur d’autres sites (3394)
-
Start and end time of MoviePy's VideoClip not working
21 mars 2024, par ernesto casco velazquezI'm trying to add captions to a video. The desired outcome is to show each word in the exact moment is being said.


I have a method that gives me the accurate time start and end per each word :


def get_words_per_time(audio_speech_file):
 model = whisper.load_model("base")
 transcribe = model.transcribe(
 audio=audio_speech_file, fp16=False, word_timestamps=True
 )
 segments = transcribe["segments"]
 words = []

 for seg in segments:
 for word in seg["words"]:
 words.append(
 {
 "word": word["word"],
 "start": word["start"],
 "end": word["end"],
 "prob": round(word["probability"], 4),
 }
 )
 return words



Then I have a code that uses MoviePy to create TextClip and assing a given start and end time per pair of words (I know there are redundant statements, srry) :


def generate_captions(
 words,
 font="Komika",
 fontsize=32,
 color="White",
 align="center",
 stroke_width=3,
 stroke_color="black",
):
 text_comp = []
 for i in track(range(0, len(words), 2), description="Creating captions..."):
 word1 = words[i]
 if i + 1 < len(words):
 word2 = words[i + 1]
 text_clip = TextClip(
 f"{word1['word']} {word2['word'] if i + 1 < len(words) else ''}",
 font=font, # Change Font if not found
 fontsize=fontsize,
 color=color,
 align=align,
 method="caption",
 size=(660, None),
 stroke_width=stroke_width,
 stroke_color=stroke_color,
 )
 text_clip = text_clip.set_start(word1["start"])
 text_clip = text_clip.set_end(
 word2["end"] if i + 1 < len(words) else word1["end"]
 )
 text_comp.append(text_clip)
 return text_comp



Finally, I concatenate the words into a single video :


vid_clip = CompositeVideoClip(
 [vid_clip, concatenate_videoclips(text_comp).set_position(("center", 860))]
)



The output is this, but you can clearly see the words are not flowing with the speech. They somehow move faster as if the start/end time did not matter. Here's the video


The words with their respective start/end time, look like this :


[
 {
 'word': 'This',
 'start': 0.0,
 'end': 0.22,
 'prob': 0.805
 },
 {
 'word': 'is',
 'start': 0.22,
 'end': 0.42,
 'prob': 0.9991
 },
 {
 'word': 'a',
 'start': 0.42,
 'end': 0.6,
 'prob': 0.999
 },
 {
 'word': 'test,
 ',
 'start': 0.6,
 'end': 1.04,
 'prob': 0.9939
 },
 {
 'word': 'to',
 'start': 1.18,
 'end': 1.3,
 'prob': 0.9847
 },
 {
 'word': 'show',
 'start': 1.3,
 'end': 1.54,
 'prob': 0.9971
 },
 {
 'word': 'words',
 'start': 1.54,
 'end': 1.9,
 'prob': 0.995
 },
 {
 'word': 'does',
 'start': 1.9,
 'end': 2.16,
 'prob': 0.997
 },
 {
 'word': 'not',
 'start': 2.16,
 'end': 2.4,
 'prob': 0.9978
 },
 {
 'word': 'appear.',
 'start': 2.4,
 'end': 2.82,
 'prob': 0.9984
 },
 {
 'word': 'At',
 'start': 3.46,
 'end': 3.6,
 'prob': 0.9793
 },
 {
 'word': 'their',
 'start': 3.6,
 'end': 3.8,
 'prob': 0.9984
 },
 {
 'word': 'proper',
 'start': 3.8,
 'end': 4.22,
 'prob': 0.9976
 },
 {
 'word': 'time.',
 'start': 4.22,
 'end': 4.72,
 'prob': 0.999
 },
 {
 'word': 'Thanks',
 'start': 5.04,
 'end': 5.4,
 'prob': 0.9662
 },
 {
 'word': 'for,
 ',
 'start': 5.4,
 'end': 5.66,
 'prob': 0.9941
 },
 {
 'word': 'watching.',
 'start': 5.94,
 'end': 6.36,
 'prob': 0.7701
 }
]



What could be causing this ?


-
Socket.io client in js and server in Socket.io go doesn't send connected messege and data
24 mars 2023, par OmriHalifaI am using
ffmpeg
andsocket.io
and I have some issues. I'm trying to send a connection request to a server written in Go through React, but I'm unable to connect to it. I tried adding the events in useEffect and it's still not working, what should I do ? i attaching my code in js and in go :
main.go


package main

import (
 "log"

 "github.com/gin-gonic/gin"

 socketio "github.com/googollee/go-socket.io"
)

func main() {
 router := gin.New()

 server := socketio.NewServer(nil)

 server.OnConnect("/", func(s socketio.Conn) error {
 s.SetContext("")
 log.Println("connected:", s.ID())
 return nil
 })

 server.OnEvent("/", "notice", func(s socketio.Conn, msg string) {
 log.Println("notice:", msg)
 s.Emit("reply", "have "+msg)
 })

 server.OnEvent("/", "transcoded-video", func(s socketio.Conn, data string) {
 log.Println("transcoded-video:", data)
 })

 server.OnEvent("/", "bye", func(s socketio.Conn) string {
 last := s.Context().(string)
 s.Emit("bye", last)
 s.Close()
 return last
 })

 server.OnError("/", func(s socketio.Conn, e error) {
 log.Println("meet error:", e)
 })

 server.OnDisconnect("/", func(s socketio.Conn, reason string) {
 log.Println("closed", reason)
 })

 go func() {
 if err := server.Serve(); err != nil {
 log.Fatalf("socketio listen error: %s\n", err)
 }
 }()
 defer server.Close()

 if err := router.Run(":8000"); err != nil {
 log.Fatal("failed run app: ", err)
 }
}




App.js


import './App.css';
import { useEffect } from 'react';
import { createFFmpeg, fetchFile } from '@ffmpeg/ffmpeg';
import { io } from 'socket.io-client'; 

function App() {
 const socket = io("http://localhost:8000",function() {
 // Send a message to the server when the client is connected
 socket.emit('clientConnected', 'Client has connected to the server!');
 })

 const ffmpegWorker = createFFmpeg({
 log: true
 })

 // Initialize FFmpeg when the component is mounted
 async function initFFmpeg() {
 await ffmpegWorker.load();
 }

 async function transcode(webcamData) {
 const name = 'record.webm';
 await ffmpegWorker.FS('writeFile', name, await fetchFile(webcamData));
 await ffmpegWorker.run('-i', name, '-preset', 'ultrafast', '-threads', '4', 'output.mp4');
 const data = ffmpegWorker.FS('readFile', 'output.mp4');
 
 // Set the source of the output video element to the transcoded video data
 const video = document.getElementById('output-video');
 video.src = URL.createObjectURL(new Blob([data.buffer], { type: 'video/mp4' }));
 
 // Remove the output.mp4 file from the FFmpeg virtual file system
 ffmpegWorker.FS('unlink', 'output.mp4');
 
 // Emit a "transcoded-video" event to the server with the transcoded video data
 socket.emit("transcoded-video", data.buffer)
 }
 
 

 let mediaRecorder;
 let chunks = [];
 
 // Request access to the user's camera and microphone and start recording
 function requestMedia() {
 const webcam = document.getElementById('webcam');
 navigator.mediaDevices.getUserMedia({ video: true, audio: true })
 .then(async (stream) => {
 webcam.srcObject = stream;
 await webcam.play();

 // Set up a MediaRecorder instance to record the video and audio
 mediaRecorder = new MediaRecorder(stream);

 // Add the recorded data to the chunks array
 mediaRecorder.ondataavailable = async (e) => {
 chunks.push(e.data);
 }

 // Transcode the recorded video data after the MediaRecorder stops
 mediaRecorder.onstop = async () => {
 await transcode(new Uint8Array(await (new Blob(chunks)).arrayBuffer()));

 // Clear the chunks array after transcoding
 chunks = [];

 // Start the MediaRecorder again after a 0 millisecond delay
 setTimeout(() => {
 mediaRecorder.start();
 
 // Stop the MediaRecorder after 3 seconds
 setTimeout(() => {
 mediaRecorder.stop();
 }, 500);
 }, 0);
 }

 // Start the MediaRecorder
 mediaRecorder.start();

 // Stop the MediaRecorder after 3 seconds
 setTimeout(() => {
 mediaRecorder.stop();
 }, 700);
 })
 }
 
 useEffect(() => {
 // Set up event listeners for the socket connection
 socket.on('/', function(){
 // Log a message when the client is connected to the server
 console.log("Connected to server!"); 
 });

 socket.on('transcoded-video', function(data){
 // Log the received data for debugging purposes
 console.log("Received transcoded video data:", data); 
 });

 socket.on('notice', function(data){
 // Emit a "notice" event back to the server to acknowledge the received data
 socket.emit("notice", "ping server!");
 });

 socket.on('bye', function(data){
 // Log the received data and disconnect from the server
 console.log("Server sent:", data); 
 socket.disconnect();
 });

 socket.on('disconnect', function(){
 // Log a message when the client is disconnected from the server
 console.log("Disconnected from server!"); 
 });
 }, [])

 return (
 <div classname="App">
 <div>
 <video muted="{true}"></video>
 <video autoplay="autoplay"></video>
 </div>
 <button>start streaming</button>
 </div>
 );
}

export default App;



What can i do to fix it ? thank you !!


-
Is there a way to send ffmpeg data directly to a TCP Client ?
3 février 2021, par KosmosisDireI am using ffmpeg to send screen capture directly to a C# TCP server. However, due to some bug or technical limitation, the Quest 2 (my build device) cannot bind ports. (There is very little info regarding this bug online, but as far as I can tell I can't get around it). So I cannot have a C# server on the Quest, I must have a client on the quest to receive data. However, ffmpeg sends data as a TCP client. So I need ffmpeg to act as a server.


I tried sending the data through a server on my computer that then sends the data to the C# client. But I get less than 1 fps with huge lag. Normally, I get a good 30 fps with low latency when sending directly to a server.


So my question :


Is there a way to get ffmpeg data directly to a client, or indirectly without increasing the latency ?


Here is the ffmpeg command I am using :


ffmpeg -f gdigrab -i desktop -pixel_format rgb8 -video_size 896x504 -vf scale=896:504 -framerate 5 -r 30 -f rawvideo tcp://127.0.0.1:846



I can include code for my C# client and server attempts as well as the middleman server, if I need.


Thanks for any help !