From 6e3e0f105a0699bef89bf6db5b4b449582327ea1 Mon Sep 17 00:00:00 2001 From: MarcWeberFS Date: Wed, 13 Nov 2024 18:12:37 +0100 Subject: [PATCH] Update Dockerfile to set permissions on temp directory and modify FFmpeg command to use absolute paths --- video-downloader-backend/Dockerfile | 4 ++-- .../main/java/ch/marc/delegates/WriteCaptionsOntoVideo.java | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/video-downloader-backend/Dockerfile b/video-downloader-backend/Dockerfile index fd38db6..5d198e1 100644 --- a/video-downloader-backend/Dockerfile +++ b/video-downloader-backend/Dockerfile @@ -11,8 +11,8 @@ RUN apt-get update && \ # Set working directory WORKDIR /app -# Create a temporary directory for file operations -RUN mkdir /app/temp +# Set permissions on the temp directory and its contents +RUN mkdir -p /tmp && chmod 777 /tmp # Copy the built JAR file into the container COPY target/*.jar app.jar diff --git a/video-downloader-backend/src/main/java/ch/marc/delegates/WriteCaptionsOntoVideo.java b/video-downloader-backend/src/main/java/ch/marc/delegates/WriteCaptionsOntoVideo.java index 5394962..54d13fd 100644 --- a/video-downloader-backend/src/main/java/ch/marc/delegates/WriteCaptionsOntoVideo.java +++ b/video-downloader-backend/src/main/java/ch/marc/delegates/WriteCaptionsOntoVideo.java @@ -74,7 +74,10 @@ private void embedSubtitles(String videoFilePath, String srtFilePath, String out String formattedSrtPath = utf8SrtPath.toString().replace("\\", "/").replace(":", "\\:"); String command = String.format("ffmpeg -i \"%s\" -vf subtitles='%s' -c:a copy \"%s\"", - videoFilePath, formattedSrtPath, outputFilePath); + new File(videoFilePath).getAbsolutePath(), + new File(formattedSrtPath).getAbsolutePath(), + new File(outputFilePath).getAbsolutePath()); + System.out.println("Executing FFmpeg command: " + command);