
Recherche avancée
Autres articles (89)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
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
Sur d’autres sites (14967)
-
How to make media recorder api individual chunks playable by it self
10 août 2024, par tedGuyI'm trying to send individual chunks to the server instead of sending the whole chunks at once. This way, I have Ffmpeg on my Rails server to convert these chunks to HLS and upload them to S3 to stream the video instantly. However, I've encountered an issue the Media Recorder only provides playable chunks for the first segment after that, they are not playable and need to be concatenated to play.


To avoid this, I've taken a different approach where I start a new Media Recorder every 3 seconds so that I get a playable chunk every time. However, this approach has its issues the video glitches a bit due to the delay when I stop and start a new Media Recorder. Is there a way to achieve this with ease ? This is my current status. please help !


const startVideoRecording = async (
 screenStream: MediaStream,
 audioStream: MediaStream
 ) => {
 setStartingRecording(true);

 try {
 const res = await getVideoId();
 videoId.current = res;
 } catch (error) {
 console.log(error);
 return;
 }

 const outputStream = new MediaStream();
 outputStream.addTrack(screenStream.getVideoTracks()[0]);
 outputStream.addTrack(audioStream.getAudioTracks()[0]); // Add audio track

 const mimeTypes = [
 "video/webm;codecs=h264",
 "video/webm;codecs=vp9",
 "video/webm;codecs=vp8",
 "video/webm",
 "video/mp4",
 ];

 let selectedMimeType = "";
 for (const mimeType of mimeTypes) {
 if (MediaRecorder.isTypeSupported(mimeType)) {
 selectedMimeType = mimeType;
 break;
 }
 }

 if (!selectedMimeType) {
 console.error("No supported mime type found");
 return;
 }

 const videoRecorderOptions = {
 mimeType: selectedMimeType,
 };

 let chunkIndex = 0;

 const startNewRecording = () => {
 // Stop the current recorder if it's running
 if (
 videoRecorderRef.current &&
 videoRecorderRef.current.state === "recording"
 ) {
 videoRecorderRef.current.stop();
 }

 // Create a new MediaRecorder instance
 const newVideoRecorder = new MediaRecorder(
 outputStream,
 videoRecorderOptions
 );
 videoRecorderRef.current = newVideoRecorder;

 newVideoRecorder.ondataavailable = async (event) => {
 if (event.data.size > 0) {
 chunkIndex++;
 totalSegments.current++;
 const segmentIndex = totalSegments.current;
 console.log(event.data);
 handleUpload({ segmentIndex, chunk: event.data });
 }
 };

 // Start recording with a 3-second interval
 newVideoRecorder.start();
 };

 // Start the first recording
 startNewRecording();

 // Set up an interval to restart the recording every 3 seconds
 recordingIntervalIdRef.current = setInterval(() => {
 startNewRecording();
 }, 3000);

 setIsRecording(true);
 setStartingRecording(false);
 };



-
MPG to MP4 Video Conversion after Azure Media Services Retirement [closed]
30 juillet 2024, par YousefI'm hosting a C# Blazor Application in Azure App Service and was leveraging Azure Media Services to transcode mpg videos to mp4 in Jobs. However, Azure Media Services was retired last month and the services are going to stop next week so I have to find an alternative.
I have looked at multiple alternatives but couldn't find a simple conversion tool.
In Azure Media Services I was using the following configuration



I can't seem to find the same configuration in the tools I have looked at. I tried Bitmovin but the encoding takes 5 - 10 Minutes (unlike Azure Media Services which takes 2 minutes) and the result of the encoding is a folder with 4 mp4 segments that are not part of the original mpg video.


I tried ffmpeg locally but I can't get it to work in an Azure App Service.


Does anyone have any suggestion of an alternative to Azure Media Service when it comes to Transcoding mpg videos to mp4 in a background task ?


-
Unable to Play Video Stream on Flask-FFmpeg Media Server on Subsequent Requests
12 juin 2024, par yternalProblem Description :


I am trying to create a media server using Flask and FFmpeg. The server converts an RTSP stream to FLV format for playback in a web browser, and I am testing it using ffplay. The server starts successfully, and the data returned from the first request can be played using ffplay. However, when I interrupt the ffplay request and make it again, ffplay is unable to play the video and displays an "Invalid data found when processing input" error.


I am using the following command to test with ffplay :


ffplay http://127.0.0.1:8000/flv/0



My current Flask code:


import queue
import subprocess
import threading

from flask import Flask, Response, stream_with_context
from gevent import monkey
from gevent.pool import Pool
from gevent.pywsgi import WSGIServer
from geventwebsocket.handler import WebSocketHandler
from loguru import logger

monkey.patch_all()
app = Flask(__name__)

stream_queue = queue.Queue(maxsize=10000)


def update_stream():
 process = subprocess.Popen(
 ['ffmpeg', '-i', 'rtsp://192.168.1.168/0', '-f', 'flv', '-'],
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE
 )
 while True:
 data = process.stdout.read(4096)
 if not data:
 break
 if stream_queue.full():
 stream_queue.get()
 stream_queue.put(data)
 logger.debug(f"stream_queue size: {stream_queue.qsize()}")


@app.route('/flv/')
def flv_stream(stream_id):
 @stream_with_context
 def generate():

 while True:
 data = stream_queue.get()
 yield data

 return Response(generate(), mimetype='video/x-flv')


if __name__ == '__main__':
 HOST = "0.0.0.0"
 PORT = 8000

 threading.Thread(target=update_stream, daemon=True).start()

 logger.info(f"listen in: {HOST}:{PORT}")
 pool = Pool(10000)
 http_serve = WSGIServer((HOST, PORT), app, handler_class=WebSocketHandler, spawn=pool)
 http_serve.max_accept = 30000
 http_serve.serve_forever()



The error message when attempting to play the stream again with ffplay is :


http://127.0.0.1:8000/flv/0: Invalid data found when processing input



I tried adding some parameters to FFmpeg, such as analyzeduration and probesize, but it had no effect.