
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (92)
-
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 (...) -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
-
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.
Sur d’autres sites (3935)
-
Concatenate mkv files keeping original timestmap with gaps
13 août 2020, par Filip16 days ago I had this problem : Concatenating mka files but keeping timestamp which I fixed by using amix, a delay by using
start_pts
from ffprobe.

Today I have a new challenge like this, but with video.


So I have a bunch of mkv videos. Each time a person joins a chat, a mkv is recorded, but if the person refreshes the page a new mkv is created with start_pts and start_time to what it actually is. Also if the meeting started and a person joins after a minute, the start_time is set to 1 minute. I need to merge all those mkv and pad them with blank screen when there is no feed.


Like in the above example, if a person joins after a minute, the first minute is a blank screen. Also if the participant leaves and re-joins after 10 seconds, those 10 seconds are blank again.


Any ideas on how to do that with ffmpeg ?


Concrete example of files :


0PA84c5c3f412769b311d44b159941b2d22.mkv - start_pts: 742 start_time: 0.742000
2PA73d94e8cb0f41c3002fadd6c04b4a88f.mkv - start_pts: 30761 start_time: 30.761000
3PAcd35e470325618fa8a3fb8bb5a41403e.mkv - start_pts: 50940 start_time: 50.940000
4PAddccde7b8847ecc43d5e8643b7903dba.mkv - start_pts: 69243 start_time: 69.243000



The end file would result in a file with length 69.243000, first 0.742 seconds are blank and also the gaps between should also be blank.


So far i've tried :


ffmpeg -i 0PA84c5c3f412769b311d44b159941b2d22.mkv -i 2PA73d94e8cb0f41c3002fadd6c04b4a88f.mkv -i 3PAcd35e470325618fa8a3fb8bb5a41403e.mkv -i 4PAddccde7b8847ecc43d5e8643b7903dba.mkv -filter_complex "[0:v] [1:v] [2:v] [3:v] concat=n=4:v=1 [v]" -map "[v]" test.mkv


This works but without those gaps i mentioned.


-
FFmpeg Error : Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_amix_54
25 mai 2024, par Josh LawsonI'm working on a project to generate a click track using React.js and FFmpeg. The project includes an Express.js backend where I construct an FFmpeg command to combine multiple audio files (count-ins, vocal cues, and click sounds) into a single track. The final output should be an MP3 file.


However, I'm encountering an error when running the FFmpeg command :


Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_amix_54



How can I correctly construct the FFmpeg command to avoid the "Cannot find a matching stream for unlabeled input pad" error and ensure all inputs are properly processed and mixed ?


Here is the relevant part of my server.js code :


const express = require('express');
const bodyParser = require('body-parser');
const { exec } = require('child_process');
const path = require('path');
const fs = require('fs');
const ffmpegPath = require('ffmpeg-static');
const cors = require('cors');

const app = express();
app.use(cors());
app.use(bodyParser.json());

app.post('/generate-click-track', (req, res) => {
 const { tempo, timeSignature, clickSound, subdivisions, sections } = req.body;
 const clickSoundPath = path.join(__dirname, 'public', 'click-sounds');
 const vocalCuesPath = path.join(__dirname, 'public', 'vocal-cues');

 const beatsPerBar = parseInt(timeSignature.split('/')[0]);
 const beatsPerMinute = tempo;
 let totalBeats = 0;
 const sectionStarts = [];

 sections.forEach((section, index) => {
 if (index > 0) {
 sectionStarts.push(totalBeats);
 }
 totalBeats += section.length * beatsPerBar;
 });

 const outputFilePath = path.join(__dirname, 'output', 'click-track.mp3');
 const tempDir = path.join(__dirname, 'temp');

 if (!fs.existsSync(tempDir)) {
 fs.mkdirSync(tempDir);
 }

 const countInFiles = Array.from({ length: beatsPerBar }, (_, i) => path.join(vocalCuesPath, 'count-ins', `${i + 1}.wav`));

 let ffmpegCommand = '';

 // Add count-in files
 countInFiles.forEach(file => {
 ffmpegCommand += `-i "${file}" `;
 });

 // Add section vocal cues and click sounds
 sections.forEach((section, index) => {
 const vocalCueFile = path.join(vocalCuesPath, `${section.name}.wav`);
 ffmpegCommand += `-i "${vocalCueFile}" `;

 for (let i = 0; i < section.length * beatsPerBar; i++) {
 const clickFile = i % beatsPerBar === 0 ? `${clickSound}-accents.mp3` : `${clickSound}.mp3`;
 ffmpegCommand += `-i "${path.join(clickSoundPath, clickFile)}" `;
 }
 });

 ffmpegCommand += `-filter_complex "`;

 let inputCount = 0;
 countInFiles.forEach((_, index) => {
 ffmpegCommand += `[${inputCount}:0]adelay=${index * (60 / beatsPerMinute) * 1000}|${index * (60 / beatsPerMinute) * 1000}[a${inputCount}]; `;
 inputCount++;
 });

 sections.forEach((section, index) => {
 const delay = (sectionStarts[index] ? sectionStarts[index] : 0) * (60 / beatsPerMinute) * 1000;
 ffmpegCommand += `[${inputCount}:0]adelay=${delay}|${delay}[a${inputCount}]; `;
 inputCount++;

 for (let i = 0; i < section.length * beatsPerBar; i++) {
 const delay = (sectionStarts[index] ? sectionStarts[index] : 0) * (60 / beatsPerMinute) * 1000 + (i * 60 / beatsPerMinute) * 1000;
 ffmpegCommand += `[${inputCount}:0]adelay=${delay}|${delay}[a${inputCount}]; `;
 inputCount++;
 }
 });

 ffmpegCommand += `amix=inputs=${inputCount}:duration=longest" -codec:a libmp3lame -b:a 192k -y "${outputFilePath}"`;

 console.log(`Executing ffmpeg command: ${ffmpegCommand}`);

 exec(`${ffmpegPath} ${ffmpegCommand}`, (error, stdout, stderr) => {
 if (error) {
 console.error(`Error generating click track: ${error.message}`);
 res.status(500).send('Error generating click track');
 return;
 }

 res.download(outputFilePath, 'click-track.mp3', (err) => {
 if (err) {
 console.error(`Error sending file: ${err.message}`);
 }

 // Clean up temp directory
 fs.readdir(tempDir, (err, files) => {
 if (err) throw err;
 for (const file of files) {
 fs.unlink(path.join(tempDir, file), err => {
 if (err) throw err;
 });
 }
 });
 });
 });
});

app.listen(3001, () => {
 console.log('Server running on http://localhost:3001');
});



I can't include the full error messge as it is too long, but if anyone needs it, I'm happy to link to a text file that includes it.


What I have tried :


- 

- Verified all file paths and ensured they exist.
- Escaped file paths to handle spaces in filenames.
- Logged the constructed FFmpeg command and ran it manually, which still produced the same error.








Environment


- 

- React.js : v18.3.1
- Node.js : v22.2.0
- Express : v4.19.2
- FFmpeg : static build via ffmpeg-static (v5.2.0)










-
Precise method of segmenting & transcoding video+audio (via ffmpeg), into an on-demand HLS stream ?
17 novembre 2019, par Felixrecently I’ve been messing around with FFMPEG and streams through Nodejs. My ultimate goal is to serve a transcoded video stream - from any input filetype - via HTTP, generated in real-time as it’s needed in segments.
I’m currently attempting to handle this using HLS. I pre-generate a dummy m3u8 manifest using the known duration of the input video. It contains a bunch of URLs that point to individual constant-duration segments. Then, once the client player starts requesting the individual URLs, I use the requested path to determine which time range of video the client needs. Then I transcode the video and stream that segment back to them.
Now for the problem : This approach mostly works, but has a small audio bug. Currently, with most test input files, my code produces a video that - while playable - seems to have a very small (< .25 second) audio skip at the start of each segment.
I think this may be an issue with splitting using time in ffmpeg, where possibly the audio stream cannot be accurately sliced at the exact frame the video is. So far, I’ve been unable to figure out a solution to this problem.
If anybody has any direction they can steer me - or even a prexisting library/server that solves this use-case - I appreciate the guidance. My knowledge of video encoding is fairly limited.
I’ll include an example of my relevant current code below, so others can see where I’m stuck. You should be able to run this as a Nodejs Express server, then point any HLS player at localhost:8080/master to load the manifest and begin playback. See the
transcode.get('/segment/:seg.ts'
line at the end, for the relevant transcoding bit.'use strict';
const express = require('express');
const ffmpeg = require('fluent-ffmpeg');
let PORT = 8080;
let HOST = 'localhost';
const transcode = express();
/*
* This file demonstrates an Express-based server, which transcodes & streams a video file.
* All transcoding is handled in memory, in chunks, as needed by the player.
*
* It works by generating a fake manifest file for an HLS stream, at the endpoint "/m3u8".
* This manifest contains links to each "segment" video clip, which browser-side HLS players will load as-needed.
*
* The "/segment/:seg.ts" endpoint is the request destination for each clip,
* and uses FFMpeg to generate each segment on-the-fly, based off which segment is requested.
*/
const pathToMovie = 'C:\\input-file.mp4'; // The input file to stream as HLS.
const segmentDur = 5; // Controls the duration (in seconds) that the file will be chopped into.
const getMetadata = async(file) => {
return new Promise( resolve => {
ffmpeg.ffprobe(file, function(err, metadata) {
console.log(metadata);
resolve(metadata);
});
});
};
// Generate a "master" m3u8 file, which the player should point to:
transcode.get('/master', async(req, res) => {
res.set({"Content-Disposition":"attachment; filename=\"m3u8.m3u8\""});
res.send(`#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=150000
/m3u8?num=1
#EXT-X-STREAM-INF:BANDWIDTH=240000
/m3u8?num=2`)
});
// Generate an m3u8 file to emulate a premade video manifest. Guesses segments based off duration.
transcode.get('/m3u8', async(req, res) => {
let met = await getMetadata(pathToMovie);
let duration = met.format.duration;
let out = '#EXTM3U\n' +
'#EXT-X-VERSION:3\n' +
`#EXT-X-TARGETDURATION:${segmentDur}\n` +
'#EXT-X-MEDIA-SEQUENCE:0\n' +
'#EXT-X-PLAYLIST-TYPE:VOD\n';
let splits = Math.max(duration / segmentDur);
for(let i=0; i< splits; i++){
out += `#EXTINF:${segmentDur},\n/segment/${i}.ts\n`;
}
out+='#EXT-X-ENDLIST\n';
res.set({"Content-Disposition":"attachment; filename=\"m3u8.m3u8\""});
res.send(out);
});
// Transcode the input video file into segments, using the given segment number as time offset:
transcode.get('/segment/:seg.ts', async(req, res) => {
const segment = req.params.seg;
const time = segment * segmentDur;
let proc = new ffmpeg({source: pathToMovie})
.seekInput(time)
.duration(segmentDur)
.outputOptions('-preset faster')
.outputOptions('-g 50')
.outputOptions('-profile:v main')
.withAudioCodec('aac')
.outputOptions('-ar 48000')
.withAudioBitrate('155k')
.withVideoBitrate('1000k')
.outputOptions('-c:v h264')
.outputOptions(`-output_ts_offset ${time}`)
.format('mpegts')
.on('error', function(err, st, ste) {
console.log('an error happened:', err, st, ste);
}).on('progress', function(progress) {
console.log(progress);
})
.pipe(res, {end: true});
});
transcode.listen(PORT, HOST);
console.log(`Running on http://${HOST}:${PORT}`);