Can't get cloud video working


#1

I’m having trouble getting the list of streams from my drone. I can see live video feed when connected to flytconsole, using flytos_wifi. But when i try to use the cloud live feed it says it cant get video stream list.
Tried to use python cloud rest exaple, but it return 404 response. I can connect to drone thogh, send arm and disarm commands and get telemetry.

EDIT:
I am using cloud cliente sample to try acessing the list of streams from the drone. Here the code i´m trying to use:
printResponse( "list_streams ",put('http://dev.flytbase.com/rest/ros/' + namespace + ':8080/list_streams',headers = headers,data=json.dumps({"namespace": namespace})))

EDIT2:
I´ve noticed i was using /rest/ros instead of /rest only, chenged it in code and still no results. When triing POST with the URL ‘http://dev.flytbase.com/rest/list_streams’ i get 404 not found… when i try POST with the URL ‘http://dev.flytbase.com/rest:8080/list_streams’, i get 502 bad gateway error. Please help


#2

@Dhirajd please help.


#3

I think you need to include the namespace into your request between ros/ and /list_streams.


#4

@Marcello the APIs that you are using are limited to video streaming over local network. So, they are not really useful to you over the cloud.

If your companion computer is a Raspberry Pi then you can use the following API, to have the FlytOS on raspi stream the video feed to a RTMP target of your choice (youtube, facebook, your custom Wowza server). The RTMP target should be accessible on the public web.

I’m providing a python snippet comprising the API.

    import json
    from requests import get, put
    headers = {'Authorization': 'Token 2345jkh1hjkhjk3l42h5j234l5hj234h5l', 'VehicleID': 'hjk2435kl'}
    res = put('https://dev.flytbase.com/rest/ros/<namespace>/video_streaming/start_raspicam_stream', headers=headers,
         data=json.dumps({"image_width": 0, "image_height": 0, "framerate": 0, "brightness": 0, "saturation": 0,
                          "flip": True, "remote_url":"rtmp://50.39.61.34:1935/livedrone/myStream",
                          "remote_target": True, 'bitrate':0}))

    print res.status_code, res.content

The URL in payload data should be replaced by your own server URL or the RTMP target. E.g, Follow only the ‘setup the youtube live event’ part from following tutorial. At the end of the process, you will get a rtmp target from youtube video manager. You can use that URL in above API to have the raspi stream video to youtube live event.

After you are done, you can call following API to stop the video stream.

res = get('https://dev.flytbase.com/rest/ros/<namespace>/video_streaming/stop_raspicam_stream', headers=headers)

As @lesterthomas correctly suggested, you have to replace part with actual namespace, you can get it by making a get namespace API call to FlytOS. Typically, its value is ‘flytos’. Replace authorization token and vehicle ID with your drones credentials. You can find them in myflytbase.com portal, ‘my devices’ tab if you have the cloud trial active.


#5

I´ve modified the corrections, but when i call this API, it returns

{u'message': u'FlytOS namespace is  flytos', u'param_info': {u'param_value': u'flytos', u'param_id': u'global_namespace'}, u'success': True}
Your flytos is connected through cloud client
video_streaming/start_raspicam_streamService not available
Content "Service /flytos/video_streaming/start_raspicam_stream does not exist"

I did chenged the namespace to my global namespace after calling get_global_namespace api.
By checking Raspberry Pi console, running “rosservice list”, there is no such service as /flytos/video_streaming/start_raspicam_stream. Probably some node did not startup correctly… is there any node that is missing? Here the runlog ros startup section:

NODES
  /flytos/
    core_api_navigation (core_api_nodes/navigation_api)
    core_api_param (core_api_nodes/param_api)
    core_api_payload (core_api_nodes/payload_api)
    core_api_setup (core_api_nodes/setup_api)
    flyt_cl (flyt_remote_link/flyt_remote_client)
    flyt_ms_node (flyt_ms/flyt_ms_node)
    flytcam (usb_cam/usb_cam_node)
    image_capture (vision_apps/image_capture)
    mavros (mavros/mavros_node)
    navigation_server (navigation_util/navigation_server)
    rosapi (rosapi/rosapi_node)
    rostful (rostful/devserver)
    video_streaming (vision_apps/video_streaming)
    web_video_server (web_video_server/web_video_server)

and then i get

auto-starting new master
e[1mprocess[master]: started with pid [2571]e[0m
e[1mROS_MASTER_URI=http://localhost:11311e[0m
e]2;/flyt/flytos/flytcore/share/core_api/launch/core_api_autopilot.launch http://localhost:11311a
e[1msetting /run_id to ca057b9a-852d-11e8-b940-b827ebe8bba4e[0m
e[1mprocess[rosout-1]: started with pid [2584]e[0m
started core service [/rosout]
e[1mprocess[flytos/mavros-2]: started with pid [2602]e[0m
e[1mprocess[flytos/core_api_param-3]: started with pid [2603]e[0m
e[1mprocess[flytos/core_api_setup-4]: started with pid [2604]e[0m
e[1mprocess[flytos/core_api_navigation-5]: started with pid [2605]e[0m
e[1mprocess[flytos/core_api_payload-6]: started with pid [2606]e[0m
e[1mprocess[flytos/navigation_server-7]: started with pid [2625]e[0m
e[1mprocess[flytos/rostful-8]: started with pid [2642]e[0m
+ python -tt -m rostful run -h 0.0.0.0 -p 80 -s tornado '--ros-arg=~connections_list:=/rocon/connection_cache/list' '--ros-arg=~connections_diff:=/rocon/connection_cache/diff' --ros-arg=__name:=rostful --ros-arg=__log:=/root/.ros/log/ca057b9a-852d-11e8-b940-b827ebe8bba4/flytos-rostful-8.log
e[1mprocess[flytos/rosapi-9]: started with pid [2678]e[0m
e[1mprocess[flytos/flyt_cl-10]: started with pid [2692]e[0m
e[1mprocess[flytos/flyt_ms_node-11]: started with pid [2706]e[0m
e[1mprocess[flytos/flytcam-12]: started with pid [2719]e[0m
e[1mprocess[flytos/image_capture-13]: started with pid [2745]e[0m
e[1mprocess[flytos/web_video_server-14]: started with pid [2752]e[0m
e[1mprocess[flytos/video_streaming-15]: started with pid [2767]e[0m
e[0m[ INFO] [1531329245.881512012]: Waiting For connections on 0.0.0.0:8080e[0m
e[0m[ INFO] [1531329245.943990658]: FCU URL: /dev/ttyAMA0:921600e[0m
e[0m[ INFO] [1531329245.952303574]: serial0: device: /dev/ttyAMA0 @ 921600 bpse[0m
e[0m[ INFO] [1531329245.961747897]: GCS URL: tcp-l://:5760e[0m
e[0m[ INFO] [1531329245.981164408]: tcp1: Bind address: 0.0.0.0:5760e[0m
e[0m[ INFO] [1531329246.136682585]: [LIC] license file valid, checking for date validitye[0m
registered capabilities (classes):
 - rosbridge_library.capabilities.call_service.CallService
 - rosbridge_library.capabilities.advertise.Advertise
 - rosbridge_library.capabilities.publish.Publish
 - rosbridge_library.capabilities.subscribe.Subscribe
 - 
 - rosbridge_library.capabilities.advertise_service.AdvertiseService
 - rosbridge_library.capabilities.service_response.ServiceResponse
 - rosbridge_library.capabilities.unadvertise_service.UnadvertiseService
Azure sdk not found. Try 'sudo pip install azure-storage-blob'
e[0m[ INFO] [1531329247.802965032]: camera calibration URL: file:///flyt/flytos/flytcore/share/vision_apps/calibration/calibration.yamle[0m
e[33m[ WARN] [1531329247.822553053]: [head_camera] does not match name narrow_stereo in file /flyt/flytos/flytcore/share/vision_apps/calibration/calibration.yamle[0m
e[0m[ INFO] [1531329247.823667480]: Starting 'head_camera' (/dev/video0) at 1280x720 via mmap (mjpeg) at 30 FPSe[0m
[ERROR] [1531329249.646590]: Commercial License not found exiting Raspberry-Pi video streaming node.
e[1m[flytos/video_streaming-15] process has finished cleanly
log file: /root/.ros/log/ca057b9a-852d-11e8-b940-b827ebe8bba4/flytos-video_streaming-15*.loge[0m

Note that on the last line, it says Commercial License not found - exit vídeo streaming… Is there a way for me to test this feature without buying comercial license? We need to test this in the lab for validation of our solution


#6

You must be running on a personal FlytOS license then. This API is available in commercial version only, as of now.

Similar functionality can be obtained by manually running following command.

raspivid -n -vf -hf -t 0 -w 1280 -h 720 -fps 25 -g 10 -b 300000 -fl -lev 4.2 -o - | ffmpeg -i - -c:v copy -an -tune zerolatency -b 1000k -r 25 -f flv rtmp://IP:port/livestreamname/streamname

Replace the RTMP url parameters with your server details.


#7

I’m using Raspberry as companion computer but I have a usb camera. Raspivid is not working with this USB camera. I get this following errors:

mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
mmal: Failed to create camera component
mmal: main: Failed to create camera component
mmal: Camera is not detected. Please check carefully the camera module is installed correctly

the first section uses raspivid which is used with raspi cam, but I’m using regular USB camera, actually, I’m using a GoPro, connected to a usb video capture card (hornettek) than to raspberry pi.


#8

I do not think raspivid will work with USB cameras. @Dhirajd can you please confirm.


#9

Yes, indeed raspivid won’t work with USB cameras, also all above implementations won’t work with USB cameras for cloud video streaming. Please implement this feature ASAP, or update you documentation specifying that cloud video streaming is only supported with raspicam cameras.


#10

Yes, the cloud video streaming API on Raspberry Pi works with only Raspberry Pi camera module. However, custom ffmpeg/gstreamer commands can be used to stream other cameras to FlytBase video streaming service. The above-mentioned API handles just one type of camera. There is no restriction on sending RTMP streams from custom pipelines to FlytBase cloud video streaming service.

We can not provide a generic API which will work with all cameras because of variations in interfaces, drivers, and many other parameters. However, we will try to help you with a suitable custom bash command that can be used to stream your USB camera.