Skip to content

Commit

Permalink
Dockerfile update. MR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
zfleeman committed Jan 21, 2024
1 parent 3fc45c5 commit 7c462de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ RUN apk add --no-cache ffmpeg
RUN pip install ffmpeg-python
RUN mkdir -p /usr/app/out/
WORKDIR /usr/app/
COPY ffmpeg4discord.py .
COPY . .
ENTRYPOINT ["python", "-u", "ffmpeg4discord.py", "-o", "/usr/app/out/"]
10 changes: 3 additions & 7 deletions twopass/twopass.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ def generate_params(self, codec: str):

if codec == "libx264":
params["pass2"]["c:a"] = "aac"
elif codec == "vp9":
# still a lot of work here
params["pass2"]["c:a"] = "libopus"

params["pass1"].update(**self.bitrate_dict)
params["pass2"].update(**self.bitrate_dict)
Expand All @@ -75,13 +72,12 @@ def generate_params(self, codec: str):

def create_bitrate_dict(self) -> None:
br = math.floor((self.target_filesize * 8192) / self.length - self.audio_br) * 1000
bitrate_dict = {
self.bitrate_dict = {
"b:v": br,
"minrate": br * 0.5,
"maxrate": br * 1.45,
"bufsize": br * 2,
}
self.bitrate_dict = bitrate_dict

def time_calculations(self):
fname = self.fname
Expand Down Expand Up @@ -117,15 +113,15 @@ def apply_video_filters(self, ffinput):
if self.crop:
crop = self.crop.split("x")
video = video.crop(x=crop[0], y=crop[1], width=crop[2], height=crop[3])
self.inputratio = int(crop[2]) / int(crop[3])
self.input_ratio = int(crop[2]) / int(crop[3])

if self.resolution:
video = video.filter("scale", self.resolution)
x = int(self.resolution.split("x")[0])
y = int(self.resolution.split("x")[1])
outputratio = x / y

if self.inputratio != outputratio:
if self.input_ratio != outputratio:
logging.warning(
"Your output resolution's aspect ratio does not match the\ninput resolution's or your croped resolution's aspect ratio."
)
Expand Down

0 comments on commit 7c462de

Please sign in to comment.