AttributeError: 'struct_pdraw_media_info' object has no attribute '_2'

Hi. I try to run streaming.py and i get below error. This is using simulated anafi drone. How can i can use drone camera streaming in python?

Olympe streaming example output dir: /tmp/olympe_streaming_test__mmwbg0f
2021-04-24 23:58:48,481 [ERROR] 	olympe.media.ANAFI-0000000 - _get_all_media - 541 Server Error: Media Not Yet Indexed for url: http://10.202.0.1/api/v1/media/medias
2021-04-24 23:58:48,481 [WARNING] 	olympe.media.ANAFI-0000000 - _websocket_connect_cb - Media are not yet indexed
2021-04-24 23:58:48,662 [WARNING] 	olympe.drone.ANAFI-0000000 - _recv_cmd_cb - Unknown message id 0xa1000001
2021-04-24 23:58:48,663 [WARNING] 	olympe.drone.ANAFI-0000000 - _recv_cmd_cb - Unknown message id 0xa2000005
2021-04-24 23:58:48,663 [WARNING] 	olympe.drone.ANAFI-0000000 - _recv_cmd_cb - Unknown message id 0xa2000004
2021-04-24 23:58:48,663 [WARNING] 	olympe.drone.ANAFI-0000000 - _recv_cmd_cb - Unknown message id 0xa3000004
2021-04-24 23:58:48,667 [WARNING] 	olympe.drone.ANAFI-0000000 - _recv_cmd_cb - Unknown message id 0x9d000009
2021-04-24 23:58:48,667 [WARNING] 	olympe.drone.ANAFI-0000000 - _recv_cmd_cb - Unknown message id 0x9d000007
2021-04-24 23:58:48,667 [WARNING] 	olympe.drone.ANAFI-0000000 - _recv_cmd_cb - Unknown message id 0x9f000002
2021-04-24 23:58:48,667 [WARNING] 	olympe.drone.ANAFI-0000000 - _recv_cmd_cb - Unknown message id 0x9f000003
2021-04-24 23:58:48,667 [WARNING] 	olympe.drone.ANAFI-0000000 - _recv_cmd_cb - Unknown message id 0x9f000006
2021-04-24 23:58:48,667 [WARNING] 	olympe.drone.ANAFI-0000000 - _recv_cmd_cb - Unknown message id 0xa5000002
2021-04-24 23:58:48,835 [WARNING] 	olympe.drone.ANAFI-0000000 - _recv_cmd_cb - Unknown message id 0x9f000001
2021-04-24 23:58:48,835 [WARNING] 	olympe.drone.ANAFI-0000000 - _recv_cmd_cb - Unknown message id 0xa5000001
Takeoff if necessary...
Traceback (most recent call last):
[h264 @ 0x7fe6cc045fc0] Reinit context to 1280x720, pix_fmt: yuv420p
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "/home/sevi/code/parrot-groundsdk/out/olympe-linux/final/usr/lib/python/site-packages/olympe_deps.py", line 81, in <lambda>
    type_((lambda callback: lambda *args: callback(*args))(
  File "/home/sevi/code/parrot-groundsdk/packages/olympe/src/olympe/arsdkng/pdraw.py", line 840, in _media_added
    if (media_info.contents._2.video.format !=
AttributeError: 'struct_pdraw_media_info' object has no attribute '_2'
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "/home/sevi/code/parrot-groundsdk/out/olympe-linux/final/usr/lib/python/site-packages/olympe_deps.py", line 81, in <lambda>
    type_((lambda callback: lambda *args: callback(*args))(
  File "/home/sevi/code/parrot-groundsdk/packages/olympe/src/olympe/arsdkng/pdraw.py", line 840, in _media_added
    if (media_info.contents._2.video.format !=
AttributeError: 'struct_pdraw_media_info' object has no attribute '_2'
Moving by (1/3)...
Moving by (2/3)...
Moving by (3/3)...
Landing...
Landed

2021-04-24 23:59:20,854 [ERROR] 	olympe.pdraw.ANAFI-0000000 - _media_removed - Received removed event from unknown ID 1
2021-04-24 23:59:20,854 [ERROR] 	olympe.pdraw.ANAFI-0000000 - _media_removed - Received removed event from unknown ID 2
2021-04-24 23:59:20,858 [ERROR] 	olympe.pdraw.ANAFI-0000000 - _unregister_future - Failed to unregister future '<Future at 0x7fe6df8b2e10 state=finished returned bool>'
ffmpeg version 4c955b6c44 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/home/sevi/code/parrot-groundsdk/out/olympe-linux/staging/usr --sysconfdir=/home/sevi/code/parrot-groundsdk/out/olympe-linux/staging/etc ac_cv_prog_YACC= --disable-maintainer-mode --disable-nls --disable-gtk-doc --disable-gtk-doc-html --disable-doxygen-docs --disable-doc --disable-docs --disable-documentation --disable-option-checking --quiet --enable-silent-rules --arch=x86_64 --enable-shared --enable-cross-compile --enable-optimizations --cross-prefix= --target-os=linux --disable-orc --disable-avconv --disable-avplay --disable-avprobe --disable-avserver --disable-avdevice --disable-avresample --disable-filters --disable-yasm --disable-bzlib --disable-stripping --disable-gpl --disable-version3 --disable-nonfree --disable-everything --enable-avcodec --enable-decoder=h264 --enable-protocol=file --enable-demuxer=h264 --enable-muxer=h264 --enable-parser=h264 --enable-muxer=mp4
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
[h264 @ 0x55a3fef37640] Format h264 detected only with low score of 1, misdetection possible!
[h264 @ 0x55a3fef37640] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, h264, from '/tmp/olympe_streaming_test__mmwbg0f/h264_data.264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264, none, 25 tbr, 1200k tbn, 50 tbc
Output #0, mp4, to '/tmp/olympe_streaming_test__mmwbg0f/h264_data.mp4':
Output file #0 does not contain any stream
Traceback (most recent call last):
  File "./stream.py", line 228, in <module>
    streaming_example.postprocessing()
  File "./stream.py", line 210, in postprocessing
    shlex.split('ffmpeg -i {} -c:v copy -y {}'.format(h264_filepath, mp4_filepath)), check=True)
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ffmpeg', '-i', '/tmp/olympe_streaming_test__mmwbg0f/h264_data.264', '-c:v', 'copy', '-y', '/tmp/olympe_streaming_test__mmwbg0f/h264_data.mp4']' returned non-zero exit status 1.

Hi,

I have the same problem when using Olympe 1.7.1, however it seems to work in version 1.7.0.

You can install 1.7.0 by adding -b refs/tags/v1.7.0 to the repo init command described here:
https://developer.parrot.com/docs/olympe/installation.html#clone-the-parrot-groundsdk-repo-workspace

3 Likes

OMG
it worked!!
So maybe 1.7.1 has some bugs.

Yes, i use 1.7.1. I will try. Thanks.