
Recherche avancée
Autres articles (12)
-
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ; -
Déploiements possibles
31 janvier 2010, parDeux types de déploiements sont envisageable dépendant de deux aspects : La méthode d’installation envisagée (en standalone ou en ferme) ; Le nombre d’encodages journaliers et la fréquentation envisagés ;
L’encodage de vidéos est un processus lourd consommant énormément de ressources système (CPU et RAM), il est nécessaire de prendre tout cela en considération. Ce système n’est donc possible que sur un ou plusieurs serveurs dédiés.
Version mono serveur
La version mono serveur consiste à n’utiliser qu’une (...) -
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
Sur d’autres sites (3094)
-
Xvfb and pulse audio not sync
14 décembre 2023, par Matrix 404I'm excited to introduce my new JavaScript server-side library called XFP Streamer, designed to handle recording and streaming Puppeteer window content. However, I'm currently facing an issue with audio synchronization, and I could really use some help from someone experienced with ffmpeg and recording in general.


The library's repository is available on GitHub, and I warmly welcome any contributions or assistance. Feel free to check it out at https://github.com/mboussaid/xfp-streamer.


Below is a simple example demonstrating how to record the Google website into a file.flv video file using XFP :


const XFP = require('./index');
XFP.onReady().then(async ()=>{
 // create new xfp instance
 const xfp = new XFP({
 debug:1
 });
 await xfp.onStart();
 // record everyting inside the file file.flv
 xfp.pipeToFile('file.flv',{
 debug:1
 })
 // xfp.pipeToRtmp('file.flv','RTMP LINK HERE')
 await xfp.onUseUrl('https://www.google.com') // navigate to google
 setTimeout(async ()=>{
 await xfp.onStop();
 },5000) // stop everyting after 5 seconds
},(missing)=>{
 // missing tools
 console.log('Missing tools',missing)
})



Please note that to ensure proper functionality, you will need to have the following tools installed :


pulseaudio
xvfb
ffmpeg
pactl
pacmd
Currently, I'm facing an issue with audio and video synchronization not working as expected. If you have experience with ffmpeg and recording, I would greatly appreciate your help in resolving this issue.


Thank you all for your support, and I look forward to your contributions !


Best regards,


-
Can't correctly decode an image frame using PyAV
17 avril 2023, par Martin BloreI'm trying to simply encode and decode a capture frame from the web-cam. I want to be able to send this over TCP but at the moment I'm having trouble performing this just locally.


Here's my code that simply takes the frame from the web-cam, encodes, then decodes, and displays the two images in a new window. The two images look like this :




Here's the code :


import struct
import cv2
import socket
import av
import time
import os

class PerfTimer:
 def __init__(self, name):
 self.name = name

 def __enter__(self):
 self.start_time = time.perf_counter()

 def __exit__(self, type, value, traceback):
 end_time = time.perf_counter()
 print(f"'{self.name}' taken:", end_time - self.start_time, "seconds.")

os.environ['AV_PYTHON_AVISYNTH'] = 'C:/ffmpeg/bin'

socket_enabled = False
sock = None
if socket_enabled:
 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 print("Connecting to server...")
 sock.connect(('127.0.0.1', 8000))

# Set up video capture.
print("Opening web cam...")
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 800)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 600)

# Initialize the encoder.
encoder = av.CodecContext.create('h264', 'w')
encoder.width = 800
encoder.height = 600
encoder.pix_fmt = 'yuv420p'
encoder.bit_rate = 5000

# Initialize the decoder.
decoder = av.CodecContext.create('h264', 'r')
decoder.width = 800
decoder.height = 600
decoder.pix_fmt = 'yuv420p'
decoder.bit_rate = 5000

print("Streaming...")
while(cap.isOpened()):
 
 # Capture the frame from the camera.
 ret, orig_frame = cap.read()

 cv2.imshow('Source Video', orig_frame)

 # Convert to YUV.
 img_yuv = cv2.cvtColor(orig_frame, cv2.COLOR_BGR2YUV_I420)

 # Create a video frame object from the num py array.
 video_frame = av.VideoFrame.from_ndarray(img_yuv, format='yuv420p')

 with PerfTimer("Encoding") as p:
 encoded_frames = encoder.encode(video_frame)

 # Sometimes the encode results in no frames encoded, so lets skip the frame.
 if len(encoded_frames) == 0:
 continue

 print(f"Decoding {len(encoded_frames)} frames...")

 for frame in encoded_frames:
 encoded_frame_bytes = bytes(frame)

 if socket_enabled:
 # Get the size of the encoded frame in bytes
 size = struct.pack('code>


-
I need to create a streaming app Where videos store in aws S3
27 juillet 2023, par abuzar zaidiI need to create a video streaming app. where my videos will store in S3 and the video will stream from the backend. Right now I am trying to use ffmpeg in the backend but it does not work properly.


what am I doing wrong in this code ? And if ffmpeg not support streaming video that store in aws s3 please suggest other options.


Backend


const express = require('express');
const aws = require('aws-sdk');
const ffmpeg = require('fluent-ffmpeg');
const cors = require('cors'); 
const app = express();

// Set up AWS credentials
aws.config.update({
accessKeyId: '#######################',
secretAccessKey: '###############',
region: '###############3',
});

const s3 = new aws.S3();
app.use(cors());

app.get('/stream', (req, res) => {
const bucketName = '#######';
const key = '##############'; // Replace with the key/path of the video file in the S3 bucket
const params = { Bucket: bucketName, Key: key };
const videoStream = s3.getObject(params).createReadStream();

// Transcode to HLS format
 const hlsStream = ffmpeg(videoStream)
.format('hls')
.outputOptions([
 '-hls_time 10',
 '-hls_list_size 0',
 '-hls_segment_filename segments/segment%d.ts',
 ])
.pipe(res);

// Transcode to DASH format and pipe the output to the response
ffmpeg(videoStream)
.format('dash')
.outputOptions([
 '-init_seg_name init-stream$RepresentationID$.mp4',
 '-media_seg_name chunk-stream$RepresentationID$-$Number%05d$.mp4',
 ])
.output(res)
.run();
});

const port = 5000;
app.listen(port, () => {
console.log(`Server running on http://localhost:${port}`);
});



Frontend


import React from 'react';

 const App = () => {
 const videoUrl = 'http://localhost:3000/api/playlist/runPlaylist/6c3e7af45a3b8a5caf2fef17a42ef9a0'; // Replace with your backend URL
Please list down solution or option i can use here
 const videoUrl = 'http://localhost:5000/stream';
 return (
 <div>
 <h1>Video Streaming Example</h1>
 <video controls="controls">
 <source src="{videoUrl}" type="video/mp4"></source>
 Your browser does not support the video tag.
 </video>
 </div>
 );
 };

 export default App;