livekit / python-sdks

LiveKit real-time and server SDKs for Python
https://docs.livekit.io
Apache License 2.0
80 stars 26 forks source link

FFmpeg H.264 decoder not found #95

Closed anhtu-phan closed 8 months ago

anhtu-phan commented 8 months ago

Hello,

I am trying to get video feed from one of other participant through track_subscribed event (as code below)

async def receive_frames(stream: rtc.VideoStream):
       async for frame in video_stream:
            print(len(frame))

@room.on("track_subscribed")
def on_track_subscribed(track: rtc.Track, publication: rtc.RemoteTrackPublication, participant: rtc.RemoteParticipant):
        if track.kind == rtc.TrackKind.KIND_VIDEO:
            nonlocal video_stream
            if video_stream is not None:
                # only process the first stream received
                return

            print(f"subscribed to track: {track.name} pub id {publication.sid}")
            video_stream = rtc.VideoStream(track)
            task = asyncio.create_task(receive_frames(video_stream))
            tasks.add(task)
            task.add_done_callback(tasks.remove)`

But I got the error below and does not receive any frame

[2023-11-12T12:03:51Z ERROR libwebrtc] (h264_decoder_impl.cc:312): FFmpeg H.264 decoder not found.
[2023-11-12T12:03:51Z ERROR libwebrtc] (decoder_database.cc:148): Failed to initialize decoder.

I am using python3.10 and latest version of LiveKit-sdk (install through pip install livekit and pip install livekit-api

Could you please guide me how to fix this error.

Thank you!

davidzhao commented 8 months ago

related to https://github.com/livekit/rust-sdks/issues/169

anhtu-phan commented 8 months ago

@davidzhao thanks for your answer,

it means that it is the bug of the library and have not yet had the solution yet?

davidzhao commented 8 months ago

yes, we are aware of the issue and will have a fix soon.

theomonnom commented 8 months ago

Fixed in rtc-v0.6.0