Configurable ffmpeg (#13722)

* Install multiple ffmpeg versions and add config to make it configurable

* Update docs

* Run ffprobe too

* Cleanup

* Apply config to go2rtc as well

* Fix ffmpeg bin

* Docs

* Restore path

* Cleanup env var

* Fix ffmpeg path for encoding

* Fix export

* Formatting
This commit is contained in:
Nicolas Mowen
2024-09-13 14:14:51 -06:00
committed by GitHub
parent 641f1244dd
commit 5ff476c6f9
23 changed files with 172 additions and 84 deletions

View File

@@ -378,11 +378,11 @@ def get_jetson_stats() -> dict[int, dict]:
return results
def ffprobe_stream(path: str) -> sp.CompletedProcess:
def ffprobe_stream(ffmpeg, path: str) -> sp.CompletedProcess:
"""Run ffprobe on stream."""
clean_path = escape_special_characters(path)
ffprobe_cmd = [
"ffprobe",
ffmpeg.ffprobe_path,
"-timeout",
"1000000",
"-print_format",
@@ -438,7 +438,9 @@ def auto_detect_hwaccel() -> str:
return ""
async def get_video_properties(url, get_duration=False) -> dict[str, any]:
async def get_video_properties(
ffmpeg, url: str, get_duration: bool = False
) -> dict[str, any]:
async def calculate_duration(video: Optional[any]) -> float:
duration = None
@@ -453,7 +455,7 @@ async def get_video_properties(url, get_duration=False) -> dict[str, any]:
# if cv2 failed need to use ffprobe
if duration is None:
p = await asyncio.create_subprocess_exec(
"ffprobe",
ffmpeg.ffprobe_path,
"-v",
"error",
"-show_entries",