Parrot-Developers / olympe

Python controller library for Parrot Drones
https://developer.parrot.com/docs/olympe/index.html
BSD 3-Clause "New" or "Revised" License
80 stars 36 forks source link

Video decoding issue using Olympe on Ubuntu 22.04 #50

Open iaamp opened 1 year ago

iaamp commented 1 year ago

Issue: Video stream decoding is not working on Ubuntu 22.04 with Olympe v7.5.0 and a Parrot Anafi drone. Specifically, Olympe tries to decode via CUDA, but the machine doesn't have a Nvidia GPU, only integrated Intel GPU.

Related code snippet:

        self.drone.streaming.set_callbacks(
            raw_cb = self.yuv_frame_cb,
            start_cb = self.start_cb,
            end_cb = self.stop_cb,
            flush_raw_cb = self.flush_cb,
        )

        self.drone(olympe_camera.set_streaming_mode(
            cam_id=0,
            # https://developer.parrot.com/docs/olympe/arsdkng_camera.html#olympe.enums.camera.streaming_mode
            value=olympe_camera_enums.streaming_mode(0)
        ))

        self.drone.streaming.start()

Error message:

[bash-1] 2023-07-26 12:34:18,888 [ERROR]    ulog - pdraw_sink_coded_video - VideoDecoder#2: coded video media format H264/AVCC not supported
[bash-1] 2023-07-26 12:34:18,888 [INFO]     olympe.pdraw.Skycontroller 3 - _media_added - _media_added id : 1
[bash-1] 2023-07-26 12:34:18,889 [ERROR]    ulog - vdec_ffmpeg - av: Cannot load libcuda.so.1
[bash-1] 2023-07-26 12:34:18,889 [ERROR]    ulog - vdec_ffmpeg - av: Could not dynamically load CUDA
[bash-1] 2023-07-26 12:34:18,890 [ERROR]    ulog - vdec_ffmpeg - create:1230: av_hwdevice_ctx_create err=1313558101(Unknown error 1313558101)
[bash-1] 2023-07-26 12:34:18,890 [ERROR]    ulog - pdraw_vdec - start:176: VideoDecoder#4: vdec_new err=1313558101(Unknown error 1313558101)
[bash-1] 2023-07-26 12:34:18,890 [ERROR]    ulog - pdraw_session - addDecoderForMedia:2063: decoder->start err=1313558101(Unknown error 1313558101)
[bash-1] 2023-07-26 12:34:18,890 [ERROR]    ulog - pdraw_session - onOutputMediaAdded:1804: addDecoderForMedia err=1313558101(Unknown error 1313558101)
[bash-1] 2023-07-26 12:34:18,890 [INFO]     olympe.pdraw.Skycontroller 3 - _media_added - _media_added id : 2

Expectation: Olympe automatically detects CUDA availability. Alternatively, an option to specify decoders via call from Python.

Version info: Linux 5.19.0-38-generic #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Python v3.10.6 virtualenv v20.19.0 Olympe v7.5.0

I am not sure whether this is an issue with Olympe or with the system. However, i am stuck in resolving the issue myself, and i believe this setting is not accessible from the outside. Changing environment variables like LIBVA_DRIVER_NAME=i965 did not make a difference.

Any fixes, workarounds or help would be appreciated!