UtilFFMediaToolkitFindColorFrameSequences(String, Color, Size, Single, ActionInt32, Int32) Method
Finds all the sequences of frames that matches the specified color in the source video file.
This is useful for example to find all fade to black sequences in a video.
Note: this method can take several minutes to complete depending on the duration and resolution of the source video.
Namespace: DevCase.ThirdParty.FFMediaToolkitAssembly: DevCase.net48.ThirdParty.FFMediaToolkit (in DevCase.net48.ThirdParty.FFMediaToolkit.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static IReadOnlyCollection<VideoTimeline> FindColorFrameSequences(
string videoFile,
Color color,
Size sampleSize,
float similarity,
Action<int, int> callback = null
)
Public Shared Function FindColorFrameSequences (
videoFile As String,
color As Color,
sampleSize As Size,
similarity As Single,
Optional callback As Action(Of Integer, Integer) = Nothing
) As IReadOnlyCollection(Of VideoTimeline)
Dim videoFile As String
Dim color As Color
Dim sampleSize As Size
Dim similarity As Single
Dim callback As Action(Of Integer, Integer)
Dim returnValue As IReadOnlyCollection(Of VideoTimeline)
returnValue = UtilFFMediaToolkit.FindColorFrameSequences(videoFile,
color, sampleSize, similarity, callback)
public:
static IReadOnlyCollection<VideoTimeline^>^ FindColorFrameSequences(
String^ videoFile,
Color color,
Size sampleSize,
float similarity,
Action<int, int>^ callback = nullptr
)
static member FindColorFrameSequences :
videoFile : string *
color : Color *
sampleSize : Size *
similarity : float32 *
?callback : Action<int, int>
(* Defaults:
let _callback = defaultArg callback null
*)
-> IReadOnlyCollection<VideoTimeline>
No code example is currently available or this language may not be supported.
- videoFile String
-
The video file.
- color Color
-
The color to match.
- sampleSize Size
-
The size at which each frame will be resized to analyze their pixels.
It is recommended to use a small size, like 20x20, 50x50 or 100x100.
Bigger sizes will take more time to analyze.
- similarity Single
-
The tolerance of the color comparison. Valid range is from 0.01 (minimum) to 100 (maximum).
- callback ActionInt32, Int32 (Optional)
-
An encapsulated method that is invoked with {currentFrameNumber, totalFrames} arguments to report progress.
IReadOnlyCollectionVideoTimeline
A
IReadOnlyCollectionT that represents the
sequences of frames that matches the specified color in the source video file.
This is a code example.
No code example is currently available or this language may not be supported.
' FFMpeg binaries (shared build) (download here: https://www.gyan.dev/ffmpeg/builds/)
' See FFMediaToolkit documentation here: https://github.com/radek-k/FFMediaToolkit#setup
FFMediaToolkit.FFmpegLoader.FFmpegPath = "C:\ffmpeg\"
FFMediaToolkit.FFmpegLoader.LoadFFmpeg()
Dim videoFile As String = "C:\File.mkv"
Dim color As Color = Color.Black
Dim sampleSize As New Size(20, 20)
Dim similarity As Single = 99.99F
Dim timelines As IReadOnlyCollection(Of VideoTimeline) = FindColorFrameSequences(videoFile, color, sampleSize, similarity)
For Each timeline As VideoTimeline In timelines
Console.WriteLine($"Begin time: {timeline.BeginTime}, End time: {timeline.EndTime}, Frame numbers: {{{String.Join(", ", timeline.FrameNumbers)}}}")
Next timeline
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.