Pepguy commited on
Commit
e285d1f
·
verified ·
1 Parent(s): 6fed98d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -1,7 +1,16 @@
1
  from fastapi import FastAPI
 
2
 
3
  app = FastAPI()
4
 
5
  @app.get("/")
6
  def greet_json():
7
  return {"Hello": "World!"}
 
 
 
 
 
 
 
 
 
1
  from fastapi import FastAPI
2
+ import subprocess
3
 
4
  app = FastAPI()
5
 
6
  @app.get("/")
7
  def greet_json():
8
  return {"Hello": "World!"}
9
+
10
+ @app.get("/ffmpeg-version")
11
+ def get_ffmpeg_version():
12
+ try:
13
+ result = subprocess.run(["ffmpeg", "-version"], capture_output=True, text=True)
14
+ return {"ffmpeg_version": result.stdout.splitlines()[0]} # Return only the first line
15
+ except FileNotFoundError:
16
+ return {"error": "FFmpeg is not installed or not found in PATH"}