ADD FFMPEG conversion
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package com.ddf.vodsystem.entities;
|
||||
|
||||
import com.ddf.vodsystem.services.FfmpegService;
|
||||
import lombok.Data;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -14,15 +16,16 @@ public class Job implements Runnable {
|
||||
private File file;
|
||||
|
||||
// configs
|
||||
private float startPoint;
|
||||
private float endPoint;
|
||||
private float fps;
|
||||
private int width;
|
||||
private int height;
|
||||
private float fileSize;
|
||||
private Float startPoint;
|
||||
private Float endPoint;
|
||||
private Float fps;
|
||||
private Integer width;
|
||||
private Integer height;
|
||||
private Float fileSize;
|
||||
|
||||
// job status
|
||||
private JobStatus status = JobStatus.PENDING;
|
||||
private Float progress = 0.0f;
|
||||
|
||||
public Job(String uuid, File file) {
|
||||
this.uuid = uuid;
|
||||
@@ -31,10 +34,26 @@ public class Job implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
logger.info("Job started");
|
||||
logger.info("Job {} started", uuid);
|
||||
this.status = JobStatus.RUNNING;
|
||||
|
||||
FfmpegService f = new FfmpegService(file, new File("output.mp4"));
|
||||
f.setStartPoint(startPoint);
|
||||
f.setEndPoint(endPoint);
|
||||
f.setFps(fps);
|
||||
f.setWidth(width);
|
||||
f.setHeight(height);
|
||||
f.setFileSize(fileSize);
|
||||
|
||||
try {
|
||||
f.run();
|
||||
} catch (IOException | InterruptedException e) {
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
this.status = JobStatus.FINISHED;
|
||||
logger.info("Job {} finished", uuid);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user