[guardian-dev] android-ffmpeg-java: FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed

Josh Steiner josh at vitriolix.com
Mon Jul 22 15:21:21 EDT 2013


Ahh, it was that stupid workaround we have to do to stop Android from
compressing stuff in res/raw by renaming ffmpeg to ffmpeg.mp3. .. I missed
that step when setup a new build.

For posterity, what made this confusing to debug is this line:

is = context.getResources().openRawResource(R.raw.ffmpeg);

R.raw.ffmpeg should be loading ffmpeg.mp3, but it doesn't really read that
way at a skim, so I naively had it just named res/raw/ffmpeg

The file *must* be renamed ffmpeg.mp3 (and sox.mp3) to prevent aapt from
compressing the file when building your apk.

-Josh


On Sun, Jul 21, 2013 at 7:36 PM, Nathan of Guardian <
nathan at guardianproject.info> wrote:

> And ffmpeg is indeed there in the APK?
>
> Josh Steiner <josh at vitriolix.com> wrote:
>>
>>  Minor correction... it's now happening on my builds of storymaker
>> too... wonder what changed.  -josh
>>
>>
>> On Sun, Jul 21, 2013 at 6:03 PM, Josh Steiner <josh at vitriolix.com> wrote:
>>
>>> I just setup a new test app to try some stuff out, this is the first
>>> time I've tried to integrate android-ffmpeg-java into an app. it's dying
>>> when it tries to install the ffmpeg binary from res/raw.  This is in fact
>>> the exact same project as I currently use in StoryMaker, which works... but
>>> not in this new app. did I miss some configuration/setup step?
>>>
>>> It's failing here:
>>>
>>> long assetLength =
>>> mContext.getResources().openRawResourceFd(R.raw.ffmpeg).getLength();
>>>
>>> stacktrace:
>>>
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122):
>>> android.content.res.Resources$NotFoundException: File res/raw/ffmpeg from
>>> drawable resource ID #0x7f040000
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> android.content.res.Resources.openRawResourceFd(Resources.java:981)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> org.ffmpeg.android.FfmpegController.checkBinary(FfmpegController.java:49)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> org.ffmpeg.android.FfmpegController.<init>(FfmpegController.java:41)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> io.scal.ffmpegparceltest.MainActivity.concat(MainActivity.java:180)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> io.scal.ffmpegparceltest.MainActivity.access$0(MainActivity.java:168)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> io.scal.ffmpegparceltest.MainActivity$3.onClick(MainActivity.java:79)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> android.view.View.performClick(View.java:4084)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> android.view.View$PerformClick.run(View.java:16966)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> android.os.Handler.handleCallback(Handler.java:615)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> android.os.Handler.dispatchMessage(Handler.java:92)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> android.os.Looper.loop(Looper.java:137)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> android.app.ActivityThread.main(ActivityThread.java:4745)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> java.lang.reflect.Method.invokeNative(Native Method)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> java.lang.reflect.Method.invoke(Method.java:511)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> dalvik.system.NativeStart.main(Native Method)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): Caused by:
>>> java.io.FileNotFoundException: This file can not be opened as a file
>>> descriptor; it is probably compressed
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> android.content.res.AssetManager.openNonAssetFdNative(Native Method)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> android.content.res.AssetManager.openNonAssetFd(AssetManager.java:428)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): at
>>> android.content.res.Resources.openRawResourceFd(Resources.java:978)
>>> 07-21 17:58:52.049: E/AndroidRuntime(16122): ... 16 more
>>>
>>>
>> ------------------------------
>>
>> Guardian-dev mailing list
>>
>> Post: Guardian-dev at lists.mayfirst.org
>> List info: https://lists.mayfirst.org/mailman/listinfo/guardian-dev
>>
>> To Unsubscribe
>> Send email to:  Guardian-dev-unsubscribe at lists.mayfirst.org
>> Or visit: https://lists.mayfirst.org/mailman/options/guardian-dev/nathan%40guardianproject.info
>>
>> You are subscribed as: nathan at guardianproject.info
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mayfirst.org/pipermail/guardian-dev/attachments/20130722/df24e232/attachment-0001.html>


More information about the Guardian-dev mailing list