dozingcat / VectorCamera

Android app that applies real-time effects to the camera input
GNU General Public License v3.0
128 stars 18 forks source link

[Feature] Saving a photo #55

Open guglovich opened 1 year ago

guglovich commented 1 year ago

Please make the option to save photos to the catalog. I understand that now they are stored in the system folder. I would like to choose my own folder.

TGHepburn commented 1 year ago

Yes Please, I'd like this feature too! Love the App

DeMoN100 commented 1 year ago

Yes there is no save option & when trying to use Save on Device to try to save something I just get a blank file with 0 bytes. I thought it was their app so i submitted an issue but they told me it's because of your apps MIME generation its something you must fix within the vector camera app. Don't abandon this software.

lmj0011 commented 1 year ago

but they told me it's because of your apps MIME generation

That's not the issue.

This Stackoverflow answer provides insight into the root cause of the actual issue.

I did a little debugging and this is what I found...

The app has a method that tries to index the files to make them accessible to other apps, I think because the images and videos from the app are being stored in private app specific storage, it's conflicting with this method.

It would be best if the MediaStore API was used for saving images/videos, it would eliminate the need for apps like SaveTo and SaveOnDevice altogether

ref: 1

lmj0011 commented 1 year ago

@dozingcat

I'm currently working on a PR that should resolve issues 1, 2.

The plan is to update PhotoLibrary.kt to start saving Images and Videos inside the DCIM directory using the MediaStore API so files are freely accessible outside of the app for all users using Android 10+

The directory structure will look like this:

/**
 * Directory structure:
 *
 * // if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
 * [app-directory]/
 *     thumbnails/
 *         [image_id].jpg
 *         [video_id].jpg
 *     metadata/
 *         [image_id].json
 *         [video_id].json
 *     raw/
 *         [image_id].gz
 *         [video_id]_video.dat
 *         [video_id]_audio.pcm
 *     VectorCamera_images/
 *         [image_id].png
 *     VectorCamera_videos/
 *         [video_id].webm (if exported)
 *     tmp/
 *         [video ID of recording in progress]_video.dat
 *         [video ID of recording in progress]_audio.pcm
 *
 * // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
 *  [app-directory]/
 *     thumbnails/
 *         [image_id].jpg
 *         [video_id].jpg
 *     metadata/
 *         [image_id].json
 *         [video_id].json
 *     raw/
 *         [image_id].gz
 *         [video_id]_video.dat
 *         [video_id]_audio.pcm
 *     tmp/
 *         [video ID of recording in progress]_video.dat
 *         [video ID of recording in progress]_audio.pcm
 * [mediaStore]/
 *     DCIM/
 *         VectorCamera/
 *               Images/
 *                  [image_id].png
 *               Videos/
 *                  [video_id].webm
 *
 */

I'm estimating this will take me about 1-2 weeks months to complete, assuming I don't run into any roadblocks. In the meantime, until I submit the PR, you can keep up with my progress here.

lmj0011 commented 1 year ago

@DeMoN100 @TGHepburn @guglovich

Are you all running Android 10 or higher?

I just want to confirm that the issue of not being to accessible media files outside of the app is exclusive to non-rooted Android 10+ devices

DeMoN100 commented 1 year ago

@DeMoN100 @TGHepburn @guglovich

Are you all running Android 10 or higher?

I just want to confirm that the issue of not being to accessible media files outside of the app is exclusive to non-rooted Android 10+ devices

Yes that is correct I am on android 12.

TGHepburn commented 1 year ago

No, I'm on an older android, version 8. I can get to the folder..when I remember where it is ( l know a prompt comes up giving directory but I miss it half the time).

I'd just like to choose where they are placed in settings for app

dozingcat commented 1 year ago

@lmj0011 thanks for looking into this. Your approach sounds good and I'll be happy to review your PR.

lmj0011 commented 1 year ago

@TGHepburn

Please make the option to save photos to the catalog. I understand that now they are stored in the system folder. I would like to choose my own folder.

This issue is kinda asking for 2 seperate things, I plan on handling the first one. Images and Videos will get saved in the DCIM/VectorCamera directory by default (tentatively, only for users running Android 10+). I suppose this could be expanded on later to allow the user to select their own directory. I will likely leave that for someone else to handle since I'm trying to avoid altering the UI if possible

guglovich commented 1 year ago

@DeMoN100 @TGHepburn @guglovich

Are you all running Android 10 or higher?

I just want to confirm that the issue of not being to accessible media files outside of the app is exclusive to non-rooted Android 10+ devices

I have Android 12.1 with Root

lmj0011 commented 1 year ago

Here's my (work in progress) PR: https://github.com/dozingcat/VectorCamera/pull/56

I've reached a roadblock with trying to save videos into mediaStore, to therefore make them accessible in the public DCIM directory. The video saves, but it's basically unplayable. It appears the effects are not actually part of the video file but instead applied in real time whenever the video is played from the app.

My work on this feature is at an end, since there needs to be more code rewriting done than I'm willing to contribute my spare time to. Hopefully my PR is a good starting point for @dozingcat or another contributor.

dozingcat commented 1 year ago

58 should allow "Save on device" to work.

dozingcat commented 1 year ago

@lmj0011 Thanks for your work! The next release will be out shortly and will update to the current API level 33, still using private app storage. After that I'll see if it's possible to use MediaStore based on your PR.