radek-k / FFMediaToolkit

FFMediaToolkit is a cross-platform video decoder/encoder library for .NET that uses FFmpeg native libraries. It supports video frames extraction, reading stream metadata and creating videos from bitmaps in any format supported by FFmpeg.
MIT License
352 stars 56 forks source link

Audio.AddFrame(float[][]) throw invalid argument exception #97

Closed Horiztar closed 2 years ago

Horiztar commented 2 years ago

Sorry but I didn't find a document about this.

First, I create an output:

MediaBuilder.CreateContainer("").WithAudio(new AudioEncoderSettings(44100, 2)
{
        Bitrate = 320000, SamplesPerFrame = 735     // the video should be 60 fps, so I assume it was 44100/735
}).WithVideo(new VideoEncoderSettings(1920,1080,60)).Create();

Here is how I used this method:

Video.AddFrame(ImageData);
Audio.AddFrame(buffers);    // buffers: byte[2][735]

And Audio.AddFrame throw

FFMediaToolkit.FFmpegException:“Cannot send a frame to the encoder. Error code: -22 : Invalid argument”

What did I do wrong?