-
Notifications
You must be signed in to change notification settings - Fork 626
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
Scoped Storage - Could not open file #39
Comments
I tested your code using test applications under the ffmpeg-kit-test repository but didn't get any errors. I suggest doing the same and testing your issue with them. There is an |
Have you tried with an image?
With the following code to create an image I'm able to reproduce the
I was using the following ffmpeg command for testing the video and image code. In the video case it works.
|
It seems like this case is not handled by the
We need to revisit the design of |
Ok thanks. Interesting that the same command works in the video case but not in the image case. So there is no other (SAF compatible) way to overlay 2 images than this command? |
Most probably no. But I'm not % 100 sure. |
@tanersener Is this issue fixed? |
I fixed it on the |
Fixed in |
Description
I'm trying to write a ffmpeg generated output image to the MediaStore and not to an app-specific-directory on Android 10 using the code below. In this case I'm always getting an error
Could not open file : saf:173/image.jpg av_interleaved_write_frame(): I/O error
Using an app-specific-directory and not the MediaStore as output works just fine.
Expected behavior
Writing the image to MediaStore successfully.
Current behavior
An empty file image file gets generated in the MediaStore. Ffmpeg-kit error is:
Could not open file : saf:173/image.jpg av_interleaved_write_frame(): I/O error
To Reproduce
The following Kotlin code is used to generate the output safUri used for the ffmpeg command.
Logs
2021-05-03 22:22:24.125 27125-28059/com.app.name I/ffmpeg-kit: ffmpeg version v4.4-dev-3015-gc0d0b1c4f6
2021-05-03 22:22:24.125 27125-28059/com.app.name I/ffmpeg-kit: Copyright (c) 2000-2021 the FFmpeg developers
2021-05-03 22:22:24.126 27125-28059/com.app.name I/ffmpeg-kit: built with Android (6875598, based on r399163b) clang version 11.0.5 (https://android.googlesource.com/toolchain/llvm-project 87f1315dfbea7c137aa2e6d362dbb457e388158d)
2021-05-03 22:22:24.126 27125-28059/com.app.name I/ffmpeg-kit: configuration: --cross-prefix=aarch64-linux-android- --sysroot=/files/android-sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/storage/dark/projects/ffmpeg-kit/prebuilt/android-arm64-lts/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8-a --cc=aarch64-linux-android21-clang --cxx=aarch64-linux-android21-clang++ --ranlib=aarch64-linux-android-ranlib --strip=aarch64-linux-android-strip --nm=aarch64-linux-android-nm --extra-libs='-L/storage/dark/projects/ffmpeg-kit/prebuilt/android-arm64-lts/cpu-features/lib -lndk_compat' --target-os=android --enable-neon --enable-asm --enable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --disable-static --enable-shared --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-openssl --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-audiotoolbox --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gmp --enable-gnutls --enable-libmp3lame --enable-libass --enable-iconv --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libopencore-amrnb --enable-libshine --enable-libspeex --enable-libdav1d --enable-libkvazaar --enable-libilbc --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libtwolame --enable-libvo-amrwbenc --enable-zlib --enable-mediacodec
2021-05-03 22:22:24.126 27125-28059/com.app.name I/ffmpeg-kit: libavutil 56. 65.100 / 56. 65.100
2021-05-03 22:22:24.126 27125-28059/com.app.name I/ffmpeg-kit: libavcodec 58.123.100 / 58.123.100
2021-05-03 22:22:24.126 27125-28059/com.app.name I/ffmpeg-kit: libavformat 58. 67.100 / 58. 67.100
2021-05-03 22:22:24.126 27125-28059/com.app.name I/ffmpeg-kit: libavdevice 58. 12.100 / 58. 12.100
2021-05-03 22:22:24.126 27125-28059/com.app.name I/ffmpeg-kit: libavfilter 7.106.100 / 7.106.100
2021-05-03 22:22:24.126 27125-28059/com.app.name I/ffmpeg-kit: libswscale 5. 8.100 / 5. 8.100
2021-05-03 22:22:24.126 27125-28059/com.app.name I/ffmpeg-kit: libswresample 3. 8.100 / 3. 8.100
2021-05-03 22:22:24.152 27125-28059/com.app.name I/ffmpeg-kit: Input #0, image2, from 'file:///storage/emulated/0/Android/data/com.app.name/files/Pictures/03-05-2021-22-22-22.tmp.jpg':
2021-05-03 22:22:24.152 27125-28059/com.app.name I/ffmpeg-kit: Duration:
2021-05-03 22:22:24.153 27125-28059/com.app.name I/ffmpeg-kit: 00:00:00.04
2021-05-03 22:22:24.153 27125-28059/com.app.name I/ffmpeg-kit: , start:
2021-05-03 22:22:24.153 27125-28059/com.app.name I/ffmpeg-kit: 0.000000
2021-05-03 22:22:24.154 27125-28059/com.app.name I/ffmpeg-kit: , bitrate:
2021-05-03 22:22:24.154 27125-28059/com.app.name I/ffmpeg-kit: 1123439 kb/s
2021-05-03 22:22:24.155 27125-28059/com.app.name I/ffmpeg-kit: Stream #0:0
2021-05-03 22:22:24.155 27125-28059/com.app.name I/ffmpeg-kit: : Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 4000x2250
2021-05-03 22:22:24.156 27125-28059/com.app.name I/ffmpeg-kit: ,
2021-05-03 22:22:24.156 27125-28059/com.app.name I/ffmpeg-kit: 25 fps,
2021-05-03 22:22:24.156 27125-28059/com.app.name I/ffmpeg-kit: 25 tbr,
2021-05-03 22:22:24.156 27125-28059/com.app.name I/ffmpeg-kit: 25 tbn,
2021-05-03 22:22:24.156 27125-28059/com.app.name I/ffmpeg-kit: 25 tbc
2021-05-03 22:22:24.195 27125-28059/com.app.name I/ffmpeg-kit: Input #1, png_pipe, from '/data/user/0/com.app.name/files/OverlayImg.png':
2021-05-03 22:22:24.195 27125-28059/com.app.name I/ffmpeg-kit: Duration:
2021-05-03 22:22:24.195 27125-28059/com.app.name I/ffmpeg-kit: N/A
2021-05-03 22:22:24.195 27125-28059/com.app.name I/ffmpeg-kit: , bitrate:
2021-05-03 22:22:24.195 27125-28059/com.app.name I/ffmpeg-kit: N/A
2021-05-03 22:22:24.195 27125-28059/com.app.name I/ffmpeg-kit: Stream #1:0
2021-05-03 22:22:24.195 27125-28059/com.app.name I/ffmpeg-kit: : Video: png, rgba(pc), 1080x2021
2021-05-03 22:22:24.195 27125-28059/com.app.name I/ffmpeg-kit: ,
2021-05-03 22:22:24.195 27125-28059/com.app.name I/ffmpeg-kit: 25 fps,
2021-05-03 22:22:24.195 27125-28059/com.app.name I/ffmpeg-kit: 25 tbr,
2021-05-03 22:22:24.195 27125-28059/com.app.name I/ffmpeg-kit: 25 tbn,
2021-05-03 22:22:24.195 27125-28059/com.app.name I/ffmpeg-kit: 25 tbc
2021-05-03 22:22:24.212 27125-28059/com.app.name I/ffmpeg-kit: Stream mapping:
2021-05-03 22:22:24.212 27125-28059/com.app.name I/ffmpeg-kit: Stream #0:0 (mjpeg) -> transpose
2021-05-03 22:22:24.213 27125-28059/com.app.name I/ffmpeg-kit: Stream #1:0 (png) -> scale
2021-05-03 22:22:24.213 27125-28059/com.app.name I/ffmpeg-kit: drawtext
2021-05-03 22:22:24.214 27125-28059/com.app.name I/ffmpeg-kit: -> Stream #0:0 (mjpeg)
2021-05-03 22:22:24.214 27125-28059/com.app.name I/ffmpeg-kit: Press [q] to stop, [?] for help
2021-05-03 22:22:24.592 27125-28059/com.app.name I/ffmpeg-kit: Output #0, image2, to 'saf:163/image.jpg':
2021-05-03 22:22:24.592 27125-28059/com.app.name I/ffmpeg-kit: Metadata:
2021-05-03 22:22:24.592 27125-28059/com.app.name I/ffmpeg-kit: encoder :
2021-05-03 22:22:24.593 27125-28059/com.app.name I/ffmpeg-kit: Lavf58.67.100
2021-05-03 22:22:24.593 27125-28059/com.app.name I/ffmpeg-kit: Stream #0:0
2021-05-03 22:22:24.593 27125-28059/com.app.name I/ffmpeg-kit: : Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown, progressive), 2250x4000, q=2-31, 200 kb/s
2021-05-03 22:22:24.594 27125-28059/com.app.name I/ffmpeg-kit: ,
2021-05-03 22:22:24.594 27125-28059/com.app.name I/ffmpeg-kit: 25 fps,
2021-05-03 22:22:24.594 27125-28059/com.app.name I/ffmpeg-kit: 25 tbn
2021-05-03 22:22:24.595 27125-28059/com.app.name I/ffmpeg-kit: (default)
2021-05-03 22:22:24.595 27125-28059/com.app.name I/ffmpeg-kit: Metadata:
2021-05-03 22:22:24.596 27125-28059/com.app.name I/ffmpeg-kit: encoder :
2021-05-03 22:22:24.596 27125-28059/com.app.name I/ffmpeg-kit: Lavc58.123.100 mjpeg
2021-05-03 22:22:24.596 27125-28059/com.app.name I/ffmpeg-kit: Side data:
2021-05-03 22:22:24.596 27125-28059/com.app.name I/ffmpeg-kit:
2021-05-03 22:22:24.604 27125-28059/com.app.name I/ffmpeg-kit: cpb:
2021-05-03 22:22:24.604 27125-28059/com.app.name I/ffmpeg-kit: bitrate max/min/avg: 0/0/200000 buffer size: 0
2021-05-03 22:22:24.604 27125-28059/com.app.name I/ffmpeg-kit: vbv_delay: N/A
2021-05-03 22:22:24.605 27125-28059/com.app.name I/ffmpeg-kit: frame= 1 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x
2021-05-03 22:22:24.929 27125-28059/com.app.name E/ffmpeg-kit: [image2 @ 0x7e88243000] Could not open file : saf:163/image.jpg
2021-05-03 22:22:24.930 27125-28059/com.app.name E/ffmpeg-kit: av_interleaved_write_frame(): I/O error
2021-05-03 22:22:24.932 27125-28059/com.app.name I/ffmpeg-kit: frame= 1 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.0557x
2021-05-03 22:22:24.934 27125-28059/com.app.name I/ffmpeg-kit: video:1144kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead:
2021-05-03 22:22:24.934 27125-28059/com.app.name I/ffmpeg-kit: unknown
2021-05-03 22:22:24.940 27125-28056/com.app.name D/MyFfmpegHelper: Command failed with state COMPLETED and rc 1.null
2021-05-03 22:22:24.944 27125-28059/com.app.name I/ffmpeg-kit: Conversion failed!
Environment
The text was updated successfully, but these errors were encountered: