Recherche avancée

Médias (0)

Mot : - Tags -/api

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (35)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (6498)

  • FFMPEG hardware acceleration in Windows Scheduled Task [closed]

    25 mars 2022, par cfairer

    I'm setting up an unattended Windows 10 machine that will stream video from an RTSP nest cam feed using FFMPEG and Apache.
As it will be unattended and will lose power for six hours a day, I have created a Scheduled Task to run at boot without a user logged to run ffmpeg.

    


    It all works fine with conventional encoders for task started automatically or manually by Windows Task Scheduler :
ffmpeg.exe -i rtsp ://user:pw@nestcam:554 -vf scale=1280:720 -vcodec libx264 -g 20 -r 10 -b:v 1120000 -crf 31 -map 0 -map -0:a -acodec aac -sc_threshold 0 -f hls -hls_time 2 -segment_time 2 -hls_flags delete_segments -hls_list_size 20 C :\webpages\video\stream.m3u8

    


    It works fine when I use hardware acceleration too, but only outside Task Scheduler (e.g. a command prompt) :
ffmpeg.exe -init_hw_device qsv=hw -filter_hw_device hw -i rtsp ://user:pw@nestcam:554 -vf hwupload=extra_hw_frames=64,format=qsv -c:v h264_qsv -g 20 -r 10 -b:v 1120000 -crf 31 -map 0 -map -0:a -acodec aac -sc_threshold 0 -f hls -hls_time 2 -segment_time 2 -hls_flags delete_segments -hls_list_size 20 C :\webpages\video\stream.m3u8

    


    The hardware accelerated version fails when executed by Windows Task Scheduler, whether started automatically or manually. The relevant output is as follows :
[AVHWDeviceContext @ 00000184ba5cc800] Failed to create Direct3D device
Device creation failed : -1313558101.
Failed to set value 'qsv=hw' for option 'init_hw_device' : Unknown error occurred
Error parsing global options : Unknown error occurred

    


    Why can't the ffmpeg task started by Task Scheduler see the hardware-accelerated hardware ? Any ideas on how to resolve this ?

    


    The hardware-accelerated version reduces the load on the CPU by about 75% (ie 50% down to 13%), so it's a significant benefit.

    


    Thanks

    


  • running the formatVideoToWebpSticker function

    20 septembre 2022, par shahar111121

    this is my code trying to convert an mp4 to webp file.
for some reason its not saving the file to my folder and when I console.logged it, it sent a path to my temp folder but the file wasn't there.
Tried looking it up but found nothing helpful :(
how to fix this please ? thank you

    


    const path = require('path');
const Crypto = require('crypto');
const { tmpdir } = require('os');
const ffmpeg = require('fluent-ffmpeg');
const webp = require('node-webpmux');
const fs = require('fs').promises;
const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
const { MessageMedia } = require('whatsapp-web.js');

const media = MessageMedia.fromFilePath('./1.mp4');

async function formatVideoToWebpSticker(media) {
        if (!media.mimetype.includes('video'))
            throw new Error('media is not a video');
        const videoType = media.mimetype.split('/')[1];
        const tempFile = path.join(
            tmpdir(),
            `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`
        );
        const stream = new (require('stream').Readable)();
        const buffer = Buffer.from(
            media.data.replace(`data:${media.mimetype};base64,`, ''),
            'base64'
        );
        stream.push(buffer);
        stream.push(null);
        await new Promise((resolve, reject) => {
            ffmpeg(stream)
                .inputFormat(videoType)
                .on('error', reject)
                .on('end', () => resolve(true))
                .addOutputOptions([
                    '-vcodec',
                    'libwebp',
                    '-vf',
                    // eslint-disable-next-line no-useless-escape
                    'scale=\'iw*min(300/iw\,300/ih)\':\'ih*min(300/iw\,300/ih)\',format=rgba,pad=300:300:\'(300-iw)/2\':\'(300-ih)/2\':\'#00000000\',setsar=1,fps=10',
                    '-loop',
                    '0',
                    '-ss',
                    '00:00:00.0',
                    '-t',
                    '00:00:05.0',
                    '-preset',
                    'default',
                    '-an',
                    '-vsync',
                    '0',
                    '-s',
                    '512:512',
                ])
                .toFormat('webp')
                .save(tempFile)
                console.log(tempFile);
        });
        
        const data = await fs.readFile(tempFile, 'base64');
        console.log(tempFile)
        await fs.unlink(tempFile);
        return {
            mimetype: 'image/webp',
            data: data,
            filename: media.filename,
        };
    }
formatVideoToWebpSticker(media)


    


  • How to efficiently clear ffmpeg buffer

    23 juillet 2020, par KmanOfficial

    I am using Chiaki (https://github.com/thestr4ng3r/chiaki/) - A Open Source Video Streaming Application for the PS4.

    


    I have one issue though. The stream successfully shows the playstation but after about 60 seconds. The stream freezes and gets stuck on the last processed frame until I restart the application. I believe the issue is in the C++ file - (https://github.com/thestr4ng3r/chiaki/blob/master/gui/src/videodecoder.cpp) and the issue is specifically here : `

    


    void VideoDecoder::PushFrame(uint8_t *buf, size_t buf_size)
{
    {
        QMutexLocker locker(&mutex);

    AVPacket packet;
    av_init_packet(&packet);
    packet.data = buf;
    packet.size = buf_size;
    int r;
send_packet:
        r = avcodec_send_packet(codec_context, &packet);
        if(r != 0)
        {
            if(r == AVERROR(EAGAIN))
            {
                CHIAKI_LOGE(log, "AVCodec internal buffer is full removing frames before pushing");
                AVFrame *frame = av_frame_alloc();
                if(!frame)
                {
                    CHIAKI_LOGE(log, "Failed to alloc AVFrame");
                    return;
                }
                r = avcodec_receive_frame(codec_context, frame);
                av_frame_free(&frame);
                if(r != 0)
                {
                    CHIAKI_LOGE(log, "Failed to pull frame");
                    return;
                }
                goto send_packet;
            }
            else
            {
                char errbuf[128];
                av_make_error_string(errbuf, sizeof(errbuf), r);
                CHIAKI_LOGE(log, "Failed to push frame: %s", errbuf);
                return;
            }
        }
    }

    emit FramesAvailable();
}


    


    `

    


    I believe so as the application log constantly prints this logged message : "AVCodec internal buffer is full removing frames before pushing"

    


    I've tried looking at the ffmpeg manual and I am struggling on how to flush the internal buffer to get the stream constantly flowing can anyone point me in the correct direction. Thank you.