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