
Recherche avancée
Autres articles (29)
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Possibilité de déploiement en ferme
12 avril 2011, parMediaSPIP peut être installé comme une ferme, avec un seul "noyau" hébergé sur un serveur dédié et utilisé par une multitude de sites différents.
Cela permet, par exemple : de pouvoir partager les frais de mise en œuvre entre plusieurs projets / individus ; de pouvoir déployer rapidement une multitude de sites uniques ; d’éviter d’avoir à mettre l’ensemble des créations dans un fourre-tout numérique comme c’est le cas pour les grandes plate-formes tout public disséminées sur le (...)
Sur d’autres sites (3882)
-
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


-
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


-
How to create video using avcodec from jpeg images of type OpenCV::Mat ?
23 juillet 2015, par theateistI have colored jpeg images of
OpenCV::Mat
type and I create from them video usingavcodec
. The video that I get is upside-down, black & white and each row of each frame is shifted and I got diagonal line. What could be the reason for such output ?
Follow this link to watch the video I get using avcodec.
I’m usingacpicture_fill
function to createavFrame
fromcv::Mat
frame !P.S.
Each cv::Mat cvFrame has width=810, height=610, step=2432
I noticed that avFrame (that is filled by acpicture_fill) haslinesize[0]=2430
I tried manually settingavFrame->linesizep0]=2432
and not 2430 but it still didn’t helped.======== CODE =========================================================
AVCodec *encoder = avcodec_find_encoder(AV_CODEC_ID_H264);
AVStream *outStream = avformat_new_stream(outContainer, encoder);
avcodec_get_context_defaults3(outStream->codec, encoder);
outStream->codec->pix_fmt = AV_PIX_FMT_YUV420P;
outStream->codec->width = 810;
outStream->codec->height = 610;
//...
SwsContext *swsCtx = sws_getContext(outStream->codec->width, outStream->codec->height, PIX_FMT_RGB24,
outStream->codec->width, outStream->codec->height, outStream->codec->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL);
for (uint i=0; i < frameNums; i++)
{
// get frame at location I using OpenCV
cv::Mat cvFrame;
myReader.getFrame(cvFrame, i);
cv::Size frameSize = cvFrame.size();
//Each cv::Mat cvFrame has width=810, height=610, step=2432
1. // create AVPicture from cv::Mat frame
2. avpicture_fill((AVPicture*)avFrame, cvFrame.data, PIX_FMT_RGB24, outStream->codec->width, outStream->codec->height);
3avFrame->width = frameSize.width;
4. avFrame->height = frameSize.height;
// rescale to outStream format
sws_scale(swsCtx, avFrame->data, avFrame->linesize, 0, outStream->codec->height, avFrameRescaledFrame->data, avFrameRescaledFrame ->linesize);
encoderRescaledFrame->pts=i;
avFrameRescaledFrame->width = frameSize.width;
avFrameRescaledFrame->height = frameSize.height;
av_init_packet(&avEncodedPacket);
avEncodedPacket.data = NULL;
avEncodedPacket.size = 0;
// encode rescaled frame
if(avcodec_encode_video2(outStream->codec, &avEncodedPacket, avFrameRescaledFrame, &got_frame) < 0) exit(1);
if(got_frame)
{
if (avEncodedPacket.pts != AV_NOPTS_VALUE)
avEncodedPacket.pts = av_rescale_q(avEncodedPacket.pts, outStream->codec->time_base, outStream->time_base);
if (avEncodedPacket.dts != AV_NOPTS_VALUE)
avEncodedPacket.dts = av_rescale_q(avEncodedPacket.dts, outStream->codec->time_base, outStream->time_base);
// outContainer is "mp4"
av_write_frame(outContainer, & avEncodedPacket);
av_free_packet(&encodedPacket);
}
}UPDATED
As @Alex suggested I changed the lines 1-4 with the code below
int width = frameSize.width, height = frameSize.height;
avpicture_alloc((AVPicture*)avFrame, AV_PIX_FMT_RGB24, outStream->codec->width, outStream->codec->height);
for (int h = 0; h < height; h++)
{
memcpy(&(avFrame->data[0][h*avFrame->linesize[0]]), &(cvFrame.data[h*cvFrame.step]), width*3);
}The video (here) I get now is almost perfect. It’s NOT upside-down, NOT black & white, BUT it seems that one of the RGB components is missing. Every brown/red colors became blue (in original images it should be vice-verse).
What could be the problem ? Could rescaling(sws_scale
) toAV_PIX_FMT_YUV420P
format causes this ?