Recherche avancée

Médias (1)

Mot : - Tags -/lev manovitch

Autres articles (16)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Les thèmes de MediaSpip

    4 juin 2013

    3 thèmes sont proposés à l’origine par MédiaSPIP. L’utilisateur MédiaSPIP peut rajouter des thèmes selon ses besoins.
    Thèmes MediaSPIP
    3 thèmes ont été développés au départ pour MediaSPIP : * SPIPeo : thème par défaut de MédiaSPIP. Il met en avant la présentation du site et les documents média les plus récents ( le type de tri peut être modifié - titre, popularité, date) . * Arscenic : il s’agit du thème utilisé sur le site officiel du projet, constitué notamment d’un bandeau rouge en début de page. La structure (...)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

Sur d’autres sites (6835)

  • Ffmpeg http slow Startup Delay

    16 mars 2018, par Jan

    I need a http stream output with very fast start up Delay (100ms) And Constant Traffic. And I only want to use the http stream with vlc... so not for Browser usage. My input stream has a Bitrate 3-4mbit. With hls I get the 100ms switching time but not constant traffic. I already have traffic eruption... in one second high traffic and then nothing. But I need a constant output.

    So I tried it with nodejs and ffmpeg fluent but the starting time is not so good(Not so fast like hls)

    This is my

    // How to Use
    // 1. Create package.json with `npm init`
    // 2. Install dependencies with `npm i fluent-ffmpeg express`
    // 3. Start with `node ffmpegToWeb.js`
    // 4. Open VLC and "Open Network Stream".
    // 5. Input the following without quotes : `http://127.0.0.1:8001` and start.

    const ffmpeg = require('fluent-ffmpeg')
    const config = {
     port: 8001,
     url: 'url here'
    }

    let ffmpegObj = ffmpeg(config.url)
     .videoCodec('copy')
     .audioCodec('copy')
     .outputOptions([
       '-y',
       '-ac 2',
       '-sn',
       '-f mpegts'
     ])
     .inputOptions([
       '-re',
       '-nostdin',
       '-hide_banner',
       '-probesize 5000000',
       '-analyzeduration 15000000'
     ])
     .on('start', function (commandLine) {
       console.log('Starting ffmpeg with command: ' + commandLine)
     })
     .on('error', (err) => {
       console.log('ffmpeg error', err)
     })
     .on('end', () => {
       console.log('ffmpeg end')
     })
     .on('progress', (stats) => {
       // console.log(stats)
     })
    let currentChunk = {}
    let ffstream = ffmpegObj.pipe()
    ffstream.on('data', (buffer) => {
     currentChunk = buffer
     process.emit('ffmpeg-data', buffer)
    })

    // web app
    console.log('Starting Express Web Server on Port ' + config.port)
    const express = require('express')
    const app = express()
    const http = require('http')
    const httpServer = http.createServer(app)

    app.get('/', function (req, res) {
     console.log('client connected:', req.headers['user-agent'])
     let contentWriter = (buffer) => {
       res.write(buffer)
     }
     res.setHeader('Connection', 'close')
     res.setHeader('Cache-Control', 'no-cache')
     res.setHeader('Pragma', 'no-cache')
     res.setHeader('Content-Type', 'video/mp2t')

     // write current chunk before the first data event occurs
     if (currentChunk.length > 0) {
       res.write(currentChunk)
     }
     process.on('ffmpeg-data', contentWriter)

     req.on('close', function () {
       console.log('client disconnected:', req.headers['user-agent'])
       process.removeListener('ffmpeg-data', contentWriter)
     })
    })

    httpServer.listen(config.port)
  • conflicting of headers between ffmpeg and s3

    2 août 2021, par Juliette

    I have the code below in my server.js file for a web app that uses express for the backend and a built create react app that it serves.

    


    require('rootpath')();
const path = require('path');
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const cors = require('cors');

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(cookieParser());

app.use(cors());


app.use(function(req, res, next) {
  res.header("Cross-Origin-Embedder-Policy", "require-corp");
  res.header("Cross-Origin-Opener-Policy", "same-origin");
  next();
});

// Have Node serve the files for our built React app
app.use(express.static(path.resolve(__dirname, 'build')));

// file api routes
app.use('/accounts', require('./accounts/accounts.controller'));

// file api routes
app.use('/files', require('./files/files.controller'));


// All other GET requests not handled before will return our React app
app.get('*', (req, res) => {
    res.sendFile(path.resolve(__dirname, 'build', 'index.html'));
});

// start server
const port = process.env.PORT || 2002;
app.listen(port, () => console.log('Server listening on port ' + port));


    


    The issue here is that I need this segment of code for my ffmpeg file upload to occur otherwise it throws a SharedArrayBuffer error :

    


       app.use(function(req, res, next) {
      res.header("Cross-Origin-Embedder-Policy", "require-corp");
      res.header("Cross-Origin-Opener-Policy", "same-origin");
      next();
    });


    


    However, when I leave this code in, another part of my program breaks down which gets presigned urls from s3 and plays audio. The issue whenever I play audios from my s3 bucket there is this :

    


    ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep


    


    The s3 code is this :

    


    function getTemporaryURL({ data }) {

  const customer_id = data['customer-id'];
  const sound_id = data['sound-id'];
  
  return new Promise((resolve, reject) => {
    //get presigned url

    var myBucket = process.env.NODE_APP_BUCKET_NAME;
    var myKey = "sounds/" + customer_id + "/" + sound_id + ".wav"; 
    const signedUrlExpireSeconds = 120;
    try {
      const url = s3.getSignedUrl('getObject', {
        Bucket: myBucket,
        Key: myKey,
        ResponseContentDisposition: 'attachment',
        Expires: signedUrlExpireSeconds
      });
      resolve(url)
    }
    catch {
      console.log('S3 Object does not exist');
      resolve('');
    }
  });
}


    


    How can I modify my server.js to accommodate both of my needs ?

    


  • ffmpeg won't exit normally with SIGINT

    2 mars 2021, par ntstlkr

    I'm trying to record video with ffmpeg and all works fine when I call stopRecord() function inside timeout :

    


    frame=  147 fps= 18 q=-1.0 Lsize=     290kB time=00:00:09.91 bitrate= 239.8kbits/s speed=1.24x    
video:129kB audio:156kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 
2.159774%
[aac @ 0x55e825dbdc40] 
Qavg: 241.892
Exiting normally, received signal 2.
SIGINT
Recording process exit, code: 255, signal: null
Recording stopped


    


    But ffmpeg process won't exit and stays alive when I call stopRecord() function on API request inside express router.

    


    // here I create child process and try to close it in timeout which works.
export async function startRecord(producers: any, router: any, folderName: string, fileName: string) {
const sdp = `v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio ${ports[0]} RTP/AVPF 111
a=rtcp:${ports[0] + 1}
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10;useinbandfec=1
m=video ${ports[1]} RTP/AVPF 125
a=rtcp:${ports[1] + 1}
a=rtpmap:125 H264/90000
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f`;

const cmdArgStr = [
    "-protocol_whitelist pipe,rtp,udp",
    "-fflags +genpts",
    "-f sdp",
    "-i pipe:0",
    "-map 0:a:0 -c:a aac",
    "-map 0:v:0 -c:v copy",
    "-f mp4 -strict experimental",
    `-y recording/${folderName}/${fileName}.mp4`,
].join(" ").trim();

let process = spawn('ffmpeg', cmdArgStr.split(/\s+/));

process.stdin.write(sdp);
process.stdin.end();

process.on("error", (err: string) => {
    console.log('error');
    console.error("Recording process error:", err);
});

process.on("exit", (code: string, signal: string) => {
    process.kill('SIGINT');
    console.log('SIGINT');
    console.log("Recording process exit, code: %d, signal: %s", code, signal);

    if (!signal || signal === "SIGINT") {


           console.log("Recording stopped");
        } else {
            console.warn(
                "Recording process didn't exit cleanly, output file might be corrupt"
            );
        }
    });

    process.stderr.on("data", (chunk: string) => {
        chunk
            .toString()
            .split(/\r?\n/g)
            .filter(Boolean)
            .forEach(async (line: any) => {
                console.log(line);
                if (line.startsWith("ffmpeg version")) {
                    for (const consumer of consumers) {
                        await consumer.resume();
                    }
                }
            });
    });

    // this works!!
    setTimeout(() => {
        stopRecord(process);
    }, 10000);


    return process;
}

// this not works!! I call this function externally inside express router on API request
export function stopRecord(process: any) {
    process.kill('SIGINT');
}


    


    Linux process stays alive when I call stopRecord() inside express router, but property "killed" of process marked as true. It's only works when I send "SIGKILL" inside express router. I need to exit normally, because ffmpeg needs to save mp4 metadata.

    


    So the general question is : Why stopRecord function works inside timeout even with "SIGINT" code, but it doesn't when I call this function externally inside express router. Only "SIGKILL" works when I call stopRecord() inside express router.

    


    Renaming my "process" field doesn't help.

    


    I really don't understand why the same function works different inside timeout and inside express router. And I very thankful for any advice !

    


    I'm using node, typescript and express.