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

After building FFMpeg recipe, I still am not able to do ffmpeg -v #1146

Closed
wingchen opened this issue Oct 22, 2017 · 9 comments
Closed

After building FFMpeg recipe, I still am not able to do ffmpeg -v #1146

wingchen opened this issue Oct 22, 2017 · 9 comments

Comments

@wingchen
Copy link

Hi,

I am very new to python-for-android, but I am loving it so far though.

I was able to build ffmpeg using the recipe with ubuntu 14.04 and the following dependencies list (some of them are created by myself):

requirements = python2,sqlite3,kivy,poyo,peewee,numpy,gevent,pyopenssl,requests,opencv,flask,websocket-client,ffmpeg,pyfcm

I was able to get the built *.so files.

screen shot 2017-10-21 at 5 56 47 pm

But when I try to run the following function in my main.py, I got permission error.

def test_ffmpeg():
  try:
    import subprocess
    print(subprocess.check_output(['ffmpeg', '-version']))
  except Exception as e:
    print(e)
    print('==> ffmpeg is not good :(, nooooooooooooo')
  else:
    print('==> ffmpeg is good :)')

Error: I/python (25293): [Errno 13] Permission denied

Am I missing something? thanks

@germn
Copy link
Contributor

germn commented Oct 23, 2017

ffmpeg recipe is designed to be dependency for ffpyplayer recipe (ffpyplayer - uses as a video provider), not something to be used "as is".

When you call subprocess.check_output(['ffmpeg', '-version']) what you're trying to do is to run ffmpeg executable file, but subprocess doesn't know where is that file (file named ffmpeg) located and you get error. But ffmpeg binary doesn't exist anywhere - it wasn't build by recipe since recipe isn't designed to provide it. Recipe builds bunch of .so files instead that used by ffpyplayer module. These files can also be used manually, but it's whole another topic.

Can you tell what task you're going to solve with ffmpeg? May be this task can be solved with ffpyplayer module directly (see it's api).

@wingchen
Copy link
Author

@germn I would like to run a couple of commands, something like:

ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 /path/to/file.mp4

or

ffmpeg -y -r 15 -i source.h264 -movflags +faststart -vcodec libx264 -profile:v baseline -level 3.0 -acodec aac destination.mp4

I am looking if I am able to do it in ffpyplayer. If you know how to do it, please let me know too.

Thanks a lot for the response.

@wingchen
Copy link
Author

I found that as soon as I put ffmpeg and ffprobe under /system/lib(64), I am able to run the commands in shell. I am testing it from python subprocess.check_output.

@AndreMiras
Copy link
Member

Well binary compilation it's specifically in the recipe configure part, see https://github.com/kivy/python-for-android/blob/95d41f7/pythonforandroid/recipes/ffmpeg/__init__.py#L81 so you can just enable it right?

@inclement
Copy link
Member

inclement commented Jan 31, 2019

Closing as not an issue, given how the ffmpeg recipe works. The recipe could be given some kind of option to include the binary if it would help people, but it isn't an active priority.

I also checked that the recipe seems to compile okay at the moment.

@AndreMiras
Copy link
Member

I can confirm I could generate the ffmpeg binary by commenting the flag mentioned above.
I compiled in Docker using the following:

python setup_testapp_python3.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements python3,ffmpeg

And the binary got compiled see it here:

file /home/user/.local/share/python-for-android/build/other_builds/ffmpeg/armeabi-v7a__ndk_target_21/ffmpeg/bin/ffmpeg
/home/user/.local/share/python-for-android/build/other_builds/ffmpeg/armeabi-v7a__ndk_target_21/ffmpeg/bin/ffmpeg: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/bin/linker, stripped

@rishabhjoshi
Copy link

@AndreMiras
I am also able to compile the binary, but I'm still unable to run/use them on Android device.
I'm trying to load a mp4 using pydub, but it's giving me a Permission Denied [13] error as above.

@AndreMiras
Copy link
Member

You should debug that issue trying to subprocess.check_output() something that you knows is working on the file system e.g. the ls or uname command. Then if this works try to ls -l the ffmpeg binary also from your android app also using subprocess call. The idea is to see if 1. you have the correct path to it and 2. if it has the execution flag. Please share your debug session here

@adarsh1783
Copy link

I found that as soon as I put ffmpeg and ffprobe under /system/lib(64), I am able to run the commands in shell. I am testing it from python subprocess.check_output.

@wingchen Can you explain how did you genrated ffmpeg binary for android and where did you put ? If possible please provide code snippets too. Thanks

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

6 participants