Sony HDR-AS100V Action Cam – Further Hacking
After a LOT of mucking around, trying to get a stream URL from the Action Cam, I did further googling on the defunct UStream service that the camera could, supposedly, stream live to. It wasn't long before I came across this mammoth thread on Github describing a few users' attempts to hack apart the APK that does the steaming and to fake a server with the intent to intercept the feed.
They use the Sony-PMCA-RE Project code to tweak settings on the camera and then built up an entire webserver to fake the Ustream service. None of this was beyond me, so I started by trying to work out if I could configure my camera to point at a server... (note that I've fudged any secrets in the console logs below...)
C:\Users\Steven\Downloads>pmca-console-v0.17-win.exe info -d libusb Using drivers libusb-MSC, libusb-MTP Looking for Sony devices Querying mass storage device Sony Camcorder is a camera in mass storage mode Model: HDR-AS100V Product code: 0002426601 Serial number: 03035253 Firmware version: 2.00 GPS Data: 2020-04-02 00:00:00 - 2020-05-02 00:00:00
C:\Downloads>pmca-console-v0.17-win.exe stream -d libusb Using drivers libusb-MSC, libusb-MTP Looking for Sony devices Querying mass storage device Sony Camcorder is a camera in mass storage mode twitterEnabled: 0 twitterConsumerKey: o9fJ2342342423433qg twitterConsumerSecret: TTL4324234234234324324llM6EQdivTXesA twitterAccessToken1: twitterAccessTokenSecret: twitterMessage: Live Streaming from Action Cam by Sony facebookEnabled: 0 facebookAccessToken: facebookMessage: Live Streaming from Action Cam by Sony service: 0 enabled: 1 macId: macSecret: macIssueTime: 0000000000000000 unknown: 1 channels: [0] shortURL: videoFormat: 1 supportedFormats: [1, 3] enableRecordMode: 1 videoTitle: Recorded with Action Cam by Sony videoDescription: Shot 100% with Sony's Action Cam #SonyActionCam #ProveYourself videoTag:
C:\Downloads>pmca-console-v0.17-win.exe updatershell -d libusb Using drivers libusb-MSC, libusb-MTP Looking for Sony devices Querying mass storage device Sony Camcorder is a camera in mass storage mode Getting device info Using firmware for model HDR-AS100V Initializing firmware update Traceback (most recent call last): File "C:\projects\sony-pmca-re\pmca-console.py", line 96, in <module> File "C:\projects\sony-pmca-re\pmca-console.py", line 82, in main File "C:\projects\sony-pmca-re\pmca\commands\usb.py", line 360, in updaterShellCommand File "C:\projects\sony-pmca-re\pmca\commands\usb.py", line 373, in firmwareUpdateCommandInternal File "C:\projects\sony-pmca-re\pmca\usb\sony.py", line 527, in checkGuard File "C:\projects\sony-pmca-re\pmca\usb\sony.py", line 501, in _sendWriteCommands Exception: Firmware update error: Low battery [9052] Failed to execute script pmca-console
Right... low battery... I charged it up and then tried again:
C:\Users\Steven\Downloads>pmca-console-v0.17-win.exe updatershell -d libusb Using drivers libusb-MSC, libusb-MTP Looking for Sony devices Querying mass storage device Sony Camcorder is a camera in mass storage mode Getting device info Using firmware for model HDR-AS100V Initializing firmware update Switching to updater mode Waiting for camera to switch... Please follow the instructions on the camera screen.
Cool, at this point the camera showed 'EXEC' on its LCD display. This kept flashing... and then the console app error'd out:
Operation timed out. Please run this command again when your camera has connected.
I pressed the record button on the back of the camera to try and force the 'EXEC' and it seemed to reboot. From here, it then wouldn't even come back to life. The battery charge light just stayed a fixed red, which I now think was an error indicator. After popping the battery out, I could get it back to the 'EXEC' screen via the console app, but it occurred to me that I actually had no idea what updater-shell even did. Instead I tried the stream fuction to push a UStream configuration file to the device as per the instructions here at Novex's project where he attempts to create his own UStream APK. Here's the config I used...
[ [ "twitterEnabled", 0 ], [ "twitterConsumerKey", "" ], [ "twitterConsumerSecret", "" ], [ "twitterAccessToken1", "" ], [ "twitterAccessTokenSecret", "" ], [ "twitterMessage", "Live Streaming from Action Cam by Sony" ], [ "facebookEnabled", 0 ], [ "facebookAccessToken", "" ], [ "facebookMessage", "Live Streaming from Action Cam by Sony" ], [ "service", 0 ], [ "enabled", 1 ], [ "macId", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ], [ "macSecret", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" ], [ "macIssueTime", "dbeaaaaa00000000" ], [ "unknown", 1 ], [ "channels", [ 12345678 ] ], [ "shortURL", "http://www.ustream.tv/channel/asdf" ], [ "videoFormat", 3 ], [ "supportedFormats", [ 1, 3 ] ], [ "enableRecordMode", 0 ], [ "videoTitle", "Recorded with Action Cam by Sony" ], [ "videoDescription", "Shot 100% with Sony's Action Cam #SonyActionCam #ProveYourself" ], [ "videoTag", "" ] ]
And then I smushed it into the camera using the console application...
C:\Downloads>pmca-console-v0.17-win.exe stream -w ustream.json -d libusb Using drivers libusb-MSC, libusb-MTP Looking for Sony devices Querying mass storage device Sony Camcorder is a camera in mass storage mode
Urrghh... what mode does it need to be in? Wait, is that even an error? Let's try use the buttons on the camera to switch it into Live mode...
Preparing?
No AP? Maybe it has no idea how to connect to a 5Ghz access point? Let's set it to my 2.4G secondary network, which nothing else uses, so I can isolate and watch any traffic. This took a little bit of hacking as the Sony Network Settings Utility needs the driver to be reverted back to USB Mass Storage. Jump in to Device Manager and force a driver 'update' back to the standard driver.
Now you can go into Network Settings and set your AP once more.
Note that it'll complain at the end that the settings are incomplete. Fortunately it still writes the AP configuration to the camera. After this, you'll have to switch back to the lib-usb driver and then re-upload the streaming settings.
From here? Test! Unplug the camera and hit the Live mode again...
Auth Error? HDR-AS100V Official documentation indicates that this means it's failed to authenticate with UStream... makes sense to me! Can we hack my local network to make it auth to a fake server?
Network Setup for a Fake UStream Server
Since I want the raspi to be doing all the heavy lifting, I'm going to follow the instructions here at Luca Lanziani's project to set up a listener and a dns faker.
pi@raspberrypi:~ $ wget https://github.com/LucaLanziani/sony-camera-stream-receiver/archive/master.zip --2020-04-03 16:01:51-- https://github.com/LucaLanziani/sony-camera-stream-receiver/archive/master.zip Resolving github.com (github.com)... 13.237.44.5 Connecting to github.com (github.com)|13.237.44.5|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://codeload.github.com/LucaLanziani/sony-camera-stream-receiver/zip/master [following] --2020-04-03 16:01:51-- https://codeload.github.com/LucaLanziani/sony-camera-stream-receiver/zip/master Resolving codeload.github.com (codeload.github.com)... 52.63.100.255 Connecting to codeload.github.com (codeload.github.com)|52.63.100.255|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 3790 (3.7K) [application/zip] Saving to: ‘master.zip’ master.zip 100%[===========================>] 3.70K --.-KB/s in 0s 2020-04-03 16:01:51 (7.39 MB/s) - ‘master.zip’ saved [3790/3790]
It downloaded easy enough... let's see what's inside!
pi@raspberrypi:~ $ mv master.zip sony-camera-receiver.zip pi@raspberrypi:~ $ unzip sony-camera-receiver.zip Archive: sony-camera-receiver.zip dd4b1170f9cdeaabc2cb68eccff6b7f63214abce creating: sony-camera-stream-receiver-master/ extracting: sony-camera-stream-receiver-master/.gitignore inflating: sony-camera-stream-receiver-master/README.md inflating: sony-camera-stream-receiver-master/dns_server.js inflating: sony-camera-stream-receiver-master/index.js inflating: sony-camera-stream-receiver-master/package.json inflating: sony-camera-stream-receiver-master/rtmp_server.js inflating: sony-camera-stream-receiver-master/web_server.js pi@raspberrypi:~ $ cd sony-camera-stream-receiver-master/ pi@raspberrypi:~/sony-camera-stream-receiver-master $ ls dns_server.js index.js package.json README.md rtmp_server.js web_server.js
Cool, everything we need. Following the instructions, we first need to download all the supporting node libraries.
pi@raspberrypi:~/sony-camera-stream-receiver-master $ npm i npm WARN npm npm does not support Node.js v10.15.2 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9. npm WARN npm You can find the latest version at https://nodejs.org/ npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN sony-cameras-stream-receiver@1.0.0 No repository field. added 76 packages from 64 contributors in 17.452s
Cool, done. Now it's time to see if it'll actually run?
pi@raspberrypi:~/sony-camera-stream-receiver-master $ sudo node ./index.js --web.channel_number=12345678 --dns.external_ip=192.168.1.50 03/04/2020 16:09:24 16471 [INFO] Node Media Server v1.4.7 dnsproxy:info we are up and listening at 192.168.1.50 on 53 +0ms 03/04/2020 16:09:24 16471 [INFO] Node Media Rtmp Server started on port: 1935 Server listening at http://0.0.0.0:80/ 03/04/2020 16:09:26 16471 [INFO] There is a new version 2.1.6 that can be updated
Okey dokey.. it's up and running. The best thing we can do now is slap the new DNS server in our config and see what happens. After configuring my router and letting it reboot, nothing was resolving via .50. It seemed that .1 was still the DNS Server? I tried renewing my DHCP and flushing DNS, but nothing worked. Intead, I just hacked my local ethernet interface to point to .50 for DNS... woah! It works!
But I can't hack the camera in the same way... so I need to work out why DHCP isn't giving me .50. I then realised I'd been reconfiguring my repeater and not my actual router!? I logged into .1 and set the DHCP configuration to have a Primary DNS of .50 and, well, shit just worked.
The camera still threw the Auth Error, so I totally disabled the DHCP on the repeater, because that really shouldn't be there, and rebooted the camera. Hitting the REC button on Live mode on the Action Cam then saw action on the raspi!
03/04/2020 16:58:47 16471 [INFO] [rtmp connect] id=SRMCPZ41 ip=::ffff:192.168.1.134 app=12345678 args={"app":"12345678","flashVer":"LNX 9,0,124,0","swfUrl":"http://www.ustream.tv/mobile.swf","tcUrl":"rtmp://api.ustream.tv/12345678","capabilities":1,"audioCodecs":1143,"videoCodecs":252,"videoFunction":1,"pageUrl":"http://www.ustream.tv","objectEncoding":0,"fpad":false} 03/04/2020 16:58:47 16471 [INFO] [rtmp publish] New stream. id=SRMCPZ41 streamPath=/12345678/broadcaster/live7665 streamId=1 03/04/2020 16:58:48 16471 [INFO] [rtmp publish] Handle video. id=SRMCPZ41 streamPath=/12345678/broadcaster/live7665 frame_type=1 codec_id=7 codec_name=H264 0x0 03/04/2020 16:58:48 16471 [INFO] [rtmp publish] Handle audio. id=SRMCPZ41 streamPath=/12345678/broadcaster/live7665 sound_format=10 sound_type=2 sound_size=1 sound_rate=3 codec_name=AAC 48000 2ch 03/04/2020 16:59:40 16471 [INFO] [rtmp connect] id=7YV3W0L2 ip=::ffff:192.168.1.121 app=12345678/broadcaster args={"app":"12345678/broadcaster","flashVer":"LNX 9,0,124,2","tcUrl":"rtmp://192.168.1.50:1935/12345678/broadcaster","fpad":false,"capabilities":15,"audioCodecs":4071,"videoCodecs":252,"videoFunction":1} 03/04/2020 16:59:40 16471 [INFO] [rtmp play] Join stream. id=7YV3W0L2 streamPath=/12345678/broadcaster/live7665 streamId=1
And then pointing VLC at rtmp://192.168.1.50/12345678/broadcaster/live7665 got me....
Traaaaaiinnnsssss... Now to find the perfect angle. Note that you get an 'ONAIR' message on the LCD when it's ... on air.
Sure, not the best mounting... I'll work on that. I've also got a waterproof case for it that I'll need to hack a hole into to get the USB power through.
Productionising
Having the raspi be the DNS server is a little scary. But I suppose this is where secondary DNS servers come in? If we put 8.8.8.8 for the secondary, does it get used when the primary is down? Turns out it doesn't work that way, so I'll need to keep the raspi up and running 100% of the time!
C:\Users\Steven>ipconfig /all Ethernet adapter Ethernet: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Intel(R) Ethernet Connection (2) I219-V Physical Address. . . . . . . . . : 30-5A-3A-81-E1-1B DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes IPv4 Address. . . . . . . . . . . : 192.168.1.121(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1 DHCP Server . . . . . . . . . . . : 192.168.1.1 DNS Servers . . . . . . . . . . . : 192.168.1.50 8.8.8.8 NetBIOS over Tcpip. . . . . . . . : Enabled
C:\Users\Steven>ipconfig /flushdns Windows IP Configuration Successfully flushed the DNS Resolver Cache.
C:\Users\Steven>nslookup google.com DNS request timed out. timeout was 2 seconds. Server: UnKnown Address: 192.168.1.50 DNS request timed out. timeout was 2 seconds. DNS request timed out. timeout was 2 seconds. DNS request timed out. timeout was 2 seconds. DNS request timed out. timeout was 2 seconds. *** Request to UnKnown timed-out
For some reason I really enjoy the spelling of 'UnKnown'. Regardless, the secondary has not kicked in! With this news, I suppose it'd be best to learn how to keep that service up and running 24/7 on the pi. Instead, I have decided to not even go ahead with this camera! It's wide-view fish-eye angle just isn't wide enough to get the trains close enough and the cityscape in the shot... I therefore don't see any advantage over my current camera.
So! A learning experience! For those who want to use a Sony Action Cam HDR-AS100V as a livestreaming camera, it's plausible!
October 28th, 2020 - 10:43
Hey this is epic!! I’ve just got an as100v and went through the same original trail and error you have to use this as a webcam through the network and your solution looks like it’ll work!!
Thank you so much for your effort and looks like your local too (I’m in Melbourne too). I’m going to try this out over the next few weeks and see how I go. Fingers crossed.
October 28th, 2020 - 11:47
Bruno,
Glad that this post (and the previous, if you haven’t checked it out also) are helpful!
Tell me how you go and come back here and post a comment if you need help.
Steven.
January 8th, 2022 - 10:22
Thank you so much for this. This is a good start for me to get this streaming function working for YouTube when connected through an Android phone.
August 24th, 2022 - 04:17
Does anyone know where I can get the “Network Setting Tool” program? It is no longer available for download.
September 25th, 2022 - 13:13
If you have the unit, the software is on the “second” USB drive that appears when you connect the device. Let me find mine, charge it and plug it in. I’ll try and extract the software.
October 4th, 2022 - 18:18
I believe it’s part of this package:
https://support.d-imaging.sony.co.jp/www/disoft/int/download/playmemories-home/win/en/index.html
Please tell me if it’s not.