storyboardcreativity / Z-Camera-E1-Reverse-Engineering

Z Camera E1 firmware reverse-engineering results.
37 stars 12 forks source link

Feature request: PCM audio #2

Open jschroeter opened 5 years ago

jschroeter commented 5 years ago

First of all: thanks a lot for sharing your great work, this is awesome!

Would it be possible to create a patch which will record PCM audio instead of AAC? Background: I'm using the E1 to record live concerts (since I had MFT lenses anyway and the camera has no time limit in the US version or when using your patch). Considering the price I'm quite happy with the sound quality, but sometimes I can hear some compression artifacts. My hope is that they will be gone with PCM instead of AAC audio.

storyboardcreativity commented 4 years ago

@jschroeter Sorry for being away for a long time.

As I can see, there is no easy way to record raw audio instead of using AAC codec. Audio is encoded through DSP (watch Ambarella A9 datasheet to understand what is DSP) and I don't have specification to know what architecture does it have (and no any ambarella user knows - it's a closed specification).

But I see parameters related to AAC encoder like: "EncLevel", "SampleRate", "ChNum" and "BitRate". I can try to find way to change them for you.

jschroeter commented 4 years ago

No worries, thanks for responding! Alright, if PCM is not possible a patch to improve the AAC quality would still be helpful. As far as I can see the default firmware sets it to 48000 Hz, stereo, 128 kb/s. So a patch for setting the AAC bit rate to e.g. 320 kb/s (what's the possible max value?) would be great! Do you know what the EncLevel parameter does?

storyboardcreativity commented 4 years ago

@jschroeter I now see, that there are max and min values for bitrates per channel in firmware code. Minimum bitrate: 8 kb/s (per channel) Maximum bitrate: 160 kb/s (per channel)

jschroeter commented 4 years ago

Great, so a patch for 160 kb/s per channel would be great!

storyboardcreativity commented 4 years ago

@jschroeter EncLevel - I've found that it's an encoding preset.

EncLevel == 1:

Minimum bitrate: 14 kb/s (per channel) Maximum bitrate: 64 kb/s (per channel)

EncLevel == 2:

Minimum bitrate: 16 kb/s (per channel) Maximum bitrate: 64 kb/s (per channel)

EncLevel >= 3 - unsupported, will cause error

EncLevel == 0 - Calculate max and min bitrates according to sampling rate:

storyboardcreativity commented 9 months ago

@jschroeter I've found out how to make Z CAM E1 write pure PCM sound. Patch will be ready soon and released with additional features as FW 0.32 :) PCM

storyboardcreativity commented 9 months ago

@jschroeter added test script for the PCM sound feature. Check it out: 20b99458b94ae39bab4b1dbbf103b8da36450f91