
Recherche avancée
Autres articles (60)
-
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...) -
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)
Sur d’autres sites (14530)
-
Adding FFMPEG Layer to HLS streaming causes video playback issues
25 juin 2023, par MoeI have been searching a lot about HLS streaming and have succeeded to create a simple HLS streaming server with nodejs, the problem now is I need to add a layer of ffmpeg encoding to the .ts chunks before streaming to the user, without this layer everything works fine and on my server only 3 requests are seen :


manifest.m3u8
output_000.ts
output_000.ts
output_001.ts
output_002.ts



But then when I add a simple ffmpeg layer that literally copies everything from the ts file and output the stream (I will add of course dynamic filters to each request, thats why I need this ffmpeg layer), the player goes insane and request the whole video in just 5 seconds or something :


manifest.m3u8
output_000.ts
output_000.ts
output_001.ts
output_002.ts
output_001.ts
output_003.ts
output_002.ts
...
output_095.ts



I have also notices that the numbers aren't increasing uniformly and suspect this is part of the issue, I have tried adding more ffmpeg options to not do anything to the .ts files that are being fed to it as they are a part of a bigger video.


Here's my NodeJS server (NextJS API route) :



const fs = require(`fs`);
const path = require(`path`);
const {exec, spawn} = require(`child_process`);
const pathToFfmpeg = require(`ffmpeg-static`);

export default function handler(req, res) {
 
 const { filename } = req.query;
 console.log(filename);
 const filePath = path.join(process.cwd(), 'public', 'stream', `${filename}`);
 const inputStream = fs.createReadStream(filePath);

 // first check if that is ts file..
 if(filename.indexOf(`.ts`) != -1){
 
 const ffmpegProcess = spawn(pathToFfmpeg, [
 '-f', `mpegts`,
 '-i', 'pipe:0', // specify input as pipe
 '-c', 'copy', 
 '-avoid_negative_ts', '0',
 `-map_metadata`, `0`, // copy without re-encoding
 '-f', 'mpegts', // output format
 'pipe:1' // specify output as pipe
 ], {
 stdio: ['pipe', 'pipe', 'pipe'] // enable logging by redirecting stderr to stdout
 });
 res.status(200);
 res.setHeader('Content-Type', 'application/vnd.apple.mpegurl');
 res.setHeader('Cache-Control', 'no-cache');
 res.setHeader('Access-Control-Allow-Origin', '*');
 

 // ffmpegProcess.stderr.pipe(process.stdout); // log stderr to stdout
 
 inputStream.pipe(ffmpegProcess.stdin);
 ffmpegProcess.stdout.pipe(res);
 
 ffmpegProcess.on('exit', (code) => {
 if (code !== 0) {
 console.error(`ffmpeg process exited with code ${code}`);
 }
 });
 }else{
 // if not then stream whatever file as it is
 res.status(200);
 res.setHeader('Content-Type', 'application/vnd.apple.mpegurl');
 inputStream.pipe(res);
 }
 }



I have tried to feed the request's player appropriate headers but that didn't work, I have also tried to add the '-re' option to the ffmpeg encoder itself and hoped for minimal performance hits, but that also caused playback issue due to being too slow.


-
FFmpeg image2pipe write buffer wait until done
20 décembre 2020, par Michael Joseph AubryI'm extracting frames from an external source and passing it in as a buffer to FFMPEG using
image2pipe
and-i -


const childProcess = spawn(ffmpeg, [
 "-y",
 "-f",
 "image2pipe",
 "-i",
 "-",
 "-vcodec",
 "libx264",
 "-pix_fmt",
 "yuv420p",
 output
]);



Then I have a loop that does the job.


for (let i = 0; i < 250; i++) {
 // ...await
}



Inside the promise


// ... do the job to get buffer

childProcess.stdin.write(frame); // frame === buffer

// frame done
resolve("success!");



The problem is in some videos the frames jump and is janky. This is because FFmpeg is not fully done writing to the file before moving onto the next frame.


Is there a way to write a buffer to a file through FFmpeg and make sure the frame is done writing before moving on ?


Some more information


Here is the source file https://s3.us-west-2.amazonaws.com/storycreator.v2.uploads/ckigi4kro00160vlfjmt74afp


Here is the rendered file https://s3.us-west-2.amazonaws.com/storycreator.testing/607715f0-3ab9-11eb-a139-3bb84618c6c5.mp4?t=1607585343922


Here are logs


2020-12-10T07:28:48.942Z 0ae0c435-54d3-416f-9d1a-8ddf595a7e83 INFO frame= 130 fps= 16 q=-1.0 Lsize= 83kB time=00:00:05.08 bitrate= 133.6kbits/s speed=0.641x video:80kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.928688%



2020-12-10T07:28:48.942Z 0ae0c435-54d3-416f-9d1a-8ddf595a7e83 INFO [libx264 @ 0x640d6c0] frame I:1 Avg QP:15.47 size: 68227[libx264 @ 0x640d6c0] frame P:33 Avg QP:15.07 size: 246[libx264 @ 0x640d6c0] frame B:96 Avg QP:18.75 size: 56[libx264 @ 0x640d6c0] consecutive B-frames: 1.5% 0.0% 0.0% 98.5%



2020-12-10T07:28:48.943Z 0ae0c435-54d3-416f-9d1a-8ddf595a7e83 INFO [libx264 @ 0x640d6c0] mb I I16..4: 24.6% 60.5% 14.9%[libx264 @ 0x640d6c0] mb P I16..4: 0.0% 0.2% 0.0% P16..4: 0.8% 0.0% 0.0% 0.0% 0.0% skip:98.9%[libx264 @ 0x640d6c0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.3% 0.0% 0.0% direct: 0.0% skip:99.7% L0:26.7% L1:73.3% BI: 0.0%[libx264 @ 0x640d6c0] 8x8 transform intra:62.0% inter:83.6%[libx264 @ 0x640d6c0] coded y,uvDC,uvAC intra: 49.2% 44.3% 32.1% inter: 0.0% 0.2% 0.0%[libx264 @ 0x640d6c0] i16 v,h,dc,p: 53% 38% 7% 2%[libx264 @ 0x640d6c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 24% 29% 3% 3% 3% 5% 3% 4%[libx264 @ 0x640d6c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 26% 14% 3% 4% 5% 4% 4% 3%[libx264 @ 0x640d6c0] i8c dc,h,v,p: 57% 27% 13% 3%[libx264 @ 0x640d6c0] Weighted P-Frames: Y:0.0% UV:0.0%[libx264 @ 0x640d6c0] ref P L0: 95.1% 1.2% 3.1% 0.6%[libx264 @ 0x640d6c0] ref B L0: 48.1% 51.3% 0.7%[libx264 @ 0x640d6c0] ref B L1: 97.3% 2.7%[libx264 @ 0x640d6c0] kb/s:125.75



2020-12-10T07:28:48.944Z 0ae0c435-54d3-416f-9d1a-8ddf595a7e83 INFO [cache @ 0x5f57940] Statistics, cache hits:0 cache misses:3551



-
How to detetc hardware acceleration in ffmpeg
19 décembre 2020, par Ali RazmkhahI am writing c++ program to screen record by ffmpeg 4.3 ! I need to detect hardware acceleration support such as h264_qsv or h264_nvenc without running ffmpeg.exe !


I explored ffmpeg.exe source code and found no results ! some solutions are deprecated or dose not work on 4.3 !
As instance,


avcodec_find_encoder_by_name("h264_qsv")



returns null even it is exist and works properly !