This commit is contained in:
Malte Rosenbjerg 2020-10-24 23:33:54 +02:00
commit 31ee7920a9

View file

@ -34,20 +34,20 @@ Easily build your FFMpeg arguments using the fluent argument builder:
Convert input file to h264/aac scaled to 720p w/ faststart, for web playback Convert input file to h264/aac scaled to 720p w/ faststart, for web playback
```csharp ```csharp
FFMpegArguments FFMpegArguments
.FromInputFiles(inputFilePath) .FromFileInput(inputPath)
.WithVideoCodec(VideoCodec.LibX264) .OutputToFile(outputPath, false, options => options
.WithConstantRateFactor(21) .WithVideoCodec(VideoCodec.LibX264)
.WithAudioCodec(AudioCodec.Aac) .WithConstantRateFactor(21)
.WithVariableBitrate(4) .WithAudioCodec(AudioCodec.Aac)
.WithFastStart() .WithVariableBitrate(4)
.Scale(VideoSize.Hd) .WithFastStart()
.OutputToFile(output) .Scale(VideoSize.Hd))
.ProcessSynchronously(), .ProcessSynchronously();
``` ```
Easily capture screens from your videos: Easily capture screens from your videos:
```csharp ```csharp
var mediaFileAnalysis = FFProbe.Analyse(inputFilePath); var mediaFileAnalysis = FFProbe.Analyse(inputPath);
// process the snapshot in-memory and use the Bitmap directly // process the snapshot in-memory and use the Bitmap directly
var bitmap = FFMpeg.Snapshot(mediaFileAnalysis, new Size(200, 400), TimeSpan.FromMinutes(1)); var bitmap = FFMpeg.Snapshot(mediaFileAnalysis, new Size(200, 400), TimeSpan.FromMinutes(1));
@ -59,10 +59,10 @@ FFMpeg.Snapshot(mediaFileAnalysis, outputPath, new Size(200, 400), TimeSpan.From
Convert to and/or from streams Convert to and/or from streams
```csharp ```csharp
await FFMpegArguments await FFMpegArguments
.FromPipe(new StreamPipeDataWriter(inputStream)) .FromPipeInput(new StreamPipeSource(inputStream))
.WithVideoCodec("vp9") .OutputToPipe(new StreamPipeSink(outputStream), options => options
.ForceFormat("webm") .WithVideoCodec("vp9")
.OutputToPipe(new StreamPipeDataReader(outputStream)) .ForceFormat("webm"))
.ProcessAsynchronously(); .ProcessAsynchronously();
``` ```
@ -133,9 +133,8 @@ var videoFramesSource = new RawVideoPipeSource(CreateFrames(64)) //pass IEnumera
FrameRate = 30 //set source frame rate FrameRate = 30 //set source frame rate
}; };
FFMpegArguments FFMpegArguments
.FromPipe(videoFramesSource) .FromPipeInput(videoFramesSource, <input_stream_options>)
// ... other encoding arguments .OutputToFile("temporary.mp4", false, <output_options>)
.OutputToFile("temporary.mp4")
.ProcessSynchronously(); .ProcessSynchronously();
``` ```