DotnetTimecode 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package DotnetTimecode --version 2.0.0                
NuGet\Install-Package DotnetTimecode -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotnetTimecode" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotnetTimecode --version 2.0.0                
#r "nuget: DotnetTimecode, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DotnetTimecode as a Cake Addin
#addin nuget:?package=DotnetTimecode&version=2.0.0

// Install DotnetTimecode as a Cake Tool
#tool nuget:?package=DotnetTimecode&version=2.0.0                

Image of a non drop frame timecode.

What is Dotnet Timecode?

CI NuGet Nuget

Dotnet Timecode is a C# class library for working with SMPTE Timecodes defined by the Society of Motion Picture and Television Engineers in the SMPTE 12M specification.

The library allows the user to construct timecode objects, manipulate timecode values, and convert between the most common framerates, including drop frame framerates such as 29.97DF and 59.95DF.

How do I get started?

Get the latest nuget package using the dotnet CLI

dotnet add package DotnetTimecode

or using the Nuget Package Manager

Install-Package DotnetTimecode

Add a reference to the library, then simply construct your objects.

Examples:

using DotnetTimecode;
using DotnetTimecode.Enums;

var foo = new Timecode(Framerate.fps30);
var bar = new Timecode(10, 00, 00, 00, Framerate.fps59_94_DF);
var baz = new Timecode("10:00:00:00", Framerate.fps24);

foo.ToString() // "00:00:00:00"
bar.AddMinutes(-61).ToString(); // "08:59:00;00"
baz.ConvertFramerate(Framerate.fps25).ToString(); // "09:36:00:00"

Public endpoints

Constructors

Timecode(Enums.Framerate framerate);
Timecode(int hour, int minute, int second, int frame, Enums.Framerate framerate);
Timecode(string timecode, Enums.Framerate framerate);

Object methods

string timecodeString = timecodeObj.ToString();
timecodeObj.AddHours(int hours);
timecodeObj.AddMinutes(int minutes);
timecodeObj.AddSeconds(int seconds);
timecodeObj.AddFrames(int frames);
timecodeObj.ConvertFramerate(Enums.Framerate targetFramerate);

Static methods

string timecodeString = Timecode.AddHours(string timecode, int hours);
string timecodeString = Timecode.AddMinutes(string timecode, int minutes);
string timecodeString = Timecode.AddSeconds(string timecode, int seconds);
string timecodeString = Timecode.AddFrames(string timecode, int frames);
string timecodeString = Timecode.ConvertFramerate(string timecode, Enums.Framerate originalFramerate, Enums.Framerate targetFramerate);
string timecodeString = Timecode.ConvertSrtTimecodeToTimecode(string srtTimecode, Enums.Framerate framerate);
string srtTimecodeString = Timecode.ConvertTimecodeToSrtTimecode(string timecode, Enums.Framerate framerate);

Object Properties

int hour = timecodeObj.Hour;
int minute = timecodeObj.Minute;
int second = timecodeObj.Second;
int frame = timecodeObj.Frame;
int totalFrames = timecodeObj.TotalFrames;
Enums.Framerate framerate = timecodeObj.Framerate;

Static Properties

string timecodeRegex = Timecode.TimecodeRegexPattern;
string srtTimecodeRegex = Timecode.SrtTimecodeRegexPattern;

Operator Overloading

var tc1 = new Timecode(10, 0, 0, 0, Enums.Framerate.fps23_976); // 10:00:00:00
var tc2 = new Timecode(1, 0, 0, 0, Enums.Framerate.fps23_976); // 01:00:00:00

tc1 + tc2;  // 11:00:00:00
tc1 - tc2;  // 09:00:00:00
tc1 < tc2;  // False
tc1 > tc2;  // True
tc1 <= tc2; // False
tc1 >= tc2; // True
tc1 == tc2; // False
tc1 != tc2; // True

Contributions

How to contribute to the project

See CONTRIBUTING.md and CODE_OF_CONDUCT.md for instructions on how to contribute to the project.

License

Dotnet Timecode is Copyright © 2022 Rasmus Broborg and other contributors under the MIT license.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.1 1,049 10/8/2023
3.1.0 782 11/21/2022
3.0.1 541 11/21/2022
3.0.0 559 11/21/2022
2.0.1 613 11/11/2022
2.0.0 525 11/11/2022
1.2.1 611 9/27/2022
1.1.2 668 9/27/2022
1.1.1 620 9/27/2022
1.0.0 650 9/27/2022

Adds support for non drop framerates, srt timecodes, static operations, XML comments, operator overloading.