I managed to get the head project built successfully. However, I'm having trouble using it. I created a simple JNI call that attempts to call av_register_all and I get library errors.
When I run the application on my device I am told that it is unable to load library libavformat-HEAD-1.0.so
So I tried to load this via the System.loadLibrary method and I was unable to find libavcodec-HEAD-1.0.so. Working my way back in this manner I eventually attempted to load libavutil-HEAD-1.0.so which yielded an error 'cannot locate symbol "__strchr_chk"'.
Any help and direction would be appreciated.
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My guess is that you are not building FFmpeg against exactly the same Android source code which is used for building your device filesystem. E.g. you downloaded latest Android source code and using it for building FFmpeg. However, your device filsystem contains files from older Android version. If you do not have exactly the same source code used for your device filesystem, you can try to track changes to the parts where __strchr_chk is called, and move to earlier versions before this changes. Eventually, you will be able to build everything properly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, thanks for the help. I was able to get the source for Android 4.2.1 and build the FFmpeg source again.
I was also able to execute the av_register_all function, but I get a crash trying to call the avformat_open_input function. I think it is a memory access issue because the error I get is "Fatal signal 11 (SIGSEGV)". My concern is I am either loading the libraries wrong using System.loadLibrary (which I can't figure any other way to do this) or I need to debug what is going on inside of the FFmpeg code.
If I need to make calls to android/log.h, how would I edit the build files to include the android libraries?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I managed to add the logging into the code for shared libraries, but the build fails for static libraries. I tried both adding liblog to LOCAL_STATIC_LIBRARIES and LOCAL_STATIC_LIBRARIES but it didn't help.
However, since I was able to created shared libraries I did have something I could use but they still don't completely work. I traced avformat_open_input up till it called av_gettime at which point the whole process hangs. It appears to just chew up the processor. I created a simple piece of code that just calls av_gettime and it hangs as well.
I created a second function named av_gettime2 identical to av_gettime and I was able to call it without issue. I subsequently did a replacement in all ffmpeg files to use the av_gettime2 function and suddenly it started to hang.
This is where I am really confused as to why it would do this. I tried downloading ffmpeg-1.0.1 and built that code, but I received the same hanging result.
I'm attempting to open an HTTP URL as the filename and I have INTERNET permission set on my app, but I don't know what else is going on. I did change the filename to a local MP4 file on the sdcard and it loads fine.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I managed to get the head project built successfully. However, I'm having trouble using it. I created a simple JNI call that attempts to call av_register_all and I get library errors.
When I run the application on my device I am told that it is unable to load library libavformat-HEAD-1.0.so
So I tried to load this via the System.loadLibrary method and I was unable to find libavcodec-HEAD-1.0.so. Working my way back in this manner I eventually attempted to load libavutil-HEAD-1.0.so which yielded an error 'cannot locate symbol "__strchr_chk"'.
Any help and direction would be appreciated.
Thanks
My guess is that you are not building FFmpeg against exactly the same Android source code which is used for building your device filesystem. E.g. you downloaded latest Android source code and using it for building FFmpeg. However, your device filsystem contains files from older Android version. If you do not have exactly the same source code used for your device filesystem, you can try to track changes to the parts where __strchr_chk is called, and move to earlier versions before this changes. Eventually, you will be able to build everything properly.
Hi, thanks for the help. I was able to get the source for Android 4.2.1 and build the FFmpeg source again.
I was also able to execute the av_register_all function, but I get a crash trying to call the avformat_open_input function. I think it is a memory access issue because the error I get is "Fatal signal 11 (SIGSEGV)". My concern is I am either loading the libraries wrong using System.loadLibrary (which I can't figure any other way to do this) or I need to debug what is going on inside of the FFmpeg code.
If I need to make calls to android/log.h, how would I edit the build files to include the android libraries?
You probably call the avformat_open_input the propper way, eg is Your AVFormatContext* parameter set to NULL?
To use log.h functions, in Android.mk, append liblog to the LOCAL_SHARED_LIBRARIES variable for the library you want to debug, like this
Then include log header where you want it, declare LOG_TAG, and off you go...
I managed to add the logging into the code for shared libraries, but the build fails for static libraries. I tried both adding liblog to LOCAL_STATIC_LIBRARIES and LOCAL_STATIC_LIBRARIES but it didn't help.
However, since I was able to created shared libraries I did have something I could use but they still don't completely work. I traced avformat_open_input up till it called av_gettime at which point the whole process hangs. It appears to just chew up the processor. I created a simple piece of code that just calls av_gettime and it hangs as well.
I created a second function named av_gettime2 identical to av_gettime and I was able to call it without issue. I subsequently did a replacement in all ffmpeg files to use the av_gettime2 function and suddenly it started to hang.
This is where I am really confused as to why it would do this. I tried downloading ffmpeg-1.0.1 and built that code, but I received the same hanging result.
I'm attempting to open an HTTP URL as the filename and I have INTERNET permission set on my app, but I don't know what else is going on. I did change the filename to a local MP4 file on the sdcard and it loads fine.