Skip to content

Commit

Permalink
Add configuration to set how many threads each ffmpeg process can use
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleMaas committed Sep 20, 2023
1 parent 15d2174 commit ed13f53
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions cms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@

FFMPEG_COMMAND = "ffmpeg" # this is the path
FFPROBE_COMMAND = "ffprobe" # this is the path
FFMPEG_THREADS = 0 # default - use optimal number of threads
MP4HLS = "mp4hls"

MASK_IPS_FOR_ACTIONS = True
Expand Down
2 changes: 2 additions & 0 deletions files/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ def get_base_ffmpeg_command(

base_cmd = [
settings.FFMPEG_COMMAND,
"-threads",
str(settings.FFMPEG_THREADS),
"-y",
"-i",
input_file,
Expand Down
2 changes: 2 additions & 0 deletions files/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,8 @@ def encoding_file_save(sender, instance, created, **kwargs):
ff.write("file {}\n".format(f))
cmd = [
settings.FFMPEG_COMMAND,
"-threads",
str(settings.FFMPEG_THREADS),
"-y",
"-f",
"concat",
Expand Down
2 changes: 2 additions & 0 deletions files/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def chunkize_media(self, friendly_token, profiles, force=True):
chunks_file_name += ".mkv"
cmd = [
settings.FFMPEG_COMMAND,
"-threads",
str(settings.FFMPEG_THREADS),
"-y",
"-i",
media.media_file.path,
Expand Down

0 comments on commit ed13f53

Please sign in to comment.