PkmX / lcamera

A camera app using the new camera2 API in Android Lollipop
1.28k stars 220 forks source link

Compression Methods #36

Open sleepymess opened 10 years ago

sleepymess commented 10 years ago

I'm looking for the documentation on the camera API, but I can't seem to find it though. Is it possible to change the compression methods of the sensor data before saving it as jpeg or h.264? Using these formats is great for a small sd card size, but in order to retain the detail in the highlights/shadows, logarithmic compression is needed.

PkmX commented 10 years ago

The camera provides raw sensor outputs in DNG format, which should encompass the full dynamic range the sensor is capable of, without any processing. The JPEG and H.264/AVC encoders that come with Android's framework unfortunately do not provide many options to control the quality of the output. So we will have to provide our own implementations of compression if we want to override the default behavior.

FluorescentHallucinogen commented 9 years ago

What about using FFMPEG (https://github.com/hiteshsondhi88/ffmpeg-android-java) in L Camera? ;-)

sleepymess commented 9 years ago

This is coming from a consumer and not from a developer so please bear with me. A feature I would love to see is 4k 8bit 4:4:4 footage at 24fps with a log gamma curve applied. I honestly think that Android has the potential to compete with Sony, Canon and even RED and Alexa, perhaps even trumping them in certain circumstances because of a phone's portability and code flexibility. It would be a huge feat to achieve, but I also understand that what I ask requires a lot of coding. So I would like to ask:

1) How hard is it to to gather the data which will be saved as a dmg file? Can you just manipulate the api documentation? That way, it would be possible to apply changes to sensor data and save a H.264/5 video without having to first saving a dmg and then transcode it. As you said there is already a way to save footage as H.264/5 at 8bit 4:4:4, but it is also my understanding that any correction to the footage comes after processing and compressing the data, which is not ideal for retaining detail. Please feel free to correct me.

2) How difficult is it to implement a logarithmic gamma correction curve to the data before compressing it in a video?

3) Is it necessary to implement an external encoder like ffmepg for something like this? If so, how expensive will the process be and how difficult will it be to implement?

kizzmaul commented 9 years ago

4K will not be possible on Nexus 5 because sensor doesn't have enough pixels, but maybe Nexus 6 can do the job.

sleepymess commented 9 years ago

Yes my mistake. Let me rephrase: I would love to see as much detail as possible from the raw video footage before post processing editing. Of course 1080p is still great for quick shots, but the more pixels the better. I used 4k as a figure, but anything less or more is still great.