OpenGoPro icon indicating copy to clipboard operation
OpenGoPro copied to clipboard

Add BLE query to get the last file name

Open dorealex opened this issue 3 years ago • 28 comments

As title indicates, is there a bluetooth query to get the name of the last file saved from either video or picture?

I am trying to control a GoPro using a raspi and I think it would be easier(and possibly better on the battery) if I just used BLE rather than WIFI.

dorealex avatar Jun 30 '21 16:06 dorealex

Even if you could get the last file name, how would you transmit the file data over to your RPI without using WiFi?

You can only use BLE to do basic camera controls, get the status and change settings. All things related to media or streaming are done over WiFi.

There's a third option, which GoPro hasn't officially documented yet, which involves using the APIs exposed over USB Ethernet to get media off the camera and even do some basic camera control (read: take pictures). Check out: https://github.com/KonradIT/goprowifihack/blob/master/HERO9/GoPro-Connect.md

KonradIT avatar Jun 30 '21 18:06 KonradIT

I don't actually need the file, yet.

Basically, I have a raspi ask the gopro(which is under water) to take a picture every 5 seconds, and I have a GPS module get the location. I then build a csv file with the time, the file name, and the position. Once the "run" is done, I dump all the pictures into a folder, and run a separate script, to run the pictures through a tensorflow model, add the result of that to the CSV file and generate an interactive map.

(also thanks Konrad, big fan of your stuff!)

Eventually, I probably would like to process the files on the raspi real-time(probably using tensorflow lite), while on the water... Which would be awesome, because my long range comms is very low bandwidth, so I probably could benefit from just transmitting the result of the model rather than transmitting the picture and processing it...

dorealex avatar Jun 30 '21 19:06 dorealex

Ah, interesting. Looking at the chars for data, there seems to just be camera name, battery life, wifi ssid/pass... but not last media name. The status response (https://gopro.github.io/OpenGoPro/ble#status-codes) doesn't carry it either.

KonradIT avatar Jun 30 '21 20:06 KonradIT

Well, I guess I will go back to the wifi method, I just find it chews up the battery quite a bit. I also have issues with interface priority, but that's a separate issue.

dorealex avatar Jun 30 '21 22:06 dorealex

Basically, I have a raspi ask the gopro(which is under water) to take a picture every 5 seconds, and I have a GPS module get the location. I then build a csv file with the time, the file name, and the position. Once the "run" is done, I dump all the pictures into a folder, and run a separate script, to run the pictures through a tensorflow model, add the result of that to the CSV file and generate an interactive map.

@dorealex : Would love to collaborate -- I have a similar application (underwater dredge -fishing application).

leeprevost avatar Jul 12 '21 15:07 leeprevost

Hello all. No, there is currently no way to explicitly get the last file name (via BLE or WiFi). Your best bet currently is to continuously poll the media list (only possible via WiFi).

I can see how getting the last filename via BLE would be useful for you use case here. I'm not sure it makes sense to expose the entire media list functionality over BLE due to bandwidth problems as the media list can get quite large but maybe a subset like "last media captured" would make sense.

I'll mark this as an enhancement and leave it open.

tcamise-gpsw avatar Jul 22 '21 22:07 tcamise-gpsw

Basically, I have a raspi ask the gopro(which is under water) to take a picture every 5 seconds, and I have a GPS module get the location. I then build a csv file with the time, the file name, and the position. Once the "run" is done, I dump all the pictures into a folder, and run a separate script, to run the pictures through a tensorflow model, add the result of that to the CSV file and generate an interactive map.

@dorealex : Would love to collaborate -- I have a similar application (underwater dredge -fishing application).

@leeprevost I've created a new repository with my stuff. Bear with me, I don't know exactly what I am doing. https://github.com/dorealex/snoop

dorealex avatar Jul 27 '21 02:07 dorealex

Thank you. I’ll check it out.

Sent from my iPhone

On Jul 26, 2021, at 10:28 PM, dorealex @.***> wrote:

 Basically, I have a raspi ask the gopro(which is under water) to take a picture every 5 seconds, and I have a GPS module get the location. I then build a csv file with the time, the file name, and the position. Once the "run" is done, I dump all the pictures into a folder, and run a separate script, to run the pictures through a tensorflow model, add the result of that to the CSV file and generate an interactive map.

@dorealex : Would love to collaborate -- I have a similar application (underwater dredge -fishing application).

@leeprevost I've created a new repository with my stuff. Bear with me, I don't know exactly what I am doing. https://github.com/dorealex/snoop

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

leeprevost avatar Jul 27 '21 13:07 leeprevost

Hello. I'm very interested in this functionality. Is there an expected date?

lozo2010 avatar Nov 29 '21 12:11 lozo2010

Add +1 for enhancement request. I'm recording 40 sec clips and storing related data in a database. It would be great if I could write the filename to the database immediately instead of trying to figure it out later (Wifi file list delta and sequence number of recording in database).

EddyCelis avatar Apr 23 '22 20:04 EddyCelis

@lozo2010 @EddyCelis @dorealex I am starting to look into this. Is it acceptable for your use cases for this command to only be exposed over Wifi? Or do you need it for BLE also?

tcamise-gpsw avatar Sep 15 '22 19:09 tcamise-gpsw

That would be BLE only. On WiFi it is already possible to handle that in a roundabout way by getting the file names before recording starts and then after recording stopped, the new file would be... well, the new one. But that would take too long. What we want to do is;

  • start recording
  • stop recording
  • get a characteristic push with the filename that was just recorded.

We want to add this filename into our SQLite database together with the other info that is specific to our app that is linked to the video.

Thanks, Eddy

@lozo2010 @EddyCelis @dorealex I am starting to look into this. Is it acceptable for your use cases for this command to only be exposed over Wifi? Or do you need it for BLE also?

-- Reply to this email directly or view it on GitHub: https://github.com/gopro/OpenGoPro/issues/13#issuecomment-1248530127 You are receiving this because you were mentioned.

Message ID: @.***>

EddyCelis avatar Sep 15 '22 20:09 EddyCelis

It is very unlikely that you will get the push functionality. But I think it is feasible to add a command to poll via BLE (and / or Wifi) for the last filename. I'll take a look

tcamise-gpsw avatar Sep 15 '22 20:09 tcamise-gpsw

Eddy's right, for my use case its a picture, but I guess its all the same. Could the filename be stored as variable similar to the SSID whenever it is stored to the SD card, and then made accessible similarly via BLE.

dorealex avatar Sep 15 '22 20:09 dorealex

We can't add more characteristics. I'm proposing a new command.

So if you're doing it programmatically (i.e. capturing the media by sending an OGP command), it's pretty straightforward:

  • Set Shutter
  • GetLastFilename (new command)

I guess the problem is that if you also need the last filename for media captured by the physical shutter button. You can already register for status updates for num total videos or maybe even remaining space so that you know when new media is captured. So:

  • register for status update
  • wait for status update
  • GetLastFileName

Does that work?

tcamise-gpsw avatar Sep 15 '22 20:09 tcamise-gpsw

A command to get the last filename via BLE would be fine.

Eddy

It is very unlikely that you will get the push functionality. But I think it is feasible to add a command to poll via BLE (and / or Wifi) for the last filename. I'll take a look

-- Reply to this email directly or view it on GitHub: https://github.com/gopro/OpenGoPro/issues/13#issuecomment-1248561419 You are receiving this because you were mentioned.

Message ID: @.***>

EddyCelis avatar Sep 15 '22 20:09 EddyCelis

My use case is the same as @EddyCelis. In my case, they never use the camera button to record. With the command to get the last name, after stopping the recording it would be perfect

@tcamise-gpsw Would this command be possible for the Hero7?

lozo2010 avatar Sep 16 '22 06:09 lozo2010

Hi Tim,

To be sure I was never thinking of adding a complete new characteristic.

I was thinking of adding a status ID that would then be reported like the other status IDs. Either through a direct command (query id 0x13) or as part of a status update that was registered with the ‘register for status value updates’ (query Id 0x53). These go out on GP-0076 and the responses come on GP-077. That way you could get the last filename unsolicited (through the status update) or directly by sending a status query with the new query ID, almost the same as a dedicated command but using the get status command. Status ID is a full byte, so it looks like there is some room to play still. If it is 8 bits in the firmware as well.

But a dedicated command will also work.

For a burst it is probably best to get the name of the first picture in the sequence and not the last.

Best regards,

Eddy

From: Tim Camise @.> Sent: Thursday, September 15, 2022 4:20 PM To: gopro/OpenGoPro @.> Cc: EddyCelis @.>; Mention @.> Subject: Re: [gopro/OpenGoPro] Add BLE query to get the last file name (#13)

We can't add more characteristics. I'm proposing a new command https://gopro.github.io/OpenGoPro/ble_2_0#commands .

So if you're doing it programmatically (i.e. capturing the media by sending an OGP command), it's pretty straightforward:

  • Set Shutter
  • GetLastFilename (new command)

I guess the problem is that if you also need the last filename for media captured by the physical shutter button. You can already accomplish by registering for status updates for num total videos or maybe even remaining space so that you know when new media is captured. So:

  • register for status update
  • wait for status update
  • GetLastFileName

Does that work?

— Reply to this email directly, view it on GitHub https://github.com/gopro/OpenGoPro/issues/13#issuecomment-1248571921 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AMDE2FDAKPIHVVU6NEBATC3V6OAGDANCNFSM47SXG4JA . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AMDE2FARHRJLIYLSGJ6UR7DV6OAGDA5CNFSM47SXG4JKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJJV3EEI.gif Message ID: @.*** @.***> >

EddyCelis avatar Sep 19 '22 22:09 EddyCelis

My use case is the same as @EddyCelis. In my case, they never use the camera button to record. With the command to get the last name, after stopping the recording it would be perfect

@tcamise-gpsw Would this command be possible for the Hero7?

Definitely not for hero 7. Any changes need to be incorporated into future firmware builds, which are currently only planned for Hero 11.

tcamise-gpsw avatar Sep 28 '22 18:09 tcamise-gpsw

Hello. I'm very interested in this functionality. Is there an expected date?

I can't provide a good estimate right besides hopefully end of the year.

tcamise-gpsw avatar Sep 28 '22 18:09 tcamise-gpsw

That is disappointing.

If you look at the functionality of the interfaces from Hero 8 on up, any limitations in the interface between the versions was always due to hardware constraints, never pure firmware. Is there a reason for not supporting it on the Hero 8 – 10?

This limits the target market in a big way if the app is relying on this functionality. It would pretty much be “Hero 11 only”.

From: Tim Camise @.> Sent: Wednesday, September 28, 2022 2:24 PM To: gopro/OpenGoPro @.> Cc: EddyCelis @.>; Mention @.> Subject: Re: [gopro/OpenGoPro] Add BLE query to get the last file name (#13)

My use case is the same as @EddyCelis https://github.com/EddyCelis . In my case, they never use the camera button to record. With the command to get the last name, after stopping the recording it would be perfect

@tcamise-gpsw https://github.com/tcamise-gpsw Would this command be possible for the Hero7?

Definitely not for hero 7. Any changes need to be incorporated into future firmware builds, at which time are currently only planned for Hero 11.

— Reply to this email directly, view it on GitHub https://github.com/gopro/OpenGoPro/issues/13#issuecomment-1261306224 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AMDE2FFNCUUTNAMOJJGH4WDWASENJANCNFSM47SXG4JA . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AMDE2FF4MUZQTCKGH7HYIM3WASENJA5CNFSM47SXG4JKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJMXAC4A.gif Message ID: @.*** @.***> >

EddyCelis avatar Sep 28 '22 18:09 EddyCelis

We are monitoring the 'encoding' state, so setting shutter from our app or the physical button pushes our state machine to the same state, so that does not make a difference.

  • send 'shutter off'
  • 'encoding' state goes False
  • EITHER filename state push is received when all the files are ready. Probably on characteristic 77?
  • OR send new command 'GetLastFileName(s)'

Note that I did add the (s) to filename, because I believe that in burst mode, the 'Encoding' state stays True for the entire burst? So that could mean lot of files.

In our application we do not use burst mode, so not important for us. But if you implement it, you might have to return all the file names for the last burst. Or document that it will only return the last one.

Eddy

We can't add more characteristics. I'm proposing a new command.

So if you're doing it programmatically (i.e. capturing the media by sending an OGP command), it's pretty straightforward:

  • Set Shutter
  • GetLastFilename (new command)

I guess the problem is that if you also need the last filename for media captured by the physical shutter button. You can already accomplish by registering for status updates for num total videos or maybe even remaining space so that you know when new media is captured. So:

  • register for status update
  • wait for status update
  • GetLastFileName

Does that work?

-- Reply to this email directly or view it on GitHub: https://github.com/gopro/OpenGoPro/issues/13#issuecomment-1248571921 You are receiving this because you were mentioned.

Message ID: @.***>

EddyCelis avatar Oct 11 '22 09:10 EddyCelis

Has there been any decision on this enhancement suggestion?

EddyCelis avatar Feb 24 '23 00:02 EddyCelis

FYI this will be released in the next firmware update, before the end of the year,

tcamise-gpsw avatar Dec 06 '23 17:12 tcamise-gpsw

Awesome! Which Heros will get the new firmware?

FYI this will be released in the next firmware update, before the end of the year,

-- Reply to this email directly or view it on GitHub: https://github.com/gopro/OpenGoPro/issues/13#issuecomment-1843328891 You are receiving this because you were mentioned.

Message ID: @.***>

EddyCelis avatar Dec 06 '23 17:12 EddyCelis

It will be Hero12 and newer.

tcamise-gpsw avatar Dec 07 '23 17:12 tcamise-gpsw

This improvement was needed on cameras that didn't have NCM, as the Wi-Fi connection was unstable. From the gopro 10 onwards I have no need for this. It's a shame it's not for previous cameras. I'll have to keep fighting with the wifi of my 15 gopro hero 7. Thank you anyway for your work on this

El jue, 7 dic 2023 a las 18:17, Tim Camise @.***>) escribió:

It will be Hero12 and newer.

— Reply to this email directly, view it on GitHub https://github.com/gopro/OpenGoPro/issues/13#issuecomment-1845761232, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACF5TYZFI5NL3UOIR5VA2ELYIH23PAVCNFSM47SXG4JKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBUGU3TMMJSGMZA . You are receiving this because you were mentioned.Message ID: @.***>

lozo2010 avatar Dec 10 '23 10:12 lozo2010

It will allow us to add an important feature to our app, unfortunately only for the new Heros and the ones in the future. Better than nothing. Thanks for the update!

EddyCelis avatar Dec 11 '23 03:12 EddyCelis

I forgot to update this ticket but this functionality has been added several releases ago. Documented in BLE and HTTP

tcamise-gpsw avatar Apr 10 '24 22:04 tcamise-gpsw