MCPcopy
hub / github.com/ladaapp/lada / get_audio_codec

Function get_audio_codec

lada/utils/audio_utils.py:40–45  ·  view source on GitHub ↗
(file_path: str)

Source from the content-addressed store, hash-verified

38 os.remove(tmp_v_video_input_path)
39
40def get_audio_codec(file_path: str) -> Optional[str]:
41 cmd = f"ffprobe -loglevel error -select_streams a:0 -show_entries stream=codec_name -of default=nw=1:nk=1"
42 cmd = cmd.split() + [file_path]
43 cmd_result = subprocess.run(cmd, stdout=subprocess.PIPE, startupinfo=os_utils.get_subprocess_startup_info())
44 audio_codec = cmd_result.stdout.decode('utf-8').strip().lower()
45 return audio_codec if len(audio_codec) > 0 else None
46
47def is_output_container_compatible_with_input_audio_codec(audio_codec: str, output_path: str) -> bool:
48 file_extension = os.path.splitext(output_path)[1]

Callers 1

Calls 3

splitMethod · 0.80
decodeMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected