Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundException when transforming the video #181

Open
RishabJaiswal opened this issue Mar 15, 2022 · 9 comments
Open

FileNotFoundException when transforming the video #181

RishabJaiswal opened this issue Mar 15, 2022 · 9 comments

Comments

@RishabJaiswal
Copy link

RishabJaiswal commented Mar 15, 2022

I am getting the following error
java.io.FileNotFoundException: /storage/emulated/0/Movies/MyApp/video.mp4: open failed: EEXIST (File exists)

This happens while using the below api specifically on Android Devices above Android 10. It works fine below Android 10.

 MediaTransformer.transform(@NonNull String requestId,
                          Uri inputUri,
                          String outputFilePath,
                          MediaFormat targetVideoFormat,
                          MediaFormat targetAudioFormat,
                          TransformationListener listener,
                          TransformationOptions transformationOptions) 

Inside the above api MediaTargetException is thrown

com.linkedin.android.litr.exception.MediaTargetException: java.io.FileNotFoundException: /storage/emulated/0/Movies/MyApp/video.mp4: open failed: EEXIST (File exists)Media transformation failed for job id: null
Failed to open the media target for write.
Output file path or Uri encoded string: /storage/emulated/0/Movies/MyApp/video.mp4
MediaMuxer output format: 0

I believe this might have to do with the new File system changes introduced from Android 10

@izzytwosheds
Copy link
Contributor

Thank you for reporting this! We will look into it.

@RishabJaiswal
Copy link
Author

I think we should open a FileOutputStream or provide FileDescriptor just like the android-transcoder library does. Please find it here

@izzytwosheds
Copy link
Contributor

Yes, I am planning to use a FileDescriptor as well.

@izzytwosheds
Copy link
Contributor

There is a PR in flight, that should help. We already use FileDescriptor in MediaMuxerTarget but it was not exposed via transform method. It is now: #182
Let me know if this solves your issue.

@RishabJaiswal
Copy link
Author

Thank you so much!
Are we expecting a new release for the SDK with this fix?

@izzytwosheds
Copy link
Contributor

Yes. We are preparing a new release.
Meanwhile, you can try a snapshot release by adding following to your gradle build files (I didn't try it myself yet):
repositories { maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } }

@RishabJaiswal
Copy link
Author

Thank you !

@RishabJaiswal
Copy link
Author

Can't find the snapshot. Please help.

@izzytwosheds
Copy link
Contributor

Version 1.5.0 is being released now. Let me know if it fixes your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants