use of org.fagu.fmv.utils.time.Time in project fmv by f-agu.
the class Append method appendAudioOrVideo.
/**
* @param sourceNum
* @param args
*/
private void appendAudioOrVideo(int sourceNum, String[] args) {
if (args.length != 3) {
getPrinter().println("usage: append <num-source> <start-time> <duration>");
return;
}
try {
Time startTime = Time.parse(args[1]);
Duration duration = Duration.parse(args[2]);
ConcatExecutable concatExecutable = getConcatExecutable();
if (concatExecutable == null) {
return;
}
CutExecutable cutExecutable = new CutExecutable(project, startTime, duration);
cutExecutable.setSource(new SourceSource(project, sourceNum));
concatExecutable.add(cutExecutable);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of org.fagu.fmv.utils.time.Time in project fmv by f-agu.
the class FadeAudioVideo method run.
/**
* @see org.fagu.fmv.cli.Command#run(java.lang.String[])
*/
@Override
public void run(String[] args) {
if (args.length != 4) {
help();
return;
}
// TEST
Optional<Identifiable> identifiableOpt = BaseIdentifiable.findById(project, args[1]);
if (!identifiableOpt.isPresent()) {
println("not found: " + args[1]);
return;
}
FadeType fadeType = FadeType.valueOf(args[0].toUpperCase());
Time startTime = Time.parse(args[2]);
Duration duration = Duration.parse(args[2]);
Identifiable identifiable = identifiableOpt.get();
FadeAudioVideoFilterExec filterExec = new FadeAudioVideoFilterExec(project, fadeType, startTime, duration);
filterExec.add(identifiable);
}
use of org.fagu.fmv.utils.time.Time in project fmv by f-agu.
the class ByDuration method etaPart.
/**
* @return
*/
@Override
public Part etaPart() {
double durTotal = duration.toSeconds();
long startTime = System.currentTimeMillis();
return new ETAPart(status -> {
Time time = progress.getTime();
if (time != null) {
double currentSeconds = time.toSeconds();
if (currentSeconds > 0) {
double remainSeconds = durTotal - currentSeconds;
int milliseconds = (int) (remainSeconds * (int) (System.currentTimeMillis() - startTime) / currentSeconds);
return milliseconds / 1000;
}
}
return null;
});
}
use of org.fagu.fmv.utils.time.Time in project fmv by f-agu.
the class CropDetection method add.
/**
* @param log
*/
void add(String log) {
Matcher matcher = LOG_PATTERN.matcher(log);
if (matcher.matches()) {
CropSize cropSize = new CropSize(matcher, totalCount);
int pts = Integer.parseInt(matcher.group(9));
Time time = Time.parse(matcher.group(10));
// parse crop=...:...:...:... ?
cropSize.startPTS = pts;
cropSize.startTime = time;
totalCount.incrementAndGet();
if (cropSizes.isEmpty()) {
cropSizes.add(cropSize);
} else {
CropSize previousCropSize = cropSizes.get(cropSizes.size() - 1);
previousCropSize.endPTS = pts;
previousCropSize.endTime = time;
if (previousCropSize.equals(cropSize)) {
previousCropSize.count++;
} else {
cropSizes.add(cropSize);
doneCropSize.forEach(c -> c.accept(previousCropSize));
}
}
}
}
use of org.fagu.fmv.utils.time.Time in project fmv by f-agu.
the class Drawtext method enableTime.
/**
* @param startTime
* @param duration
* @return
*/
public Drawtext enableTime(Time startTime, Duration duration) {
Time endTime = Time.valueOf(startTime.toSeconds() + duration.toSeconds());
parameter("enable", "'between(t," + startTime.toSeconds() + "," + endTime.toSeconds() + ")'");
return this;
}
Aggregations