# Extracting images/metadata from binary files exported in recorder\_v2 app

**URL:** https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252
**Category:** support
**Created:** [September 22, 2023, 5:11pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252 "2023-09-22T17:11:36Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![earlranario](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/earlranario/32/298_2.png) [@earlranario](https://discourse.farm-ng.com/u/earlranario)
#### Post date: [September 22, 2023, 5:11pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/1 "2023-09-22T17:11:36Z")

</div>

- What package and version are you using ?  
**Amiga OS 2.0**

- Please, describe the issues you are seeing ?  
**Are there any existing scripts that can extract images/metadata from the .bin files saved using the Recorder\_v2 application?**

\*\* Any possible information will make the live of the community members easy to reply and provide a solution.

Thanks in advance!

---

<div class="post-metadata">

### Author: ![kylecoble](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/kylecoble/32/12_2.png) [@kylecoble](https://discourse.farm-ng.com/u/kylecoble)
#### Post date: [September 25, 2023, 4:00pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/2 "2023-09-25T16:00:07Z")

</div>

Hello @earlranario ,

The use of our scripts and examples for interacting with the pre-release **Amiga OS 2.0** is not yet well documented (but is soon to come as we roll out the release!).

We have a good example for what you want to do. It’s not yet merged into [GitHub - farm-ng/farm-ng-amiga at main-v2](https://github.com/farm-ng/farm-ng-amiga/tree/main-v2) (the `farm-ng-amiga` branch that corresponds to AmigaOS v2.x), so it would’ve been hard for you to find this.

* * *

To get started on the extraction of images, you can try the `file_reader` example that will playback your log and show the stream for a given camera stream in a cv2 window:

> <https://github.com/farm-ng/farm-ng-amiga/blob/a6c7f5051df4fda6bf62402c61fb519ee15ffccc/py/examples/file_reader/main.py>

Then look at the `file_converter` example that can convert your log either to an mp4 file or a series of jpg images for a given camera stream.

> <https://github.com/farm-ng/farm-ng-amiga/blob/a6c7f5051df4fda6bf62402c61fb519ee15ffccc/py/examples/file_converter/main.py>

Both files have accompanying `README` files.

* * *

For the metadata, this depends on what you are looking for. Assuming you mean camera calibration parameters, then you can filter the `events_dict` in the examples for the `f"/{camera_name}/calibration"` topic name.

Please let me know if you have any additional questions.  
–Kyle

---

<div class="post-metadata">

### Author: ![earlranario](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/earlranario/32/298_2.png) [@earlranario](https://discourse.farm-ng.com/u/earlranario)
#### Post date: [September 25, 2023, 5:47pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/3 "2023-09-25T17:47:04Z")

</div>

Thank you Kyle for your quick response and useful information.

Will these scripts work for my current package versions?

> **farm-ng-amiga 0.0.9**  
> **farm-ng-core 0.1.4**  
> **farm-ng-package 0.1.3**

I tried running the file reader script:

> python file\_reader.py --file-name 2023\_09\_14\_19\_06\_20\_494194\_moats-unproved.0000.bin

And got this error:

> Traceback (most recent call last):  
> File “/Users/earlranario/Documents/GEMINI/scripts/bin-to-images/test/convert\_binary.py”, line 161, in   
> main(args.file\_name, args.output\_path, args.camera\_name, args.view\_name, args.disparity\_scale, args.video\_to\_jpg)  
> File “/Users/earlranario/Documents/GEMINI/scripts/bin-to-images/test/convert\_binary.py”, line 97, in main  
> sample: oak\_pb2.OakFrame = event\_log.read\_message()  
> File “/Users/earlranario/miniconda3/envs/amiga/lib/python3.9/site-packages/farm\_ng/core/events\_file\_reader.py”, line 48, in read\_message  
> return self.reader.read\_message(self)  
> File “/Users/earlranario/miniconda3/envs/amiga/lib/python3.9/site-packages/farm\_ng/core/events\_file\_reader.py”, line 163, in read\_message  
> name, package = parse\_protobuf\_descriptor(event\_log.event.uri)  
> File “/Users/earlranario/miniconda3/envs/amiga/lib/python3.9/site-packages/farm\_ng/core/events\_file\_reader.py”, line 27, in parse\_protobuf\_descriptor  
> type\_split, pb\_split = uri.query.split(“&”)  
> ValueError: too many values to unpack (expected 2)

Debugging into this line, I found 3 values rather than 2:

> ‘type=farm\_ng.oak.proto.OakFrame&pb=farm\_ng/oak/oak.proto&service\_name=oak0’

Changing this:

> type\_split, pb\_split = uri.query.split(“&”)

to this seemed to work:

> type\_split, pb\_split, \_ = uri.query.split(“&”)

---

<div class="post-metadata">

### Author: ![kylecoble](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/kylecoble/32/12_2.png) [@kylecoble](https://discourse.farm-ng.com/u/kylecoble)
#### Post date: [September 26, 2023, 3:00pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/4 "2023-09-26T15:00:20Z")

</div>

Hello @earlranario ,

These scripts will not work for your current versions of `farm-ng-amiga` or `farm-ng-core`.

Until we move the new OS from pre-release, you will need to install the packages locally on these branches:

- [GitHub - farm-ng/farm-ng-core: C++ and Python library for farm-ng logging format](https://github.com/farm-ng/farm-ng-core/tree/main) (`main`)
- [GitHub - farm-ng/farm-ng-amiga at main-v2](https://github.com/farm-ng/farm-ng-amiga/tree/main-v2) (`main-v2`)

– Kyle

---

<div class="post-metadata">

### Author: ![earlranario](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/earlranario/32/298_2.png) [@earlranario](https://discourse.farm-ng.com/u/earlranario)
#### Post date: [September 26, 2023, 11:12pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/5 "2023-09-26T23:12:04Z")

</div>

Hi @kylecoble

I’m assuming I would need to install from source to install these packages on these branches?  
It seems to fail when I do (using `setup.py`). I cloned the repository and then changed branches.

For farm-ng-amiga:

> Preparing metadata **(pyproject.toml)** did not run successfully.

For farm-ng-core:

> Building wheel for farm-ng-core **(pyproject.toml)** did not run successfully.

Do you recommend any other way to install them?

**Side note:** I was able to successfully extract the images but I also am interested in timestamps and gps information from the exported binary file.

Thank you for your continual responses.

---

<div class="post-metadata">

### Author: ![kylecoble](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/kylecoble/32/12_2.png) [@kylecoble](https://discourse.farm-ng.com/u/kylecoble)
#### Post date: [September 27, 2023, 2:30pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/6 "2023-09-27T14:30:45Z")

</div>

Hi @earlranario ,

You should be able to install `farm-ng-core` & `farm-ng-amiga` in `editable` mode in the following way:

```auto
# Clone the repos
git clone https://github.com/farm-ng/farm-ng-core.git
git clone https://github.com/farm-ng/farm-ng-amiga.git

# Checkout correct branches and update
cd farm-ng-core/
git checkout main
git pull
git submodule update --init --recursive
cd ../

cd farm-ng-amiga/
git checkout main-v2
git pull
cd ../

# Create and source a virtual environment
python3 -m venv venv
source venv/bin/activate

# Upgrade some deps
pip install --upgrade pip
pip install --upgrade setuptools wheel

# Install the packages
pip install -e farm-ng-core
pip install --no-build-isolation -e farm-ng-amiga

```

Now you should see both installed if you check with `pip list`. For any of the examples, there should be some basic requirements (e.g. `numpy` & `opencv-python`) in a `requirements.txt` file nested in the corresponding example folder. Install these in your virtual environment with e.g.,

```auto
cd farm-ng-amiga/py/examples/camera_client/
pip install -r requirements.txt

```

Please let me know how this goes.  
– Kyle

---

<div class="post-metadata">

### Author: ![kylecoble](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/kylecoble/32/12_2.png) [@kylecoble](https://discourse.farm-ng.com/u/kylecoble)
#### Post date: [September 27, 2023, 2:32pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/7 "2023-09-27T14:32:24Z")

</div>

> [@earlranario](#):
>
> **Side note:** I was able to successfully extract the images but I also am interested in timestamps and gps information from the exported binary file.

If you wouldn’t mind spinning each of these off into separate discourse posts (one per topic), it will help future users find the answers more easily. I’ll be happy to respond there.

– Kyle

---

<div class="post-metadata">

### Author: ![earlranario](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/earlranario/32/298_2.png) [@earlranario](https://discourse.farm-ng.com/u/earlranario)
#### Post date: [September 27, 2023, 5:50pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/8 "2023-09-27T17:50:09Z")

</div>

@kylecoble

Hi Kyle, I followed your steps but could not build successfully for both farm-ng-core and farm-ng-amiga.  
Here are the outputs:

**farm-ng-core** :

> Building editable for farm-ng-core **(pyproject.toml)** did not run successfully.

**farm-ng-amiga** :

> Preparing editable metadata **(pyproject.toml)** did not run successfully.

---

<div class="post-metadata">

### Author: ![kylecoble](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/kylecoble/32/12_2.png) [@kylecoble](https://discourse.farm-ng.com/u/kylecoble)
#### Post date: [September 27, 2023, 6:09pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/9 "2023-09-27T18:09:37Z")

</div>

@earlranario my apologies, I missed a line!

I’ve updated the instructions above. The missing magic line in `farm-ngcore/` was:

```auto
git submodule update --init --recursive

```

Please give it a try again.

– Kyle

---

<div class="post-metadata">

### Author: ![earlranario](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/earlranario/32/298_2.png) [@earlranario](https://discourse.farm-ng.com/u/earlranario)
#### Post date: [September 27, 2023, 6:32pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/10 "2023-09-27T18:32:57Z")

</div>

@kylecoble thanks Kyle, `git submodule update --init --recursive` ran with no error but a new error occurred when running `pip install -e farm-ng-core`

> Building editable for farm-ng-core **(pyproject.toml)** did not run successfully.  
> …  
> error: command ‘/usr/local/opt/llvm/bin/clang’ failed with exit code 1  
> clang-15: error: unknown argument: ‘-fconcepts’  
> [end of output]

---

<div class="post-metadata">

### Author: ![kylecoble](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/kylecoble/32/12_2.png) [@kylecoble](https://discourse.farm-ng.com/u/kylecoble)
#### Post date: [September 27, 2023, 8:00pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/11 "2023-09-27T20:00:44Z")

</div>

Hi @earlranario ,

That is surprising, but thank you for working through this with us. Can you give me some more information on your system, including your OS, python3 version, & clang version?

You can check `clang` with `clang --version`.

If you do not have `clang` installed, you can run:

```auto
sudo apt update
sudo apt install clang

```

From your venv, you can check with `python --version`.

Thanks,  
– Kyle

---

<div class="post-metadata">

### Author: ![earlranario](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/earlranario/32/298_2.png) [@earlranario](https://discourse.farm-ng.com/u/earlranario)
#### Post date: [September 27, 2023, 8:24pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/12 "2023-09-27T20:24:41Z")

</div>

Sure!

OS: `macOS Ventura 13.4.1`  
python: `Python 3.9.18`  
clang:

> Homebrew clang version 15.0.7  
> Target: x86\_64-apple-darwin22.5.0  
> Thread model: posix  
> InstalledDir: /usr/local/opt/llvm/bin

---

<div class="post-metadata">

### Author: ![kylecoble](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/kylecoble/32/12_2.png) [@kylecoble](https://discourse.farm-ng.com/u/kylecoble)
#### Post date: [September 27, 2023, 9:33pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/13 "2023-09-27T21:33:59Z")

</div>

Thanks for the info @earlranario.

Unfortunately the python build for our new APIs has been broken for MacOS. Let me work on fixing this and I will update you very soon with new instructions or the green light to pull the latest and try the previous commands.

Thank you again for your patience,  
– Kyle

---

<div class="post-metadata">

### Author: ![earlranario](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/earlranario/32/298_2.png) [@earlranario](https://discourse.farm-ng.com/u/earlranario)
#### Post date: [September 28, 2023, 3:47am UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/14 "2023-09-28T03:47:48Z")

</div>

Thanks @kylecoble

I followed the same steps above on a different workstation and it worked without errors!

---

<div class="post-metadata">

### Author: ![kylecoble](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/kylecoble/32/12_2.png) [@kylecoble](https://discourse.farm-ng.com/u/kylecoble)
#### Post date: [September 28, 2023, 6:23pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/15 "2023-09-28T18:23:44Z")

</div>

Glad to hear it @earlranario ,

Since you are unblocked, for now we will maintain Ubuntu 20.04 + python 3.8 as the only supported version combination for running the examples. Also FYI - we are actively working on expanding the set of examples, so be sure to check back regularly.

Best,  
– Kyle

---

<div class="post-metadata">

### Author: ![kylecoble](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/kylecoble/32/12_2.png) [@kylecoble](https://discourse.farm-ng.com/u/kylecoble)
#### Post date: [November 17, 2023, 5:13pm UTC](https://discourse.farm-ng.com/t/extracting-images-metadata-from-binary-files-exported-in-recorder-v2-app/252/16 "2023-11-17T17:13:53Z")

</div>

FYI @earlranario ,

We have updated the build instructions, including for MacOS at:

> **[Brain ADK Install | Farm-ng Developers](https://amiga.farm-ng.com/docs/brain/brain-install/)**
>
> PyPI version

Python 3.8 is formally supported, but it may work on your system with Python 3.9 as well.

– Kyle
