
Recherche avancée
Autres articles (106)
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
Sélection de projets utilisant MediaSPIP
29 avril 2011, parLes exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
Ferme MediaSPIP @ Infini
L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)
Sur d’autres sites (6329)
-
How to maximize ffmpeg crop and overlay thousand block in same time ?
22 juin 2022, par yuno sagaI try to encrypt a frame of video to random of 16x16 block. so the result will be like artifact video. but exactly it can be decode back. only the creation that know the decode algorithm. but my problem is ffmpeg encode so slow. 3 minutes video, 854x480 (480p) https://www.youtube.com/watch?v=dyRsYk0LyA8. this example result frame that have been filter https://i.ibb.co/0nvLzkK/output-9.jpg. each frame have 1589 block. how to speed up this things ? 3 minutes only 24 frame done. the vido have 5000 thousand frame, so for 3 minutes video it takes 10 hours. i dont know why ffmpeg only take my cpu usage 25%.


const { spawn } = require('child_process');
const fs = require('fs');

function shuffle(array) {
 let currentIndex = array.length, randomIndex;
 
 // While there remain elements to shuffle.
 while (currentIndex != 0) {
 
 // Pick a remaining element.
 randomIndex = Math.floor(Math.random() * currentIndex);
 currentIndex--;
 
 // And swap it with the current element.
 [array[currentIndex], array[randomIndex]] = [
 array[randomIndex], array[currentIndex]];
 }
 
 return array;
 }

function filter(width, height) {
 const sizeBlock = 16;
 let filterCommands = '';
 let totalBlock = 0;
 const widthLengthBlock = Math.floor(width / sizeBlock);
 const heightLengthBlock = Math.floor(height / sizeBlock);
 let info = [];

 for (let i=0; i < widthLengthBlock; i++) {
 for (let j=0; j < heightLengthBlock; j++) {
 const xPos = i*sizeBlock;
 const yPos = j*sizeBlock;
 filterCommands += `[0]crop=${sizeBlock}:${sizeBlock}:${(xPos)}:${(yPos)}[c${totalBlock}];`;

 info.push({
 id: totalBlock,
 x: xPos,
 y: yPos
 });

 totalBlock += 1;
 } 
 }

 info = shuffle(info);

 for (let i=0; i < info.length; i++) {
 if (i == 0) filterCommands += '[0]';
 if (i != 0) filterCommands += `[o${i}]`;

 filterCommands += `[c${i}]overlay=x=${info[i].x}:y=${info[i].y}`;

 if (i != (info.length - 1)) filterCommands += `[o${i+1}];`; 
 }

 return filterCommands;
}

const query = filter(854, 480);

fs.writeFileSync('filter.txt', query);

const task = spawn('ffmpeg', [
 '-i',
 'C:\\Software Development\\ffmpeg\\blackpink.mp4',
 '-filter_complex_script',
 'C:\\Software Development\\project\\filter.txt',
 '-c:v',
 'libx264',
 '-preset',
 'ultrafast',
 '-pix_fmt',
 'yuv420p',
 '-c:a',
 'libopus',
 '-progress',
 '-',
 'output.mp4',
 '-y'
], {
 cwd: 'C:\\Software Development\\ffmpeg'
});

task.stdout.on('data', data => { 
 console.log(data.toString())
})



-
FFMPEG : Cannot read properties of undefined (reading 'format')
1er avril 2023, par DonnybI am currently to convert a video file to produce a thumbnail through ffmpeg, react-dropzone, and express. However I keep getting a error of "Cannot read properties of undefined (reading 'format')" in my console. For some reason it can not read the "metadata.format.duration" in my program, I have checked if ffmpeg is properly installed by running the ffmpeg —version in my console, and I get all the details, along with ffprobe —version as well.


Here is my code :
upload.js


router.post("/thumbnail", (req, res) => {
 let thumbsFilePath ="";
 let fileDuration ="";

 // req.body.filepath
 ffmpeg.ffprobe(req.body.filepath, function(err, metadata){
 console.dir(metadata);
 console.log(metadata.format.duration);

 fileDuration = metadata.format.duration;
 })

 ffmpeg(req.body.filepath) //req.body.filepath
 .on('filenames', function (filenames) {
 console.log('Will generate ' + filenames.join(', '))
 console.log(filenames);
 thumbsFilePath = "./uploads/thumbnails/" + filenames[0];
 
 })
 .on('end', function () {
 console.log('Screenshots taken');
 return res.json({ success: true, thumbsFilePath: thumbsFilePath, fileDuration: fileDuration})
 })
 .screenshots({
 // Will take screens at 20%, 40%, 60% and 80% of the video
 count: 3,
 folder: './uploads/thumbnails',
 size:'320x240',
 // %b input basename ( filename w/o extension )
 filename:'thumbnail-%b.png'
 });
})



FrontEnd drop code :
AddVideo.js


const onDrop = (files) => {

 let formData = new FormData();
 const config = {
 header: { 'content-type': 'multipart/form-data' }
 }
 console.log(files)
 formData.append("file", files[0])

 axios.post('http://localhost:5000/api/upload/uploadfiles', formData, config)
 .then(response => {
 if (response.data.success) {

 let variable = {
 filePath: response.data.filePath,
 fileName: response.data.fileName
 }
 setFilePath(response.data.filePath)

 //gerenate thumbnail with this filepath ! 

 axios.post('http://localhost:5000/api/upload/thumbnail', variable)
 .then(response => {
 if (response.data.success) {
 setDuration(response.data.fileDuration)
 setThumbnail(response.data.thumbsFilePath)
 } else {
 alert('Failed to make the thumbnails');
 }
 })


 } else {
 alert('failed to save the video in server')
 }
 })

 }

 return (
 <div style="{{">
 <div style="{{">
 {/* */}
 </div>

 <formcontrol>
 <div style="{{">
 
 {({ getRootProps, getInputProps }) => (
 <div style="{{" solid="solid">
 <input />
 <icon type="plus" style="{{"></icon>

 </div>
 )}
 
 </div>
 </formcontrol>
 </div>
 )
}



The video I am trying to upload is a mp4 file. I am using fluent-ffmpeg as a dependency.


-
av_interleaved_write_frame() : Cannot allocate memory, Error writing trailer of udp
30 août 2022, par Technical_Union7716I'm transcoding from udp input to mpegts udp output. After several hours ffmpeg used all ram memory. I don't know where the problem is.


Command :


ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i "udp://239.100.1.5:1234?fifo_size=1000000&overrun_nonfatal=1" -map i:0x100 -map i:0x101 -vf 'scale_vaapi=w=720:h=576,hwdownload,format=nv12,fps=25' -c:v mpeg2video -b:v 5000k -minrate 5000k -maxrate 5000k -muxrate 7000k -pcr_period 40 -flags:v +ildct+ilme -top 0 -aspect 16:9 -c:a mp2 -b:a 192k -c:s copy -mpegts_service_id 1 -metadata service_name="Transcoded" -metadata service_provider="HD to SD" -f mpegts "udp://239.120.1.2:7006?pkt_size=1316&bitrate=12000000"



Logs :


Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, bt709, bottom first), 720x576 [SAR 64:45 DAR 16:9], q=2-31, 5000 kb/s, 25 fps, 90k tbn2022-08-23 13:27:04,291



Metadata :


encoder : Lavc59.39.100 mpeg2video



Side data :


cpb: bitrate max/min/avg: 5000000/5000000/5000000 buffer size: 1835008 vbv_delay: N/A
Stream #0:1(und): Audio: mp2, 44100 Hz, stereo, s16, 192 kb/s



Metadata :


encoder : Lavc59.39.100 mp2
2022-08-24 04:08:47,884 av_interleaved_write_frame(): Cannot allocate memory41:02.67 bitrate=7000.0kbits/s speed=0.999x
2022-08-24 04:08:47,893 Last message repeated 1 times
2022-08-24 04:08:47,897 Error writing trailer of udp://239.120.1.2:7006?pkt_size=1316&bitrate=12000000: Cannot allocate memory
2022-08-24 04:08:47,898 frame=1321595 fps= 25 q=2.0 Lsize=45171938kB time=14:41:04.20 bitrate=7000.0kbits/s speed=0.999x
video:32265447kB audio:1239612kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 34.821243%
2022-08-24 04:08:51,469 Error closing file udp://239.120.1.2:7006?pkt_size=1316&bitrate=12000000: Cannot allocate memory
2022-08-24 04:08:51,750 Conversion failed!



Any ideas ?