|
1 | 1 | # java-smpte-timecode |
| 2 | +A minimalist java library for dealing with SMPTE timecodes. Supports all major broadcast timecodes. |
| 3 | + |
2 | 4 |  |
| 5 | + |
| 6 | + |
| 7 | +# Usage: |
| 8 | + |
| 9 | +Create an immutable [TimecodeRecord](https://github.com/moormanm/java-smpte-timecode/blob/master/src/main/java/org/moormanity/smpte/timecode/TimecodeRecord.java) from a string and framerate: |
| 10 | + |
| 11 | +``` |
| 12 | +TimecodeRecord timecode = TimecodeOperations.fromTimecodeString("01:00:00;99", FrameRate._29_97_drop)); |
| 13 | +``` |
| 14 | + |
| 15 | +All supported framerates are in the [FrameRate.java](https://github.com/moormanm/java-smpte-timecode/blob/master/src/main/java/org/moormanity/smpte/timecode/FrameRate.java) enum. |
| 16 | + |
| 17 | +Create an immutable TimecodeRecord from an elapsed frame count and framerate: |
| 18 | +``` |
| 19 | +TimecodeOperations.fromElapsedFrames(10044, FrameRate._25); |
| 20 | +``` |
| 21 | + |
| 22 | +Subtract or add timecodes to create new ones: |
| 23 | +``` |
| 24 | +TimecodeRecord a = TimecodeOperations.fromTimecodeString("23:30:00;00", FrameRate._29_97_drop); |
| 25 | +TimecodeRecord b = TimecodeOperations.fromTimecodeString("01:00:00;00", FrameRate._29_97_drop); |
| 26 | +TimecodeRecord aMinusB = TimecodeOperations.subtract(a,b); |
| 27 | + |
| 28 | +TimecodeRecord a = TimecodeOperations.fromTimecodeString("23:30:00;00", FrameRate._29_97_drop); |
| 29 | +TimecodeRecord b = TimecodeOperations.fromTimecodeString("01:00:00;00", FrameRate._29_97_drop); |
| 30 | +TimecodeRecord aPlusB = TimecodeOperations.add(a,b); |
| 31 | +``` |
| 32 | + |
| 33 | +Get the total elapsed frames of a TimecodeRecord: |
| 34 | +``` |
| 35 | +TimecodeRecord a = TimecodeOperations.fromTimecodeString("23:30:00;00", FrameRate._29_97_drop); |
| 36 | +int totalElapsedFrames = TimecodeOperations.toElapsedFrameCount(a); |
| 37 | +``` |
| 38 | + |
| 39 | +Format a TimecodeRecord as a string: |
| 40 | +``` |
| 41 | +TimecodeRecord a = TimecodeOperations.fromTimecodeString("23:30:00;00", FrameRate._29_97_drop); |
| 42 | +String timecodeString = TimecodeOperations.toTimecodeString(a); |
| 43 | +``` |
| 44 | + |
| 45 | + |
| 46 | +## Supported Timecode Frame Rates |
| 47 | + |
| 48 | +| Film / ATSC / HD | PAL / SECAM / DVB / ATSC | NTSC / ATSC / PAL-M | NTSC Non-Standard | ATSC | |
| 49 | +| ---------------- | ------------------------ | ------------------- | ----------------- | ---- | |
| 50 | +| 23.976 | 25 | 29.97 | 30 DF | 30 | |
| 51 | +| 24 | 50 | 29.97 DF | 60 DF | 60 | |
| 52 | +| 24.98 | 100 | 59.94 | 120 DF | 120 | |
| 53 | +| 47.952 | | 59.94 DF | | | |
| 54 | +| 48 | | 119.88 | | | |
| 55 | +| | | 119.88 DF | | | |
| 56 | + |
| 57 | + |
| 58 | + |
0 commit comments