Package net.bramp.ffmpeg
Class FFmpegUtils
java.lang.Object
net.bramp.ffmpeg.FFmpegUtils
Helper class with commonly used methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic longfromTimecode(String time) Returns the number of nanoseconds this timecode represents.static StringmillisecondsToString(long milliseconds) Deprecated.please use #toTimecode() instead.static StringmillisToSeconds(long millis) Converts milliseconds to a seconds string representation.static longparseBitrate(String bitrate) Converts a string representation of bitrate to a long of bits per second.static StringtoTimecode(long duration, TimeUnit units) Convert the duration to "hh:mm:ss" timecode representation, where ss (seconds) can be decimal.
-
Method Details
-
millisecondsToString
@Deprecated @InlineMe(replacement="FFmpegUtils.toTimecode(milliseconds, MILLISECONDS)", imports="net.bramp.ffmpeg.FFmpegUtils", staticImports="java.util.concurrent.TimeUnit.MILLISECONDS") public static String millisecondsToString(long milliseconds) Deprecated.please use #toTimecode() instead.Convert milliseconds to "hh:mm:ss.ms" String representation.- Parameters:
milliseconds- time duration in milliseconds- Returns:
- time duration in human-readable format
-
toTimecode
Convert the duration to "hh:mm:ss" timecode representation, where ss (seconds) can be decimal.- Parameters:
duration- the duration.units- the unit the duration is in.- Returns:
- the timecode representation.
-
millisToSeconds
Converts milliseconds to a seconds string representation. Uses integer format when there are no fractional seconds, otherwise uses decimal format with up to 3 decimal places and trailing zeros removed.- Parameters:
millis- duration in milliseconds- Returns:
- seconds as a string (e.g. "5", "0.005", "1.5")
-
fromTimecode
Returns the number of nanoseconds this timecode represents. The string is expected to be in the format "hour:minute:second", where second can be a decimal number.- Parameters:
time- the timecode to parse.- Returns:
- the number of nanoseconds or -1 if time is 'N/A'
-
parseBitrate
Converts a string representation of bitrate to a long of bits per second.- Parameters:
bitrate- in the form of 12.3kbits/s- Returns:
- the bitrate in bits per second or -1 if bitrate is 'N/A'
-