Recherche avancée

Médias (91)

Autres articles (75)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (8696)

  • ffmpeg produces video with misaligned frames

    28 mars 2023, par massivemoisture

    I have a WPF app that uses DeckLinkAPI to stream video from Blackmagic capture card (similar to their 'CapturePreviewCSharp' sample project, which can be found here : https://www.blackmagicdesign.com/developer/)

    


    'VideoInputFrameArrived' method is called when a video input frame arrives :

    


    void IDeckLinkInputCallback.VideoInputFrameArrived(IDeckLinkVideoInputFrame videoFrame, IDeckLinkAudioInputPacket audioPacket)
{
    if (videoFrame != null)
    {
        CurrentFrame = videoFrame;
        VideoFrameArrived?.Invoke(this, new DeckLinkDeviceInputVideoFrameEventArgs(videoFrame));
        GC.AddMemoryPressure(videoFrame.GetRowBytes() * videoFrame.GetHeight());
    }
}


    


    I want to record the stream to a file. So I open a ffmpeg process with these arguments :

    


    // My source is 1080p
string args = $".\\ffmpeg.exe -y -f rawvideo -pix_fmt bgra -s 1920x1080 -r 30 -i - -c:v libx264 -preset ultrafast -pix_fmt yuv420p -crf 23 \"{outputFilePath}\"";


    


    And I write to ffmpeg's pipe :

    


    // ffmpegInputStream = FfmpegProcess.StandardInput.BaseStream
public void WriteVideoFrameToProcessStream(Stream ffmpegInputStream)
{
    while (true)
    {
        if (isRecording == true)
        {
            if (ffmpegInputStream != null)
            {
                // Convert the frame to BGRA32 format and convert the video frame to a byte array
                byte[] frameData = ConvertVideoFrameToByteArray(CurrentFrame);
                // Write the frame data to the ffmpeg input stream
                ffmpegInputStream.Write(frameData, 0, frameData.Length);
            }
        }
    }
}


    


    But the video file output has misaligned frames. The frame looks like it has been shifted to the left. 1/5 of the frame on the right is supposed to be on the left.
enter image description here

    


    I tried saving the frameData byte array in WriteVideoFrameToProcessStream to an image file and it looks fine. What could be wrong here ?

    


  • "Output stream closed" when streaming PassThrough stream to AWS using @aws-sdk/lib-storage

    5 avril 2023, par cjd

    I am attempting to stream a PassThrough stream directly to S3 using @aws-sdk/lib-storage.

    


    My upload function is :

    


    const uploadStreamToS3 = () => {
    const Key = 'test.mp4';
    const Bucket = 'bucket-name';
    const stream = new PassThrough();
    const upload = new Upload({
        client: s3Client,
        params: { Bucket, Key, Body: stream },
        tags: [], // optional tags
        queueSize: 4, // optional concurrency configuration
        partSize: 1024 * 1024 * 5, // optional size of each part, in bytes, at least 5MB
        leavePartsOnError: false // optional manually handle dropped parts
    });
    return {
        stream,
        uploadComplete: upload.done(),
        upload
    };
};


    


    I am piping from ffmpeg directly to the PassThrough stream :

    


            ffmpegInstance
            .addOutputOptions(
                '-movflags +frag_keyframe+separate_moof+omit_tfhd_offset+empty_moov'
            )
            .format('mp4')
            .pipe(stream, { end: true });


    


    When I run this locally, everything works.

    


    I am using a container lambda function with Docker.

    


    If I run the Docker container locally, everything works as expected. If I run the same code on Lambda, I get the following error Output stream is closed.

    


    One work around is to write the file to the Lambda tmp folder using a writeStream and once the file is written I can stream the file to S3 using a readStream as the Body of new Upload. However, I would like to stream directly to S3 and not create this temporary file in Lambda.

    


    Is this possible ? Is the issue with using a PassThrough stream in the Body for S3 ?

    


  • flient-ffmpeg getting error as "ffmpeg exited with code 1 : pipe:0 : Invalid data found when processing input"

    6 avril 2023, par Abhishek Rawal

    I am trying to create API where i need to get uploaded video and create thumbnail from that video. But conditions are :

    


      

    • Video should not store on local disk
    • 


    • Once thumbnail is create it should not store on local disk, instead it should directly uploaded to AWS s3 bucket.
    • 


    


    Following is the code i am trying with :

    


    

    

    const ffmpeg = require('fluent-ffmpeg');
const stream = require('stream');

router.post('/thumbnail', upload.any(), (req, res) => {
  const videoBuffer = req.files[0].buffer;
  
  let readableVideoBuffer = new stream.PassThrough();
    readableVideoBuffer.write(videoBuffer);
    readableVideoBuffer.end()
    
  let bufferStream = new stream.PassThrough();
  
  ffmpeg(readableVideoBuffer)
    .on('filenames', function(filenames) {
      console.log('Will generate ' + filenames.join(', '))
    })
    .on('end', function() {
      console.log('Screenshots taken');
    })
    .on('error', (err) => {
      console.log(err);
    })
    .screenshots({
      count: 4,
      size: '100x100',
      timestamps: ['00:00:01.000'],
    })
    .writeToStream(bufferStream, { end: true });  /* while using this statement i am getting error */
    
    const buffers = [];
    bufferStream.on('data', function (buf) {
      buffers.push(buf);
    });
    bufferStream.on('end', function () {
      const outputBuffer = Buffer.concat(buffers);
      // use s3 bucket code here
      console.log('outputBuffer===========>', outputBuffer)
    });
})

    


    


    



    so while calling this API my app is crashing and i am getting error as :

    


    


    Error : ffmpeg exited with code 1 : pipe:0 : Invalid data found when
processing input

    


    


    Blockquote

    


    If i am not using this statement :

    


    


    .writeToStream(bufferStream, end : true ) ;

    


    


    then able to save file but in local disk, which is not required in my case.

    


    Please help me to understand what is wrong in this code, how i can resolve it.
Any type of help is appreciated.