Class Conversion
Inheritance
System.Object
Conversion
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Xabe.FFmpeg.dll
Syntax
public class Conversion : IConversion
Properties
FFmpegProcessId
Declaration
public int? FFmpegProcessId { get; }
Property Value
Type |
Description |
System.Nullable<System.Int32> |
|
OutputFilePath
Declaration
public string OutputFilePath { get; }
Property Value
Type |
Description |
System.String |
|
Methods
AddAudio(String, String, String)
Add audio stream to video file
Declaration
public static IConversion AddAudio(string videoPath, string audioPath, string outputPath)
Parameters
Type |
Name |
Description |
System.String |
videoPath |
Video
|
System.String |
audioPath |
Audio
|
System.String |
outputPath |
Output file
|
Returns
AddParameter(String, ParameterPosition)
Declaration
public IConversion AddParameter(string parameter, ParameterPosition parameterPosition = ParameterPosition.PostInput)
Parameters
Returns
AddStream(IEnumerable<IStream>)
Declaration
public IConversion AddStream(IEnumerable<IStream> streams)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<IStream> |
streams |
|
Returns
AddStream<T>(T[])
Declaration
public IConversion AddStream<T>(params T[] streams)
where T : IStream
Parameters
Type |
Name |
Description |
T[] |
streams |
|
Returns
Type Parameters
AddSubtitle(String, String, String, String)
Add subtitle to file. It will be added as new stream so if you want to burn subtitles into video you should use
SetSubtitles method.
Declaration
public static IConversion AddSubtitle(string inputPath, string outputPath, string subtitlePath, string language = null)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Input path
|
System.String |
outputPath |
Output path
|
System.String |
subtitlePath |
Path to subtitle file in .srt format
|
System.String |
language |
Language code in ISO 639. Example: "eng", "pol", "pl", "de", "ger"
|
Returns
AddSubtitles(String, String, String)
Add subtitles to video stream
Declaration
public static IConversion AddSubtitles(string inputPath, string outputPath, string subtitlesPath)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Video
|
System.String |
outputPath |
Output file
|
System.String |
subtitlesPath |
Subtitles
|
Returns
Build()
Declaration
Returns
Type |
Description |
System.String |
|
BuildVideoFromImages(IEnumerable<String>)
Declaration
public IConversion BuildVideoFromImages(IEnumerable<string> imageFiles)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.String> |
imageFiles |
|
Returns
BuildVideoFromImages(Int32, Func<String, String>)
Declaration
public IConversion BuildVideoFromImages(int startNumber, Func<string, string> buildInputFileName)
Parameters
Type |
Name |
Description |
System.Int32 |
startNumber |
|
System.Func<System.String, System.String> |
buildInputFileName |
|
Returns
ChangeSize(String, String, Int32, Int32)
Declaration
public static IConversion ChangeSize(string inputPath, string outputPath, int width, int height)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Input path
|
System.String |
outputPath |
Output path
|
System.Int32 |
width |
Expected width
|
System.Int32 |
height |
Expected height
|
Returns
ChangeSize(String, String, VideoSize)
Declaration
public static IConversion ChangeSize(string inputPath, string outputPath, VideoSize size)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Input path
|
System.String |
outputPath |
Output path
|
VideoSize |
size |
Expected size
|
Returns
Clear()
Declaration
Concatenate(String, String[])
Concat multiple inputVideos.
Declaration
public static IConversion Concatenate(string output, params string[] inputVideos)
Parameters
Type |
Name |
Description |
System.String |
output |
Concatenated inputVideos
|
System.String[] |
inputVideos |
Videos to add
|
Returns
Convert(String, String)
Convert one file to another with destination format.
Declaration
public static IConversion Convert(string inputFilePath, string outputFilePath)
Parameters
Type |
Name |
Description |
System.String |
inputFilePath |
Path to file
|
System.String |
outputFilePath |
Path to file
|
Returns
ConvertWithHardware(String, String, HardwareAccelerator, VideoCodec, VideoCodec, Int32)
Convert one file to another with destination format using hardware acceleration (if possible). Using cuvid. Works only on Windows/Linux with NVidia GPU.
Declaration
public static IConversion ConvertWithHardware(string inputFilePath, string outputFilePath, HardwareAccelerator hardwareAccelerator, VideoCodec decoder, VideoCodec encoder, int device = 0)
Parameters
Type |
Name |
Description |
System.String |
inputFilePath |
Path to file
|
System.String |
outputFilePath |
Path to file
|
HardwareAccelerator |
hardwareAccelerator |
Hardware accelerator. List of all acceclerators available for your system - "ffmpeg -hwaccels"
|
VideoCodec |
decoder |
Codec using to decoding input video (e.g. h264_cuvid)
|
VideoCodec |
encoder |
Codec using to encode output video (e.g. h264_nvenc)
|
System.Int32 |
device |
Number of device (0 = default video card) if more than one video card.
|
Returns
Declaration
public static IConversion ExtractAudio(string inputPath, string outputPath)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Input path
|
System.String |
outputPath |
Output video stream
|
Returns
Declaration
public IConversion ExtractEveryNthFrame(int frameNo, Func<string, string> buildOutputFileName)
Parameters
Type |
Name |
Description |
System.Int32 |
frameNo |
|
System.Func<System.String, System.String> |
buildOutputFileName |
|
Returns
Declaration
public IConversion ExtractNthFrame(int frameNo, Func<string, string> buildOutputFileName)
Parameters
Type |
Name |
Description |
System.Int32 |
frameNo |
|
System.Func<System.String, System.String> |
buildOutputFileName |
|
Returns
Declaration
public static IConversion ExtractVideo(string inputPath, string outputPath)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Input path
|
System.String |
outputPath |
Output audio stream
|
Returns
GetScreenCapture(Double)
Declaration
public IConversion GetScreenCapture(double frameRate)
Parameters
Type |
Name |
Description |
System.Double |
frameRate |
|
Returns
New()
Get new instance of Conversion
Declaration
public static IConversion New()
Returns
SaveM3U8Stream(Uri, String, Nullable<TimeSpan>)
Declaration
public static IConversion SaveM3U8Stream(Uri uri, string outputPath, TimeSpan? duration = default(TimeSpan? ))
Parameters
Type |
Name |
Description |
System.Uri |
uri |
Uri to stream
|
System.String |
outputPath |
Output path
|
System.Nullable<System.TimeSpan> |
duration |
Duration of stream
|
Returns
SetAudioBitrate(Int64)
Declaration
public IConversion SetAudioBitrate(long bitrate)
Parameters
Type |
Name |
Description |
System.Int64 |
bitrate |
|
Returns
SetFrameRate(Double)
Declaration
public IConversion SetFrameRate(double frameRate)
Parameters
Type |
Name |
Description |
System.Double |
frameRate |
|
Returns
Declaration
public IConversion SetHashFormat(string hashFormat)
Parameters
Type |
Name |
Description |
System.String |
hashFormat |
|
Returns
Declaration
public IConversion SetHashFormat(Hash hashFormat)
Parameters
Type |
Name |
Description |
Hash |
hashFormat |
|
Returns
Declaration
public IConversion SetInputFormat(string format)
Parameters
Type |
Name |
Description |
System.String |
format |
|
Returns
Declaration
public IConversion SetInputFormat(Format inputFormat)
Parameters
Type |
Name |
Description |
Format |
inputFormat |
|
Returns
Declaration
public IConversion SetInputFrameRate(double frameRate)
Parameters
Type |
Name |
Description |
System.Double |
frameRate |
|
Returns
Declaration
public IConversion SetInputTime(TimeSpan? time)
Parameters
Type |
Name |
Description |
System.Nullable<System.TimeSpan> |
time |
|
Returns
SetOutput(String)
Declaration
public IConversion SetOutput(string outputPath)
Parameters
Type |
Name |
Description |
System.String |
outputPath |
|
Returns
Declaration
public IConversion SetOutputFormat(string format)
Parameters
Type |
Name |
Description |
System.String |
format |
|
Returns
Declaration
public IConversion SetOutputFormat(Format outputFormat)
Parameters
Type |
Name |
Description |
Format |
outputFormat |
|
Returns
SetOutputTime(Nullable<TimeSpan>)
Declaration
public IConversion SetOutputTime(TimeSpan? time)
Parameters
Type |
Name |
Description |
System.Nullable<System.TimeSpan> |
time |
|
Returns
SetOverwriteOutput(Boolean)
Declaration
public IConversion SetOverwriteOutput(bool overwrite)
Parameters
Type |
Name |
Description |
System.Boolean |
overwrite |
|
Returns
Declaration
public IConversion SetPixelFormat(string pixelFormat)
Parameters
Type |
Name |
Description |
System.String |
pixelFormat |
|
Returns
Declaration
public IConversion SetPixelFormat(PixelFormat pixelFormat)
Parameters
Returns
SetPreset(ConversionPreset)
Declaration
public IConversion SetPreset(ConversionPreset preset)
Parameters
Returns
SetPriority(Nullable<ProcessPriorityClass>)
Declaration
public IConversion SetPriority(ProcessPriorityClass? priority)
Parameters
Type |
Name |
Description |
System.Nullable<System.Diagnostics.ProcessPriorityClass> |
priority |
|
Returns
SetSeek(Nullable<TimeSpan>)
Declaration
public IConversion SetSeek(TimeSpan? seek)
Parameters
Type |
Name |
Description |
System.Nullable<System.TimeSpan> |
seek |
|
Returns
SetVideoBitrate(Int64)
Declaration
public IConversion SetVideoBitrate(long bitrate)
Parameters
Type |
Name |
Description |
System.Int64 |
bitrate |
|
Returns
SetWatermark(String, String, String, Position)
Melt watermark into video
Declaration
public static IConversion SetWatermark(string inputPath, string outputPath, string inputImage, Position position)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Input video path
|
System.String |
outputPath |
Output file
|
System.String |
inputImage |
Watermark
|
Position |
position |
Position of watermark
|
Returns
Snapshot(String, String, TimeSpan)
Declaration
public static IConversion Snapshot(string inputPath, string outputPath, TimeSpan captureTime)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Video
|
System.String |
outputPath |
Output file
|
System.TimeSpan |
captureTime |
TimeSpan of snapshot
|
Returns
Split(String, String, TimeSpan, TimeSpan)
Declaration
public static IConversion Split(string inputPath, string outputPath, TimeSpan startTime, TimeSpan duration)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Video
|
System.String |
outputPath |
Output file
|
System.TimeSpan |
startTime |
Start point
|
System.TimeSpan |
duration |
Duration of new video
|
Returns
Start()
Declaration
public Task<IConversionResult> Start()
Returns
Start(String)
Declaration
public Task<IConversionResult> Start(string parameters)
Parameters
Type |
Name |
Description |
System.String |
parameters |
|
Returns
Start(String, CancellationToken)
Declaration
public Task<IConversionResult> Start(string parameters, CancellationToken cancellationToken)
Parameters
Type |
Name |
Description |
System.String |
parameters |
|
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Start(CancellationToken)
Declaration
public Task<IConversionResult> Start(CancellationToken cancellationToken)
Parameters
Type |
Name |
Description |
System.Threading.CancellationToken |
cancellationToken |
|
Returns
ToGif(String, String, Int32, Int32)
Convert image video stream to gif
Declaration
public static IConversion ToGif(string inputPath, string outputPath, int loop, int delay = 0)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Input path
|
System.String |
outputPath |
Output path
|
System.Int32 |
loop |
Number of repeats
|
System.Int32 |
delay |
Delay between repeats (in seconds)
|
Returns
ToMp4(String, String)
Declaration
public static IConversion ToMp4(string inputPath, string outputPath)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Input path
|
System.String |
outputPath |
Destination file
|
Returns
ToOgv(String, String)
Declaration
public static IConversion ToOgv(string inputPath, string outputPath)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Input path
|
System.String |
outputPath |
Destination file
|
Returns
ToTs(String, String)
Declaration
public static IConversion ToTs(string inputPath, string outputPath)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Input path
|
System.String |
outputPath |
Destination file
|
Returns
ToWebM(String, String)
Declaration
public static Task<IConversion> ToWebM(string inputPath, string outputPath)
Parameters
Type |
Name |
Description |
System.String |
inputPath |
Input path
|
System.String |
outputPath |
Destination file
|
Returns
Type |
Description |
System.Threading.Tasks.Task<IConversion> |
Conversion result
|
UseHardwareAcceleration(String, String, String, Int32)
Declaration
public IConversion UseHardwareAcceleration(string hardwareAccelerator, string decoder, string encoder, int device = 0)
Parameters
Type |
Name |
Description |
System.String |
hardwareAccelerator |
|
System.String |
decoder |
|
System.String |
encoder |
|
System.Int32 |
device |
|
Returns
UseHardwareAcceleration(HardwareAccelerator, VideoCodec, VideoCodec, Int32)
Declaration
public IConversion UseHardwareAcceleration(HardwareAccelerator hardwareAccelerator, VideoCodec decoder, VideoCodec encoder, int device = 0)
Parameters
Returns
UseMultiThread(Boolean)
Declaration
public IConversion UseMultiThread(bool multiThread)
Parameters
Type |
Name |
Description |
System.Boolean |
multiThread |
|
Returns
UseMultiThread(Int32)
Declaration
public IConversion UseMultiThread(int threadsCount)
Parameters
Type |
Name |
Description |
System.Int32 |
threadsCount |
|
Returns
UseShortest(Boolean)
Declaration
public IConversion UseShortest(bool useShortest)
Parameters
Type |
Name |
Description |
System.Boolean |
useShortest |
|
Returns
Events
OnDataReceived
Declaration
public event DataReceivedEventHandler OnDataReceived
Event Type
Type |
Description |
System.Diagnostics.DataReceivedEventHandler |
|
OnProgress
Declaration
public event ConversionProgressEventHandler OnProgress
Event Type
Implements