iakdis / librecamera

A free and open source camera app for Android written in Flutter and Dart
https://f-droid.org/packages/com.iakmds.librecamera/
GNU General Public License v3.0
296 stars 29 forks source link

Switching cameras while filming bugs footage #73

Open HarryHelsing opened 1 year ago

HarryHelsing commented 1 year ago

If you start filming, then switch the camera, the footage becomes stuck after that point. Also if you pause then switch. Perhaps this is a technical limitation and if so consider disabling the ability to switch camera's while filming. Thank you!

Teloshav commented 1 year ago

This here is the single reason I haven't been able to use this app yet. I've been looking around for some time for any open source apps with this feature and Librecamera is the closest I came across. It's a wonderful app and I'm still looking into seeing if it's the app for me that I can use when recording video reliably.

I digress, I'll give some information about what my situation's been like...

This is the tabulated notes I've made for when recording horizontal/landscape footage:
Resolution Rear facing camera alone Front facing/selfie camera alone Rear-to-selfie camera flip Selfie-to-front camera flip
MAX

(I think it is 3,840 x 2,160)
The footage is fine when looking back. The viewfinder displays the camera view smoothly. The footage comes out fine when looking back.

The viewfinder stutters and appears shaky before recording (same with the photos from the front-facing camera, but that's another issue) but weirdly enough is perfectly smooth once I start recording.
There was no issues with the viewfinder while recording and pressing the button, no lag or stuttering of any kind.

The footage shows fine when the start of the video has the rear-facing camera just recording as normal, no issues there, but then when I go to swap the camera to the front-facing camera the footage just freezes at the last frame from the rear-facing camera.

There are no issues with the audio while all this is happening
Just like the rear-to-selfie flip, the initial part of the video is fine in all regards, the viewfinder isn't lagging at all and there's no issues at this point when looking back on the footage either.

When I go to flip the camera to the rear-facing camera there is no issues on the viewfinder but there are weird issues when looking back at the footage.

The footage from the rear-facing camera does show up but at a 90º rotation (as if I was holding the phone vertically) and was 'squeezed' so that the full view would still show up in the camera. The footage (not the viewfinder) is also very stuttery/laggy(?) once I flip the camera.
LOW

(320 x 240)
No issues. Viewfinder and footage is as expected. The viewfinder is shaky but stops when I start recording. The viewfinder had no issues before and during recording.

When I flipped the camera the exact same 90º rotation and 'squashing' happened, except there was no stuttering or lag. No audio issues either.
Pretty much identical to the rear-to-selfie camera flip. The viewfinder was stuttering a bit still (once again, this is likely another issue completely).

The footage had a 90º flip as well and is the exact same as all other occurrences, once again, this time had no lag or stuttering of any kind.


Here's an example representation of what the 90º flip looks like (believe it or not, I didn't take this (or these?) photos! 😱):
BEFORE AFTER
before after
I'll try see if I get the chance to take down some notes for a similar table for when recording vertical footage. Until then (if it ever happens), I'll just leave this blank table so we all can imagine what it could be like... (If I start adding data to this table just ignore this...! 🤫 )
This is the tabulated notes I've made for when recording vertical/portrait footage:
Resolution Rear facing camera alone Front facing/selfie camera alone Rear-to-selfie camera flip Selfie-to-front camera flip
MAX

(I think it is 3,840 x 2,160)
Blank Blank Blank Blank
LOW

(320 x 240)
Blank Blank Works as expected! A little delay when swapping the cameras but that's expected. I managed to do another test where I did a rear-to-selfie-to-rear flip with 2 flips and it worked flawlessly! Once again, works well and as expected! Did an extended version of this test with a selfie-to-front-to-selfie with 2 and it handled it with no issues.


I hope this data is useful to someone. As far as I've noticed, I think that it's related to both the orientation of the phone and the cameras and also the communication of the resolution/dimensions between the cameras when swapping. The lagging I assume could also just be some optimisation issue, but I think it's just a byproduct of the possible 'miscommunication' of resolution/dimensions.

Anyone else got a clue for why/how exactly this happens?

Teloshav commented 1 year ago

Just had a look at the second part of the commit for the feature and I think the 90º rotation might be from this line here but this is just a complete guess from my part: 3 rotations? 270º? -90ª as well?

I just think to myself about 3 rotations being 270º or -90º as I noticed in my observations. I also noticed that none of my videos in all my testing have had any directly related audio issues (I think it had some issues picking up my voice but I'll have to check that another time).

Hope this helps!

P.S. Just did some quick tests with the low resolution but with vertical/portrait orientation recording and noticed that it worked perfectly well. So I'm not sure what that's about. Please refer to my earlier comment to see my results from this and other tests I performed.

From some other quick observations with vertical/portrait orientation recording with the highest option my camera offers is that the swapping works but is laggy and stutters when looking back at the footage. This is partly from memory and also hasn't been thoroughly tested so I haven't added it to the table.