20 modularize the code to split up large classes (#21)
* MODULARIZE ClipService by introducing CompressionService, MetadataService, and ThumbnailService * ADD deleteClip functionality to ClipController
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.ddf.vodsystem.services.media;
|
||||
|
||||
import com.ddf.vodsystem.dto.CommandOutput;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ThumbnailService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ThumbnailService.class);
|
||||
|
||||
public CommandOutput createThumbnail(File inputFile, File outputFile, Float timeInVideo) throws IOException, InterruptedException {
|
||||
logger.info("Creating thumbnail at {} seconds", timeInVideo);
|
||||
|
||||
List<String> command = List.of(
|
||||
"ffmpeg",
|
||||
"-ss", timeInVideo.toString(),
|
||||
"-i", inputFile.getAbsolutePath(),
|
||||
"-frames:v", "1",
|
||||
outputFile.getAbsolutePath()
|
||||
);
|
||||
|
||||
return CommandRunner.run(command);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user