Skip to content

Commit

Permalink
add FFMPEG_ERR_MSG to ffprobe cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Jul 30, 2024
1 parent 0e3463f commit d8dc185
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion chart/model-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ deployments:
thenlper/gte-base
- name: "retro-sadtalker"
image: "crgooeyprodwestus1.azurecr.io/gooey-gpu-retro:9"
image: "crgooeyprodwestus1.azurecr.io/gooey-gpu-retro:10"
autoscaling:
queueLength: 2
minReplicaCount: 3
Expand Down
16 changes: 9 additions & 7 deletions ffmpeg_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,21 @@ class AudioMetadata(BaseModel):
codec_name: typing.Optional[str] = None


FFMPEG_ERR_MSG = (
"Unsupported File Format\n\n"
"We encountered an issue processing your file as it appears to be in a format not supported by our system or may be corrupted. "
"You can find a list of supported formats at [FFmpeg Formats](https://ffmpeg.org/general.html#File-Formats)."
)


def ffprobe_audio(input_path: str) -> AudioMetadata:
text = call_cmd(
"ffprobe",
"-v", "quiet",
"-print_format", "json",
"-show_streams", input_path,
"-select_streams", "a:0",
err_msg=FFMPEG_ERR_MSG,
) # fmt:skip
data = json.loads(text)

Expand All @@ -58,6 +66,7 @@ def ffprobe_video(input_path: str) -> VideoMetadata:
"-print_format", "json",
"-show_streams", input_path,
"-select_streams", "v:0",
err_msg=FFMPEG_ERR_MSG,
) # fmt:skip
data = json.loads(text)

Expand Down Expand Up @@ -132,13 +141,6 @@ def ffmpeg_get_writer_proc(
return subprocess.Popen(cmd_args, stdin=subprocess.PIPE)


FFMPEG_ERR_MSG = (
"Unsupported File Format\n\n"
"We encountered an issue processing your file as it appears to be in a format not supported by our system or may be corrupted. "
"You can find a list of supported formats at [FFmpeg Formats](https://ffmpeg.org/general.html#File-Formats)."
)


def ffmpeg(*args) -> str:
return call_cmd("ffmpeg", "-hide_banner", "-y", *args, err_msg=FFMPEG_ERR_MSG)

Expand Down

0 comments on commit d8dc185

Please sign in to comment.