Recherche avancée

Médias (33)

Mot : - Tags -/creative commons

Autres articles (63)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 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 (...)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (6774)

  • FFMPEG - how to transcode input stream while cutting off first few seconds of video and audio

    25 septembre 2020, par purplepear24

    I am using ffmpeg to transcode a screen-record (x11) input stream to MP4. I would like to cut off the first 10 seconds of the stream, which is just a blank screen (this is intentional).

    


    I understand how to trim video with ffmpeg when converting from mp4 to another mp4, but i can't find any working solution for processing an input stream while accounting for delay and audio/video syncing.

    


    Here is my current code :

    


    const { spawn } = require('child_process');
const { S3Uploader } = require('./utils/upload');

const MEETING_URL = process.env.MEETING_URL || 'Not present in environment';
console.log(`[recording process] MEETING_URL: ${MEETING_URL}`);

const args = process.argv.slice(2);
const BUCKET_NAME = args[0];
console.log(`[recording process] BUCKET_NAME: ${BUCKET_NAME}`);
const BROWSER_SCREEN_WIDTH = args[1];
const BROWSER_SCREEN_HEIGHT = args[2];
const MEETING_ID = args[3];
console.log(`[recording process] BROWSER_SCREEN_WIDTH: ${BROWSER_SCREEN_WIDTH}, BROWSER_SCREEN_HEIGHT: ${BROWSER_SCREEN_HEIGHT}, TASK_NUMBER: 43`);

const VIDEO_BITRATE = 3000;
const VIDEO_FRAMERATE = 30;
const VIDEO_GOP = VIDEO_FRAMERATE * 2;
const AUDIO_BITRATE = '160k';
const AUDIO_SAMPLERATE = 44100;
const AUDIO_CHANNELS = 2
const DISPLAY = process.env.DISPLAY;

const transcodeStreamToOutput = spawn('ffmpeg',[
    '-hide_banner',
    '-loglevel', 'error',
    // disable interaction via stdin
    '-nostdin',
    // screen image size
    // '-s', `${BROWSER_SCREEN_WIDTH}x${BROWSER_SCREEN_HEIGHT}`,
    '-s', '1140x720',
    // video frame rate
    '-r', `${VIDEO_FRAMERATE}`,
    // hides the mouse cursor from the resulting video
    '-draw_mouse', '0',
    // grab the x11 display as video input
    '-f', 'x11grab',
    '-i', ':1.0+372,8',
    // '-i', `${DISPLAY}`,
    // grab pulse as audio input
    '-f', 'pulse', 
        '-ac', '2',
        '-i', 'default',
    // codec video with libx264
    '-c:v', 'libx264',
        '-pix_fmt', 'yuv420p',
        '-profile:v', 'main',
        '-preset', 'veryfast',
        '-x264opts', 'nal-hrd=cbr:no-scenecut',
        '-minrate', `${VIDEO_BITRATE}`,
        '-maxrate', `${VIDEO_BITRATE}`,
        '-g', `${VIDEO_GOP}`,
    // apply a fixed delay to the audio stream in order to synchronize it with the video stream
    '-filter_complex', 'adelay=delays=1000|1000',
    // codec audio with aac
    '-c:a', 'aac',
        '-b:a', `${AUDIO_BITRATE}`,
        '-ac', `${AUDIO_CHANNELS}`,
        '-ar', `${AUDIO_SAMPLERATE}`,
    // adjust fragmentation to prevent seeking(resolve issue: muxer does not support non seekable output)
    '-movflags', 'frag_keyframe+empty_moov+faststart',
    // set output format to mp4 and output file to stdout
    '-f', 'mp4', '-'
    ]
);

transcodeStreamToOutput.stderr.on('data', data => {
    console.log(`[transcodeStreamToOutput process] stderr: ${(new Date()).toISOString()} ffmpeg: ${data}`);
});

const timestamp = new Date();
const year = timestamp.getFullYear();
const month = timestamp.getMonth() + 1;
const day = timestamp.getDate();
const hour = timestamp.getUTCHours();
console.log(MEETING_ID);
const fileName = `${year}/${month}/${day}/${hour}/${MEETING_ID}.mp4`;
new S3Uploader(BUCKET_NAME, fileName).uploadStream(transcodeStreamToOutput.stdout);

// event handler for docker stop, not exit until upload completes
process.on('SIGTERM', (code, signal) => {
    console.log(`[recording process] exited with code ${code} and signal ${signal}(SIGTERM)`);
    process.kill(transcodeStreamToOutput.pid, 'SIGTERM');
});

// debug use - event handler for ctrl + c
process.on('SIGINT', (code, signal) => {
    console.log(`[recording process] exited with code ${code} and signal ${signal}(SIGINT)`)
    process.kill('SIGTERM');
});

process.on('exit', function(code) {
    console.log('[recording process] exit code', code);
});


    


    Any help would be greatly appreciated !

    


  • How to effectly record and encode from udp stream(4K HECV) in real time with ffmpeg ?

    25 janvier 2021, par Sa Mei

    I have a serious problem about ffmpeg to solve.
My task is to record from udp stream(4K HECV) and encode it to a mxf file.
My CPU is Intel(R) Xeon(R) Gold 5122 CPU@3.60GHz
The situation of CPU when it is recording from udp stream

    


    The situation of the udp stream

    


    The ffmpeg I used from https://github.com/BtbN/FFmpeg-Builds/commit/86af523883173be93c69d1170d1f78f79dc5e9f8 .
The command I used is :
ffmpeg -y -threads 6 -i "udp ://@225.1.2.150:6150 ?overrun_nonfatal=1&fifo_size=50000000" -threads 32 -qscale:v 2 -alternate_scan 1 -f mxf "G :\4k.xmf"

    


    Now the speed is lower than 1.0x after running for a while(about 10minutes). Maybe this is due to the temperature of the cpu gradually increasing.
The picture above displays the performance of CPU when we specify threads=6 for decoding and threads=32 for encoding.
I found that the speed would be 1.0x if I just recorded it to a .hecv file. But now I want to encode the stream to a .mxf file in real time. But as you can see, if I tried to encode it in real time, the speed of decoding and encoding would always be lower than 1.0x (around 0.98x). After running this command for about 3 hours, the recording and encoding process will be stopped.

    


    How to solve it ? I expect that the speed is 1.0x by speeding up encoding or other ways.
Or anyone knows that how to record the udp stream without re-encoding to a .hecv file and meanwhile encode the .hecv file to a .mxf file ?

    


  • node.js - Error : ENOENT : no such file or directory, unlink

    10 août 2020, par necroface

    I have the function below to convert a .wav file to .mp3. As you can see, before using the ffmpeg module to convert the audio file, I already check if the file exists or not, then upon conversion, I only keep the new file and delete the old one. But occasionally the console throws me the error Error: ENOENT: no such file or directory, unlink, which means that I unlink (delete) a non-existing file. I cannot understand why, because I already have an existence check even before the conversion, so it is supposed to have existed to be unlinked.

    



    module.exports.convertAndMoveElastic = async (calllog) => {
    let { start, sip_uri, direction, source, destination } = calllog;
    const VNtimezoneOffset = 7 + new Date().getTimezoneOffset() / 60;
    const startTime = new Date(start + VNtimezoneOffset * 3600000 - 60000);
    const date = startTime.getDate() < 10 ? `0${startTime.getDate().toString()}` : startTime.getDate().toString();
    const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
    const month = months[startTime.getMonth()];
    const year = startTime.getFullYear().toString();
    sip_uri = sip_uri || (direction === 'outgoing' ? source : destination);
    const [extension, domain_name] = sip_uri.split("@");
    return new Promise(async (resolve, reject) => {
        const links = await getLinkWithElastic(calllog);
        if (!links) { return reject(); }
        let file_id, filepath;
        for (let link of links) {
            const { callid, sipCallid, uuid, record_path } = link._source;
            if (record_path) {
                let recordPathArr = record_path.split('/');
                file_id = recordPathArr[recordPathArr.length - 1].split('.')[0];
                filepath = path.resolve(base_directory, domain_name, 'archive', year, month, date, `${file_id}.wav`);
            }
            if (!file_id || !fs.existsSync(filepath)) {
                file_id = callid;
                filepath = path.resolve(base_directory, domain_name, 'archive', year, month, date, `${file_id}.wav`);
            }
            if (!file_id || !fs.existsSync(filepath)) {
                file_id = uuid;
                filepath = path.resolve(base_directory, domain_name, 'archive', year, month, date, `${file_id}.wav`);
            }
            if (fs.existsSync(filepath)) { break; }
        }
        if (!fs.existsSync(filepath)) { return reject(); }
        ffmpeg(filepath)
            .audioCodec('libmp3lame')
            .on('error', function (error) {
                reject(error);
            })
            .on('end', function () {
                resolve({ recordUrl: `${host}/record/download/${file_id}.mp3` });
                fs.unlinkSync(filepath);
            })
            .toFormat('mp3')
            .saveToFile(path.resolve(dest_directory, file_id + ".mp3"));
    });
};