Sony Camera Live Stream

I think I have hit a brick wall unless any of you good people have a solution.
I have created a MIT app for controlling motors that rotate and pan a tripod mount for my Sony HX400V camera. Alongside that I run a downloaded Android app to control the camera, which runs an app to allow the remote control using Direct WiFi connection. I would like to achieve all this in my own MIT app.

I have added the Taifun WiFi Extension and this allows me to connect to the camera and I can take photos BUT what I really need is to view the live stream to see what the camera is viewing. I have started the liveview and tried to display it in a WebViewer, whcih doesn’t display it and VideoPlayer, which exits the routine.

I have tried viewing the livestream in the Chrome browser and it just tries to download it as it doesn’t know what to do with it as it is jpg images in a container and doesn’t know how to decode it.

I can find java/VB code to decode it and there are some players, like VLC that I’ve read can decode it as an MJPG but no luck.

Is there an option I have not explored?

Probably Dave. It is probable few if any AI2 developers have a Sony camera like yours.
Have you done a search like this by Googling livestream camera using app inventor ?

You might find an idea there. You found java/VB code; have you found any javascript? AI2 can execute most javascript code in the WebViewer.

You may have to use a small computer (arduino etc.) as a crutch to live stream

Have you tried the html5 video options ?
and not quite the same thing but may help:

Yes I have searched. The camera is irrelevant really, the format is a standard one apparently. I hadn’t realised AI2 could run javascript, so thanks for that. I don’t have control over the format that’s streamed and it has to be a Direct WiFi connection so it’s a case of what I can do in AI2.

I have just looked but it’s not a video file as such and I don’t have control over the format that’s streamed and it has to be a Direct WiFi connection so it’s a case of what I can do in AI2.

I think you have done well so far Dave, given the lack of information on Sony’s website - but I would try emailing Sony Support - see what they say.

Thanks for the response and for looking.
I have downloaded the API reference and found other AI2 examples using JSON so it’s fairly straightforward. Unfortunately the API is unsupported now but I did find a presentation video explaining how to use it which stated that it needed code to extract the JPGs from the livestream, unfortunately it isn’t possible to see what was on the screen. I have contacted Sony about running their own Android app alongside another, which doesn’t work, and their reply was woeful.

I haven’t used java and am unsure how to use it within the AI2 environment but I will carry on digging. I have looked briefly at the suggested HTML 5 option but that seems to be for IP cameras and this is not, it’s a direct WiFi connection so no internet access is available, but I will spend more time on it.

Other people have used ffserver on a Pi BUT to use the Sony Camera Remote app it acts as an access point/server and thus prevents any connection to other WiFi networks and internet,
Ironic as my app uses an arduino uno to control stepper motors via bluetooth :frowning:

Hi Dave

You can receive the Sony WiFi directly on your Arduino (add an ESP32 if you haven’t already) and send the stream from there to your Android device (via Bluetooth). That would allow you to code the image extraction/conversion process in the Arduino Sketch - you might even find a related example on the Arduino site.

Thank you very much, I hadn’t done anything with WiFi on the Arduino, though I’m running the sketch to control my motors but I could get another unless the sketch could do both.
I wonder whether Bluetooth is up to streaming.
Just read a bit and it suggests the Arduino isn’t good at this but using a raspberry Pi.
I’ll give it a look but it’s all getting to sound a bit complex and more hardware.
If I can’t get it running on my mobile I think I’ll just stick with it working as it is.
I will research it though and I appreciate your suggestions

@DavePreston, Rapsberry Pi and a USB cam is a good option to stream on WiFi, search information about: ‘motion’ Raspberry USB cam (Sp)

It is BUT this is not a webcam, it is a Sony bridge camera that I use for bird photography that runs it’s own remote control app and acts as a Direct WiFi access point

Maybe this will help you Sony Camera Remote Control ESP8266

It’s an interesting read and I’m confident I can do everything the Sony app does. My one issue is decoding the live stream.

I have made some progress, in that I have downloaded the Sony SDK and it contains .java files including a livestream slicer.
I am unsure yet if I can use these directly in AI2 or can translate them to HTML 5 or JavaScript to use them, and which would be the simplest/best?

Hi Dave

Certainly the Sketch could be defined to handle both tasks. Bluetooth version? BLE would be best if your Android device supports it. I think a well-described Post on the Arduino Forum would help a lot :innocent:

Possibly, but having found the Sony SDK I’ll pursue that route first, and I do have a working system, and a few other things on the go :smile:

… It might prove easier to use the SDK in a Sketch than in App Inventor.

1 Like

Hi Dave,
You may try looking into PTP implementation.
Essentially every camera implements PTP (Picture-Transfer-Protocol). You can access various function in camera using PTP. There are few ptp libraries which utilize javascript.
For example -
See if that helps.
In past I have used custom PTP scripts with canon cameras using CHDK.

Thanks for your response,
Yes, I did see that one but the Sony camera only provides a direct Wi-fi connection. I have actually found a JavaScript library with the code to view the live stream but don’t know enough to take just that part of it to decode the stream and display the jpegs