DELETE file after render & ADD properties
This commit is contained in:
@@ -22,7 +22,7 @@ public class EditController {
|
||||
return new ResponseEntity<>(uuid, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/convert/{uuid}")
|
||||
@GetMapping("/process/{uuid}")
|
||||
public ResponseEntity<String> convert(@PathVariable("uuid") String uuid) {
|
||||
editService.jobReady(uuid);
|
||||
return new ResponseEntity<>(uuid, HttpStatus.OK);
|
||||
|
||||
@@ -53,6 +53,7 @@ public class Job implements Runnable {
|
||||
|
||||
|
||||
this.status = JobStatus.FINISHED;
|
||||
file.delete();
|
||||
logger.info("Job {} finished", uuid);
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class FfmpegService {
|
||||
private Float fps;
|
||||
private Float fileSize;
|
||||
|
||||
private static final float AUDIO_RATIO = 0.2f;
|
||||
private static final float AUDIO_RATIO = 0.15f;
|
||||
private static final float BITRATE_MULTIPLIER = 0.9f;
|
||||
|
||||
private Pattern timePattern = Pattern.compile("time=([\\d:.]+)");
|
||||
@@ -56,7 +56,7 @@ public class FfmpegService {
|
||||
|
||||
private void buildFilters() {
|
||||
List<String> filters = new ArrayList<>();
|
||||
System.out.println(fps);
|
||||
|
||||
if (fps != null) {
|
||||
filters.add("fps=" + fps);
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class FfmpegService {
|
||||
|
||||
private void buildBitrate() {
|
||||
float length = endPoint - startPoint;
|
||||
float bitrate = (fileSize / length) * BITRATE_MULTIPLIER;
|
||||
float bitrate = ((fileSize * 8) / length) * BITRATE_MULTIPLIER;
|
||||
|
||||
float video_bitrate = bitrate * (1 - AUDIO_RATIO);
|
||||
float audio_bitrate = bitrate * AUDIO_RATIO;
|
||||
@@ -128,10 +128,10 @@ public class FfmpegService {
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
|
||||
if (line.startsWith("out_time_ms=")) {
|
||||
out_time_ms = parseLong(line.substring("out_time_ms=".length()));
|
||||
}
|
||||
logger.debug(line);
|
||||
// if (line.startsWith("out_time_ms=")) {
|
||||
// out_time_ms = parseLong(line.substring("out_time_ms=".length()));
|
||||
// }
|
||||
}
|
||||
|
||||
logger.info("FFMPEG finished");
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ddf.vodsystem.services;
|
||||
|
||||
import com.ddf.vodsystem.entities.Job;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -21,7 +22,9 @@ import org.slf4j.LoggerFactory;
|
||||
@Service
|
||||
public class UploadService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(UploadService.class);
|
||||
private static final String UPLOAD_DIR = "videos/";
|
||||
|
||||
@Value("${temp.vod.storage}")
|
||||
private String UPLOAD_DIR;
|
||||
private final JobService jobService;
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -4,6 +4,7 @@ spring.application.name=vodSystem
|
||||
# VODs
|
||||
spring.servlet.multipart.max-file-size=2GB
|
||||
spring.servlet.multipart.max-request-size=2GB
|
||||
temp.vod.storage=videos/
|
||||
|
||||
# Database
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
|
||||
@@ -12,4 +13,7 @@ spring.datasource.password=mypassword
|
||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.show-sql=true
|
||||
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
|
||||
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
|
||||
|
||||
# Logging
|
||||
logging.level.org.springframework.web=DEBUG
|
||||
Reference in New Issue
Block a user