
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (47)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (5630)
-
icecast2, nodejs, ffmpeg, radio, ogg
25 juillet 2024, par UximyI have a problem which is that when I start icecast server on ubuntu and not only on ubuntu but also on windows regardless of the operating system, when I first go to the radio station in icecast2 http://localhost:8000/radio the music plays but after restarting the page in the browser, the player stops loading, I tried the solution with nocache in the browser in the address bar, nothing helps, I looked at many users configs, they did not encounter such problems, I will leave my config below, I also wrote a code on nodejs I will also leave it below, the problem plays the same that if I go to a direct icecast link, what I will do through the node js code + ffmpeg, also about the logs, nothing outputs even a hint of any error that is related to this problem


Config IceCast :


<icecast>
 <location>Earth</location>
 <admin>icemaster@localhost</admin>
 <hostname>localhost</hostname>

 <limits>
 <clients>100</clients>
 <sources>10</sources>
 524288
 60
 30
 10
 1
 65536
 </limits>

 <authentication>
 hackme
 hackme
 admin
 hackme
 </authentication>

 
 <port>8000</port>
 0.0.0.0
 
 
 
 <port>8443</port>
 0.0.0.0
 <ssl>1</ssl>
 

 
 <header value="*"></header>
 <header value="Origin, X-Requested-With, Content-Type, Accept"></header>
 <header value="GET, POST, OPTIONS"></header>
 <header value="no-cache, no-store, must-revalidate"></header>
 <header value="no-cache"></header>
 <header value="0"></header>
 

 
 <mount type="normal">
 /radio
 <password>mypassword</password>
 <public>1</public>
 100
 Anime Vibes
 Anime Vibes
 <genre>various</genre>
 audio/ogg
 65536
 
 
 <header value="*"></header>
 <header value="Origin, X-Requested-With, Content-Type, Accept"></header>
 <header value="GET, POST, OPTIONS"></header>
 <header value="no-cache, no-store, must-revalidate"></header>
 <header value="no-cache"></header>
 <header value="0"></header>
 
 </mount>

 <fileserve>1</fileserve>

 <paths>
 <logdir>/var/log/icecast2</logdir>
 <webroot>/etc/icecast2/web</webroot>
 <adminroot>/etc/icecast2/admin</adminroot>
 
 <alias source="/" destination="/status.xsl"></alias>
 
 /etc/icecast2/cert/icecast.pem
 
 </paths>

 <logging>
 <accesslog>access.log</accesslog>
 <errorlog>error.log</errorlog>
 <playlistlog>playlist.log</playlistlog>
 <loglevel>1</loglevel> 
 <logsize>10000</logsize> 
 <logarchive>1</logarchive>
 </logging>
</icecast>



Code Node.js :


const express = require('express');
const { spawn } = require('child_process');
const path = require('path');
const fs = require('fs');
const https = require('https');
const app = express();
const port = 3000;

const privateKey = fs.readFileSync('./cert/privateKey.key', 'utf8');
const certificate = fs.readFileSync('./cert/certificate.crt', 'utf8');

const credentials = {
 key: privateKey,
 cert: certificate
};

app.use(express.static(path.join(__dirname)));

// Check if playlist file exists
const playlistPath = path.join(__dirname, 'playlist.txt');
if (!fs.existsSync(playlistPath)) {
 console.error('Playlist file does not exist');
 process.exit(1);
}

console.log(`Playlist path: ${playlistPath}`);

// Start FFmpeg process to create continuous stream from playlist
const ffmpegProcess = spawn('ffmpeg', [
 '-re',
 '-f', 'concat',
 '-safe', '0',
 '-protocol_whitelist', 'file,http,https,tcp,tls',
 '-i', playlistPath,
 '-c:a', 'libvorbis',
 '-f', 'ogg',
 '-tls', '1',
 'icecast://source:mypassword@localhost:8443/radio'
]);

ffmpegProcess.stdout.on('data', (data) => {
 console.log(`FFmpeg stdout: ${data}`);
});

ffmpegProcess.stderr.on('data', (data) => {
 console.error(`FFmpeg stderr: ${data}`);
});

ffmpegProcess.on('close', (code) => {
 console.log(`FFmpeg process exited with code ${code}`);
});

app.get('/radio', (req, res) => {
 res.setHeader('Content-Type', 'audio/ogg');
 res.setHeader('Transfer-Encoding', 'chunked');

 const requestOptions = {
 hostname: 'localhost',
 port: 8443,
 path: '/radio',
 method: 'GET',
 headers: {
 'Accept': 'audio/ogg'
 },
 rejectUnauthorized: false
 };

 const request = https.request(requestOptions, (response) => {
 response.pipe(res);

 response.on('end', () => {
 res.end();
 });
 });

 request.on('error', (err) => {
 console.error(`Request error: ${err.message}`);
 res.status(500).send('Internal Server Error');
 });

 request.end();
});
https.globalAgent.options.ca = [certificate];
// Create HTTPS server
const httpsServer = https.createServer(credentials, app);

httpsServer.listen(port, () => {
 console.log(`Server is running at https://localhost:${port}`);
});



I hope for your help and any advice, thanks in advance


-
after restarting the page in the browser, the player stops loading
28 juillet 2024, par UximyI have a problem which is that when I start icecast server on ubuntu and not only on ubuntu but also on windows regardless of the operating system, when I first go to the radio station in icecast2 http://localhost:8000/radio the music plays but after restarting the page in the browser, the player stops loading, I tried the solution with nocache in the browser in the address bar, nothing helps, I looked at many users configs, they did not encounter such problems, I will leave my config below, I also wrote a code on nodejs I will also leave it below, the problem plays the same that if I go to a direct icecast link, what I will do through the node js code + ffmpeg, also about the logs, nothing outputs even a hint of any error that is related to this problem


Config IceCast :


<icecast>
 <location>Earth</location>
 <admin>icemaster@localhost</admin>
 <hostname>localhost</hostname>

 <limits>
 <clients>100</clients>
 <sources>10</sources>
 524288
 60
 30
 10
 1
 65536
 </limits>

 <authentication>
 hackme
 hackme
 admin
 hackme
 </authentication>

 
 <port>8000</port>
 0.0.0.0
 
 
 
 <port>8443</port>
 0.0.0.0
 <ssl>1</ssl>
 

 
 <header value="*"></header>
 <header value="Origin, X-Requested-With, Content-Type, Accept"></header>
 <header value="GET, POST, OPTIONS"></header>
 <header value="no-cache, no-store, must-revalidate"></header>
 <header value="no-cache"></header>
 <header value="0"></header>
 

 
 <mount type="normal">
 /radio
 <password>mypassword</password>
 <public>1</public>
 100
 Anime Vibes
 Anime Vibes
 <genre>various</genre>
 audio/ogg
 65536
 
 
 <header value="*"></header>
 <header value="Origin, X-Requested-With, Content-Type, Accept"></header>
 <header value="GET, POST, OPTIONS"></header>
 <header value="no-cache, no-store, must-revalidate"></header>
 <header value="no-cache"></header>
 <header value="0"></header>
 
 </mount>

 <fileserve>1</fileserve>

 <paths>
 <logdir>/var/log/icecast2</logdir>
 <webroot>/etc/icecast2/web</webroot>
 <adminroot>/etc/icecast2/admin</adminroot>
 
 <alias source="/" destination="/status.xsl"></alias>
 
 /etc/icecast2/cert/icecast.pem
 
 </paths>

 <logging>
 <accesslog>access.log</accesslog>
 <errorlog>error.log</errorlog>
 <playlistlog>playlist.log</playlistlog>
 <loglevel>1</loglevel> 
 <logsize>10000</logsize> 
 <logarchive>1</logarchive>
 </logging>
</icecast>



Code Node.js :


const express = require('express');
const { spawn } = require('child_process');
const path = require('path');
const fs = require('fs');
const https = require('https');
const app = express();
const port = 3000;

const privateKey = fs.readFileSync('./cert/privateKey.key', 'utf8');
const certificate = fs.readFileSync('./cert/certificate.crt', 'utf8');

const credentials = {
 key: privateKey,
 cert: certificate
};

app.use(express.static(path.join(__dirname)));

// Check if playlist file exists
const playlistPath = path.join(__dirname, 'playlist.txt');
if (!fs.existsSync(playlistPath)) {
 console.error('Playlist file does not exist');
 process.exit(1);
}

console.log(`Playlist path: ${playlistPath}`);

// Start FFmpeg process to create continuous stream from playlist
const ffmpegProcess = spawn('ffmpeg', [
 '-re',
 '-f', 'concat',
 '-safe', '0',
 '-protocol_whitelist', 'file,http,https,tcp,tls',
 '-i', playlistPath,
 '-c:a', 'libvorbis',
 '-f', 'ogg',
 '-tls', '1',
 'icecast://source:mypassword@localhost:8443/radio'
]);

ffmpegProcess.stdout.on('data', (data) => {
 console.log(`FFmpeg stdout: ${data}`);
});

ffmpegProcess.stderr.on('data', (data) => {
 console.error(`FFmpeg stderr: ${data}`);
});

ffmpegProcess.on('close', (code) => {
 console.log(`FFmpeg process exited with code ${code}`);
});

app.get('/radio', (req, res) => {
 res.setHeader('Content-Type', 'audio/ogg');
 res.setHeader('Transfer-Encoding', 'chunked');

 const requestOptions = {
 hostname: 'localhost',
 port: 8443,
 path: '/radio',
 method: 'GET',
 headers: {
 'Accept': 'audio/ogg'
 },
 rejectUnauthorized: false
 };

 const request = https.request(requestOptions, (response) => {
 response.pipe(res);

 response.on('end', () => {
 res.end();
 });
 });

 request.on('error', (err) => {
 console.error(`Request error: ${err.message}`);
 res.status(500).send('Internal Server Error');
 });

 request.end();
});
https.globalAgent.options.ca = [certificate];
// Create HTTPS server
const httpsServer = https.createServer(credentials, app);

httpsServer.listen(port, () => {
 console.log(`Server is running at https://localhost:${port}`);
});



I hope for your help and any advice, thanks in advance


-
How to broadcast a video stream without reloading the page ?
16 novembre 2024, par promo 69I created a Node.js server to :


- 

- Receive images in udp and transform them into video and
- Display it on a website
- I tried but I don't understand how to broadcast the video live without having to reload the page








Node.js server code :


const express = require('express');
const dgram = require('dgram');
const fs = require('fs');
const ffmpeg = require('fluent-ffmpeg');
const path = require('path');
const WebSocket = require('ws');

const app = express();
const httpPort = 3000;

const imageDir = path.join(__dirname, 'images');
if (!fs.existsSync(imageDir)) {
 fs.mkdirSync(imageDir);
}

let imageCount = 0;

const udpPort = 15002;
const udpHost = '127.0.0.1';
const server = dgram.createSocket('udp4');

const wss = new WebSocket.Server({ noServer: true });


const createVideo = () => {
 const outputVideo = path.join(__dirname, 'output_video.mp4');

 ffmpeg()
 .input(path.join(imageDir, '%d.jpg'))
 .inputOptions('-framerate 30')
 .output(outputVideo)
 .outputOptions('-c:v libx264')
 .on('end', () => {
 console.log('Vidéo créée avec succès !');

 wss.clients.forEach(client => {
 if (client.readyState === WebSocket.OPEN) {
 client.send('new-video');
 }
 });
 })
 .on('error', (err) => {
 console.log('Erreur lors de la création de la vidéo:', err);
 })
 .run();
};


app.get('/feed-video', (req, res) => {
 const videoPath = path.join(__dirname, 'output_video.mp4');
 res.sendFile(videoPath);
});

server.on('message', (msg, rinfo) => {
 console.log(`Reçu message de ${rinfo.address}:${rinfo.port}`);

 const imageFilePath = path.join(imageDir, `${imageCount}.jpg`);
 fs.writeFileSync(imageFilePath, msg);

 console.log(`Image ${imageCount}.jpg reçue et sauvegardée`);


 imageCount++;


 if (imageCount > 100) {
 createVideo();
 imageCount = 0;
 }
});


server.on('listening', () => {
 const address = server.address();
 console.log(`Serveur UDP en écoute sur ${address.address}:${address.port}`);
});


app.server = app.listen(httpPort, () => {
 console.log(`Serveur HTTP et WebSocket démarré sur http://localhost:${httpPort}`);
});

app.server.on('upgrade', (request, socket, head) => {
 wss.handleUpgrade(request, socket, head, (ws) => {
 wss.emit('connection', ws, request);
 });
});


server.bind(udpPort, udpHost);




The html page :





 
 
 
 


<h1>Drone Video Feed</h1>
<video controls="controls" autoplay="autoplay"></video>

<code class="echappe-js"><script>&#xA; const video = document.getElementById(&#x27;video&#x27;);&#xA; const ws = new WebSocket(&#x27;ws://localhost:3000&#x27;);&#xA;&#xA; ws.onmessage = (event) => {&#xA; const blob = new Blob([event.data], { type: &#x27;video/mp4&#x27; });&#xA; video.src = URL.createObjectURL(blob);&#xA; video.play();&#xA; };&#xA;</script>






I tried with websocket but I didn't succeed.
The video is correctly created and when I reload the page the new video is played by the player.


However I would have been able to see the live stream without having to reload my page all the time.