python-ffmpeg icon indicating copy to clipboard operation
python-ffmpeg copied to clipboard

Unable to get examples to work

Open DWilliamsFF opened this issue 8 months ago • 2 comments

I'm trying to use these binding to read in an rtsp stream so that I can get some of the data sent along with it. I am trying to run examples directly from the docs but they all return the same error.

Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2024.3.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1570, in _exec pydev_imports.execfile(file, globals, locals) # execute the script ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\JetBrains\PyCharm Community Edition 2024.3.2\plugins\python-ce\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:\Users\Dennis\Desktop\Tobii_Pro_Glasses_2_API\examples\sandbox.py", line 322, in asyncio.run(ffrtsp(rtspurl)) File "C:\Users\Dennis\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Users\Dennis\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Dennis\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 686, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\Dennis\Desktop\Tobii_Pro_Glasses_2_API\examples\sandbox.py", line 302, in ffrtsp media = json.loads(await ffprobe.execute()) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Dennis\AppData\Local\Programs\Python\Python312\Lib\site-packages\ffmpeg\asyncio\ffmpeg.py", line 177, in execute self._process = await create_subprocess( ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Dennis\AppData\Local\Programs\Python\Python312\Lib\asyncio\subprocess.py", line 224, in create_subprocess_exec transport, protocol = await loop.subprocess_exec( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Dennis\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 1749, in subprocess_exec transport = await self._make_subprocess_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Dennis\AppData\Local\Programs\Python\Python312\Lib\asyncio\windows_events.py", line 400, in _make_subprocess_transport transp = _WindowsSubprocessTransport(self, protocol, args, shell, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Dennis\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_subprocess.py", line 36, in init self._start(args=args, shell=shell, stdin=stdin, stdout=stdout, File "C:\Users\Dennis\AppData\Local\Programs\Python\Python312\Lib\asyncio\windows_events.py", line 878, in _start self._proc = windows_utils.Popen( ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Dennis\AppData\Local\Programs\Python\Python312\Lib\asyncio\windows_utils.py", line 153, in init super().init(args, stdin=stdin_rfd, stdout=stdout_wfd, File "C:\Users\Dennis\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1026, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\Dennis\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1538, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\JetBrains\PyCharm Community Edition 2024.3.2\plugins\python-ce\helpers\pydev_pydev_bundle\pydev_monkey.py", line 628, in new_CreateProcess return getattr(_subprocess, original_name)(app_name, patch_arg_str_win(cmd_line), *args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] The system cannot find the file specified

I feel there is something fundamental I am doing incorrectly here. Heres the last function i ran for posterity:

`async def ffrtsp(url): ffprobe = FFmpeg(executable="ffprobe").input( url=url, print_format="json", # ffprobe will output the results in JSON format show_streams=None, )

media = json.loads(await ffprobe.execute())

print(f"# Video")
print(f"- Codec: {media['streams'][0]['codec_name']}")
print(f"- Resolution: {media['streams'][0]['width']} X {media['streams'][0]['height']}")
print(f"- Duration: {media['streams'][0]['duration']}")
print("")

print(f"# Audio")
print(f"- Codec: {media['streams'][1]['codec_name']}")
print(f"- Sample Rate: {media['streams'][1]['sample_rate']}")
print(f"- Duration: {media['streams'][1]['duration']}")

`

DWilliamsFF avatar Apr 24 '25 23:04 DWilliamsFF