Re: [osg-users] [build] How to play Video on Android

223 views
Skip to first unread message

Koduri Lakshmi

unread,
Feb 1, 2013, 2:24:54 AM2/1/13
to osg-...@lists.openscenegraph.org
Hi Jordi Torres,

I build ffmpeg1.0 with OSG3.0.1 for Android (for armv7-a) device. When build example I am getting the errors like "undefined reference to `av_log_set_callback".

I Added "USE_OSGPLUGIN(ffmpeg)" to .h file and added ldflag as "-losgdb_ffmpeg" to Android.mk file.

Here are the full error log


Code:
Install : libQCAR.so => libs/armeabi/libQCAR.so
Compile++ arm : TrikonaQCAREdu <= Tracker.cpp
In file included from jni/osgModel.hpp:80:0,
from jni/Tracker.cpp:3:
/home/ttpl/Android/android-ndk-r8b/platforms/android-5/arch-arm/usr/include/jni.h:592:13: note: the mangling of 'va_list' has changed in GCC 4.4
Compile++ arm : TrikonaQCAREdu <= osgModel.cpp
In file included from jni/osgModel.hpp:80:0,
from jni/osgModel.cpp:1:
/home/ttpl/Android/android-ndk-r8b/platforms/android-5/arch-arm/usr/include/jni.h:592:13: note: the mangling of 'va_list' has changed in GCC 4.4
Compile++ arm : TrikonaQCAREdu <= SampleUtils.cpp
SharedLibrary : libTrikonaQCAREdu.so
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(ReaderWriterFFmpeg.o): In function `ReaderWriterFFmpeg':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp:107: undefined reference to `av_log_set_callback'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp:111: undefined reference to `av_lockmgr_register'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp:114: undefined reference to `av_register_all'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp:116: undefined reference to `avformat_network_init'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegParameters.o): In function `~FFmpegParameters':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegParameters.cpp:40: undefined reference to `av_dict_free'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegParameters.o): In function `FFmpegParameters':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegParameters.cpp:35: undefined reference to `av_dict_set'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegParameters.o): In function `osgFFmpeg::FFmpegParameters::parse(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegParameters.cpp:62: undefined reference to `av_dict_set'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegParameters.cpp:55: undefined reference to `av_find_input_format'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegParameters.cpp:60: undefined reference to `av_dict_set'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderAudio.o): In function `osgFFmpeg::FFmpegDecoderAudio::open(AVStream*)':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp:82: undefined reference to `avcodec_find_decoder'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp:92: undefined reference to `avcodec_open'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderAudio.o): In function `decode_audio':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp:24: undefined reference to `av_init_packet'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp:28: undefined reference to `avcodec_decode_audio3'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderAudio.o): In function `osgFFmpeg::FFmpegPacket::clear()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegPacket.hpp:45: undefined reference to `av_free_packet'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderAudio.o): In function `osgFFmpeg::FFmpegDecoderAudio::decodeFrame(void*, unsigned int)':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp:356: undefined reference to `avcodec_flush_buffers'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderAudio.o): In function `osgFFmpeg::FFmpegPacket::clear()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegPacket.hpp:45: undefined reference to `av_free_packet'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoder.o): In function `AvStrError':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:34: undefined reference to `av_strerror'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoder.o): In function `osgFFmpeg::FormatContextPtr::cleanup()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.hpp:51: undefined reference to `avformat_close_input'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoder.o): In function `osgFFmpeg::FFmpegDecoder::open(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, osgFFmpeg::FFmpegParameters*)':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:123: undefined reference to `avformat_alloc_context'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:126: undefined reference to `avformat_open_input'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:135: undefined reference to `avformat_find_stream_info'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:148: undefined reference to `av_dump_format'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:151: undefined reference to `av_find_best_stream'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:155: undefined reference to `av_find_best_stream'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoder.o): In function `osgFFmpeg::FFmpegDecoder::rewindButDontFlushQueues()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:373: undefined reference to `av_rescale_q'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:376: undefined reference to `av_seek_frame'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoder.o): In function `osgFFmpeg::FFmpegDecoder::seekButDontFlushQueues(double)':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:400: undefined reference to `av_rescale_q'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:405: undefined reference to `av_seek_frame'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoder.o): In function `osgFFmpeg::FFmpegPacket::clear()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegPacket.hpp:45: undefined reference to `av_free_packet'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoder.o): In function `osgFFmpeg::FFmpegDecoder::readNextPacketNormal()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:279: undefined reference to `av_read_frame'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:306: undefined reference to `av_dup_packet'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:282: undefined reference to `url_feof'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoder.o): In function `osgFFmpeg::FFmpegPacket::clear()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegPacket.hpp:45: undefined reference to `av_free_packet'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegPacket.hpp:45: undefined reference to `av_free_packet'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegPacket.hpp:45: undefined reference to `av_free_packet'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegPacket.hpp:45: undefined reference to `av_free_packet'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FFmpegDecoderVideo::releaseBuffer(AVCodecContext*, AVFrame*)':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:383: undefined reference to `av_freep'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:385: undefined reference to `avcodec_default_release_buffer'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FFmpegDecoderVideo::getBuffer(AVCodecContext*, AVFrame*)':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:369: undefined reference to `avcodec_default_get_buffer'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:370: undefined reference to `av_malloc'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `~FFmpegDecoderVideo':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:44: undefined reference to `sws_freeContext'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:51: undefined reference to `avcodec_close'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FramePtr::cleanup()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp:46: undefined reference to `av_free'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp:46: undefined reference to `av_free'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp:46: undefined reference to `av_free'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp:46: undefined reference to `av_free'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FFmpegDecoderVideo::convert(AVPicture*, int, AVPicture*, int, int, int)':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:273: undefined reference to `sws_scale'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:265: undefined reference to `sws_getContext'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FFmpegDecoderVideo::publishFrame(double, bool)':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:311: undefined reference to `avpicture_fill'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FFmpegDecoderVideo::decodeLoop()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:166: undefined reference to `avcodec_decode_video2'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FFmpegPacket::clear()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegPacket.hpp:45: undefined reference to `av_free_packet'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FFmpegDecoderVideo::decodeLoop()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:235: undefined reference to `avcodec_flush_buffers'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FFmpegDecoderVideo::open(AVStream*)':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:77: undefined reference to `avcodec_find_decoder'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:87: undefined reference to `avcodec_open2'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:91: undefined reference to `avcodec_alloc_frame'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FramePtr::cleanup()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp:46: undefined reference to `av_free'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FFmpegDecoderVideo::open(AVStream*)':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:94: undefined reference to `avcodec_alloc_frame'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FramePtr::cleanup()':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp:46: undefined reference to `av_free'
/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall/obj/local/armeabi/libosgdb_ffmpeg.a(FFmpegDecoderVideo.o): In function `osgFFmpeg::FFmpegDecoderVideo::open(AVStream*)':
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:95: undefined reference to `avpicture_get_size'
/home/ttpl/Android/OSG/ffmpeg_Plugin/OpenSceneGraph-3.0.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp:99: undefined reference to `avpicture_fill'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/lib] Error 1



If I added "-lffmpeg" to "LOCAL_LDLIBS" in Android.mk file then I am getting the following error.


Code:
cannot find -lffmpeg



Can you please help how to link ffmpeg plugin for Andorid.

...


Thank you!

Cheers,
Koduri

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=52314#52314




_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Jan Ciger

unread,
Feb 1, 2013, 4:52:05 AM2/1/13
to osg-...@lists.openscenegraph.org
On Fri, Feb 1, 2013 at 8:24 AM, Koduri Lakshmi <ankir...@gmail.com> wrote:
If I added "-lffmpeg" to "LOCAL_LDLIBS" in Android.mk file then I am getting the following error.


Code:
cannot find -lffmpeg

Can you please help how to link ffmpeg plugin for Andorid.

Maybe dumb question, but do you actually have ffmpeg for Android compiled and the libraries installed? It isn't included with the precompiled pack of OSG dependencies for Android. I also believe that the library is not actually called libffmpeg.so.x.x but that there are several shared libs that you need to link in - libavformat, libavcodec and libavutils (maybe few more).

Regards,

Jan

 


Jordi Torres

unread,
Feb 1, 2013, 5:59:40 AM2/1/13
to OpenSceneGraph Users
Hi Koduri as Jan said you have to add the generated ffmpeg static libs, I have in my Android.mk:

$(OSG_SDK)/obj/local/armeabi-v7a/libavformat.a \
$(OSG_SDK)/obj/local/armeabi-v7a/libavcodec.a \
$(OSG_SDK)/obj/local/armeabi-v7a/libavdevice.a \
$(OSG_SDK)/obj/local/armeabi-v7a/libswscale.a \
$(OSG_SDK)/obj/local/armeabi-v7a/libavutil.a \
$(OSG_SDK)/obj/local/armeabi-v7a/libswresample.a \
$(OSG_SDK)/obj/local/armeabi-v7a/libswresample.a \

But I use 0.8 version so make sure about what static libraries have you generated for ffmpeg in the 1.0 version.

Cheers.

2013/2/1 Jan Ciger <jan....@gmail.com>
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




--
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com

Koduri Lakshmi

unread,
Feb 1, 2013, 6:14:54 AM2/1/13
to osg-...@lists.openscenegraph.org
Hi Jordi Torres and Jan Ciger,

Thank you very much for the reply.

I downloaded ffmpeg1.0 from FFmpeg site. Now compiled statically to generate ".a" files. I generated

/armeabi-v7a/libavformat.a
/armeabi-v7a/libavcodec.a
/armeabi-v7a/libavdevice.a
/armeabi-v7a/libswscale.a
l/armeabi-v7a/libavutil.a
/armeabi-v7a/libswresample.a
/armeabi-v7a/libswresample.a.

After this I downloaded the latest submission for ffmpeg plugin (by David Longest dated Oct 09, 2012). Replaced all files of this to "$OSG/src/plugins/ffmpeg" folder. Now I gave the following cmake command


Code:
cmake .. -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF -DDYNAMIC_OPENSCENEGRAPH=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF -DOSG_GL_MATRICES_AVAILABLE=ON -DOSG_GL_VERTEX_FUNCS_AVAILABLE=ON -DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=ON -DOSG_GL_FIXED_FUNCTION_AVAILABLE=ON -DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF -DOSG_GL1_AVAILABLE=OFF

-DFFMPEG_LIBAVCODEC_INCLUDE_DIRS=/home/ttpl/Android/OSGSupport/ffmpeg -DFFMPEG_LIBAVCODEC_LIBRARIES=/home/ttpl/Android/OSGSupport/ffmpeg/libavcodec.a -DFFMPEG_LIBAVDEVICE_INCLUDE_DIRS=/home/ttpl/Android/OSGSupport/ffmpeg -DFFMPEG_LIBAVDEVICE_LIBRARIES=/home/ttpl/Android/OSGSupport/ffmpeg/libavdevice.a -DFFMPEG_LIBAVFORMAT_INCLUDE_DIRS=/home/ttpl/Android/OSGSupport/ffmpeg -DFFMPEG_LIBAVFORMAT_LIBRARIES=/home/ttpl/Android/OSGSupport/ffmpeg/libavformat.a -DFFMPEG_LIBAVUTIL_INCLUDE_DIRS=/home/ttpl/Android/OSGSupport/ffmpeg -DFFMPEG_LIBAVUTIL_LIBRARIES=/home/ttpl/Android/OSGSupport/ffmpeg/libavutil.a -DFFMPEG_LIBSWSCALE_INCLUDE_DIRS=/home/ttpl/Android/OSGSupport/ffmpeg -DFFMPEG_LIBSWSCALE_LIBRARIES=/home/ttpl/Android/OSGSupport/ffmpeg/libswscale.a -DFFMPEG_ROOT=/home/ttpl/Android/OSGSupport/ffmpeg

-DOSG_GL2_AVAILABLE=OFF -DOSG_GL3_AVAILABLE=OFF -DOSG_GLES1_AVAILABLE=ON -DOSG_GLES2_AVAILABLE=OFF -DCMAKE_CXX_FLAGS=__STDC_CONSTANT_MACROS -DJ=4 -DCMAKE_INSTALL_PREFIX=/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall



Faced some error and solved them.

"make install" installed all include and lib files to "/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall" folder.

I gave "/home/ttpl/Android/OpenSceneGraph-3.0.1_GL1/osginstall" path as "OSG_ANDROID_DIR" in Android.mk files.

As of my knowledge to use ffmpeg plugin I should use "USE_OSGPLUGIN()" macro. Here I am facing problem. I dont have much idea how to use this plugin.

Can you please help me how to link ffmpeg plugin for Android.

...


Thank you!

Cheers,
Koduri

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=52322#52322

Jordi Torres

unread,
Feb 1, 2013, 6:37:19 AM2/1/13
to osg-...@lists.openscenegraph.org
Hi Koduri,

You can create a Quad and then add the image stream, something like that:

    osg::ref_ptr<osg::Image> image = osgDB::readImageFile( "/sdcard/videodemo256256.avi.ffmpeg" );
    osg::ImageStream* imageStream = dynamic_cast<osg::ImageStream*>( image.get() );
    if ( imageStream )
    {
         imageStream->play();
    }
    osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
    texture->setImage( image.get() );
   
    osg::ref_ptr<osg::Geometry> quad = osg::createTexturedQuadGeometry(
    osg::Vec3(), osg::Vec3(1.0f, 0.0f, 0.0f), osg::Vec3(0.0f, 0.0f, 1.0f),0,1,1,0 );
    quad->getOrCreateStateSet()->setTextureAttributeAndModes( 0, texture.get() );
   
    osg::ref_ptr<osg::Geode> geode = new osg::Geode;
    geode->addDrawable( quad.get() );
 
Cheers.


2013/2/1 Koduri Lakshmi <ankir...@gmail.com>

Koduri Lakshmi

unread,
Feb 1, 2013, 6:43:55 AM2/1/13
to osg-...@lists.openscenegraph.org
Hi Jordi Torres,

Thank you very much for the help. I did that in .cpp file as follows



Code:
img = osgDB::readImageFile(filename);
videoStream[idx] = dynamic_cast<osg::ImageStream*>(img);

if (videoStream[idx].valid())
{
LOG( "Got movie");
videoStream[idx]->setLoopingMode( osg::ImageStream::NO_LOOPING);

}
else
{
LOG( "No movie!");
}

aspectRatio = (float)img->t() / (float)img->s();
videoWidth = img->t();
videoHeight =img->s();

mVideoTexture = new osg::Texture2D;
geode = new osg::Geode;
mVideoTexture->setImage( videoStream[idx].get() );

geode->addDrawable(osg::createTexturedQuadGeometry(
osg::Vec3(0, 0, 0),
osg::Vec3(videoWidth, 0, 0),
osg::Vec3(0, 0, videoHeight)
));
geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, mVideoTexture, osg::StateAttribute::ON );
mtForMarker[idx] = new osg::MatrixTransform();
mtForMarker[idx]->addChild(geode.get());


modelSwitch->addChild(mtForMarker[idx]);




but it is not compiling. When I gave "nkd-build" then getting above said errors. I think these are linker errors. How to use ffmpeg plugin-in my code.



...


Thank you!

Cheers,
Koduri

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=52325#52325

Jordi Torres

unread,
Feb 1, 2013, 6:52:33 AM2/1/13
to osg-...@lists.openscenegraph.org
You should investigate further about what are failing in your compilation and fix it, as I don't have your computer in front of me I can't say much more.

Sorry.



2013/2/1 Koduri Lakshmi <ankir...@gmail.com>

Koduri Lakshmi

unread,
Feb 1, 2013, 7:07:33 AM2/1/13
to osg-...@lists.openscenegraph.org
Hi Jordi Torres,

When I use "jpeg" plugin, I did the following things

1) USE_OSGPLUGIN(jpeg) in .h file
2) Added "-ljpeg" to LOCAL_LDLIBS in Android.mk file
3) Added "-losgdb_jpeg \" to LOCAL_LDFLAGS in Android.mk file.

Similarly I need to do for ffmpeg plugin also.

I added "-lffmpeg" to LOCAL_LDLIBS and "-losgdb_ffmpeg\" to LOCAL_LDFLAGS in Android.mk file. And added USE_OSGPLUGIN(ffmpeg) in .h file. After ndk-build I am getting


Code:
cannot find -lffmpeg



If I remove "-lffmpeg" to LOCAL_LDLIBS then the above said errors.

What steps do I need to take to use ffmpeg plugin.
Does am I going in correct way.

I will dig more if the steps what I did are correct. Can you please guide me in correct way.
...


Thank you!

Cheers,
Koduri

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=52328#52328

Jordi Torres

unread,
Feb 1, 2013, 7:19:10 AM2/1/13
to osg-...@lists.openscenegraph.org
I said you in a previous mail, and Jan too.

You need to add to your TARGET_LDLIBS in the Android.mk of your application the libraries generated when building the ffmpeg. NO ffmpeg.a library is created so calling to -lffmpeg is an error and try to link with it too.

$(OSG_SDK)/obj/local/armeabi-v7a/libavformat.a \
$(OSG_SDK)/obj/local/armeabi-v7a/libavcodec.a \
$(OSG_SDK)/obj/local/armeabi-v7a/libavdevice.a \
$(OSG_SDK)/obj/local/armeabi-v7a/libswscale.a \
$(OSG_SDK)/obj/local/armeabi-v7a/libavutil.a \
$(OSG_SDK)/obj/local/armeabi-v7a/libswresample.a \
$(OSG_SDK)/obj/local/armeabi-v7a/libswresample.a \


2013/2/1 Koduri Lakshmi <ankir...@gmail.com>

David Longest

unread,
Feb 1, 2013, 11:20:02 AM2/1/13
to osg-...@lists.openscenegraph.org
Koduri,

> When I use "jpeg" plugin, I did the following things
>
> 1) USE_OSGPLUGIN(jpeg) in .h file
> 2) Added "-ljpeg" to LOCAL_LDLIBS in Android.mk file
> 3) Added "-losgdb_jpeg \" to LOCAL_LDFLAGS in Android.mk file.
>
> Similarly I need to do for ffmpeg plugin also.
>
> I added "-lffmpeg" to LOCAL_LDLIBS and "-losgdb_ffmpeg\" to LOCAL_LDFLAGS in Android.mk file. And added USE_OSGPLUGIN(ffmpeg) in .h file. After ndk-build I am getting

In this case, when you add -ljpeg to LOCAL_LDLIBS it attempts to find libjpeg.a or libjpeg.so. Try adding the following to LOCAL_LDLIBS.

-lavformat
-lavcodec
-lavdevice
-lswscale
-lavutil
-lswresample

David

Koduri Lakshmi

unread,
Feb 5, 2013, 4:59:49 AM2/5/13
to osg-...@lists.openscenegraph.org
Hi Jordi Torres & David Longest,

Thank you very much for the valuable information.

I compiled successfully. When try to read a "avi" file then "osgDB::readImageFile" always returns NULL.

Does ffmpeg plug-in needs any external ".so" or ".a" files (like PNG needs libpng15.dll with osgdb_png.dll).

I tried to place "ffmpeg.so" file in AndroidProject "lib" folder. And also tried with libavformat.a libavcodec.a etc. Still no luck.

Please excuse me if it is very basic question. I am very much new to android and trying to port windows project to Android.


...


Thank you!

Cheers,
Koduri

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=52381#52381

David Longest

unread,
Feb 6, 2013, 9:37:28 AM2/6/13
to osg-...@lists.openscenegraph.org
Koduri,

As long as you are able to link the libav* libraries, the plugin should work. Where are you storing the video file?

You should also be able to see what is happening by catching logs from OSG using the NotifyHandler.

David

Koduri Lakshmi

unread,
Feb 9, 2013, 4:09:39 AM2/9/13
to osg-...@lists.openscenegraph.org
Hi,

The log is


Code:
02-09 14:01:41.114: W/Osg Viewer(14026): FFmpegImageStream::open : av_open_input_file() failed
02-09 14:01:41.118: W/Osg Viewer(14026): Warning: Could not find plugin to read objects from file "/mnt/sdcard/VideoTest/1.avi.ffmpeg".



The steps what I followed to generate osg ffmpeg plugin

Step - 1) Downloaded ffmpeg1.0 from ffmpeg site and extracted to "ffmpeg" flolder.
(renamed time.h to avtime.h of libavutil to avoid OSG compile errors)

Step - 2) Executed the following script to generate armv7 libs (for Android 2.2)


Code:
NDK=/home/ttpl/Android/android-ndk-r8b
PLATFORM=$NDK/platforms/android-8/arch-arm
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86

function build_one
{
./configure --target-os=linux \
--prefix=$PREFIX \
--enable-cross-compile \
--extra-libs="-lgcc" \
--arch=arm \
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--nm=$PREBUILT/bin/arm-linux-androideabi-nm \
--sysroot=$PLATFORM \
--extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
--disable-shared \
--enable-static \
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
--disable-everything \
--enable-demuxer=mov \
--enable-demuxer=h264 \
--disable-ffplay \
--enable-protocol=file \
--enable-avformat \
--enable-avcodec \
--enable-decoder=rawvideo \
--enable-decoder=mjpeg \
--enable-decoder=h263 \
--enable-decoder=mpeg4 \
--enable-decoder=h264 \
--enable-parser=h264 \
--disable-network \
--enable-zlib \
--disable-avfilter \
--enable-avdevice \
$ADDITIONAL_CONFIGURE_FLAG

make clean
make -j4 install
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
$PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
}

#arm v6
#CPU=armv6
#OPTIMIZE_CFLAGS="-marm -march=$CPU"
#PREFIX=./android/$CPU
#ADDITIONAL_CONFIGURE_FLAG=
#build_one

#arm v7vfpv3
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
PREFIX=./android/$CPU
ADDITIONAL_CONFIGURE_FLAG=
build_one



Step -3) This generated "libavcodec.a", "libavdevice.a", "libavformate.a", "libutil.a", "libswresample.a" and "libswscale.a" into the folder "./android/armv7-a/lib". Also "libffmpeg.so"
in "./Android/armv7-a" folder.

Step - 4) Copied all these ".a" files and "pkconfig" folder to "/home/ttpl/Android/OSGSupport/ffmpeg" folder

Step -5) Extracted OSG3.0.1 and created "build" directory in it. Added " FIND_PACKAGE(FFmpeg)" after "ANDROID_3RD_PARTY()" to CMakeList.txt file

Step -6) Gave the following cmake command


Code:
cmake .. -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF -DDYNAMIC_OPENSCENEGRAPH=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF -DOSG_GL_MATRICES_AVAILABLE=ON -DOSG_GL_VERTEX_FUNCS_AVAILABLE=ON -DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=ON -DOSG_GL_FIXED_FUNCTION_AVAILABLE=ON -DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF -DOSG_GL1_AVAILABLE=OFF
-DFFMPEG_LIBAVCODEC_INCLUDE_DIRS=/home/ttpl/Android/OSGSupport/ffmpeg -DFFMPEG_LIBAVCODEC_LIBRARIES=/home/ttpl/Android/OSGSupport/ffmpeg/libavcodec.a -DFFMPEG_LIBAVDEVICE_INCLUDE_DIRS=/home/ttpl/Android/OSGSupport/ffmpeg -DFFMPEG_LIBAVDEVICE_LIBRARIES=/home/ttpl/Android/OSGSupport/ffmpeg/libavdevice.a -DFFMPEG_LIBAVFORMAT_INCLUDE_DIRS=/home/ttpl/Android/OSGSupport/ffmpeg -DFFMPEG_LIBAVFORMAT_LIBRARIES=/home/ttpl/Android/OSGSupport/ffmpeg/libavformat.a -DFFMPEG_LIBAVUTIL_INCLUDE_DIRS=/home/ttpl/Android/OSGSupport/ffmpeg -DFFMPEG_LIBAVUTIL_LIBRARIES=/home/ttpl/Android/OSGSupport/ffmpeg/libavutil.a -DFFMPEG_LIBSWSCALE_INCLUDE_DIRS=/home/ttpl/Android/OSGSupport/ffmpeg -DFFMPEG_LIBSWSCALE_LIBRARIES=/home/ttpl/Android/OSGSupport/ffmpeg/libswscale.a -DFFMPEG_ROOT=/home/ttpl/Android/OSGSupport/ffmpeg
-DOSG_GL2_AVAILABLE=OFF -DOSG_GL3_AVAILABLE=OFF -DOSG_GLES1_AVAILABLE=ON -DOSG_GLES2_AVAILABLE=OFF -DCMAKE_CXX_FLAGS=-D__STDC_CONSTANT_MACROS -DJ=4 -DCMAKE_INSTALL_PREFIX=/home/ttpl/Android/OpenSceneGraph-3.0.1_GL/osginstall



Step -7) make installed all files to "/home/ttpl/Android/OpenSceneGraph-3.0.1_GL/osginstall" which includes "libosgdb_ffmpeg.a" plugin in both "armeabi" and "armeabi-v7a" folders

Step -8) Created an android project from the existed (OpenGLES1) example.

Step -9) Modified Android.mk file as follows. Given only modifications


Code:
OSG_ANDROID_DIR := /home/ttpl/Android/OpenSceneGraph-3.0.1_GL/osginstall
....................
LOCAL_LDLIBS := -llog -lGLESv1_CM -ldl -lz -lgnustl_static $(OPENGLES_LIB) $(OSG_ANDROID_DIR)/obj/local/armeabi-v7a/libavformat.a $(OSG_ANDROID_DIR)/obj/local/armeabi-v7a/libavcodec.a $(OSG_ANDROID_DIR)/obj/local/armeabi-v7a/libavdevice.a $(OSG_ANDROID_DIR)/obj/local/armeabi-v7a/libswscale.a $(OSG_ANDROID_DIR)/obj/local/armeabi-v7a/libavutil.a $(OSG_ANDROID_DIR)/obj/local/armeabi-v7a/libswscale.a
............

LOCAL_LDFLAGS := -L $(LIBDIR) \
-losgdb_dds \
-losgdb_openflight \
-losgdb_tga \
-losgdb_rgb \
-losgdb_ffmpeg \
..............







Step -10) Copied all ".a" files from "/home/ttpl/Android/OSGSupport/ffmpeg" folder" to " /home/ttpl/Android/OpenSceneGraph-3.0.1_GL/osginstall/obj/local/armeabi-v7a" folder to
avoid linking errors .

Step-11) Added the following code to "OsgMainApp.hpp"


Code:
osg::ref_ptr<osg::ImageStream> videoStream[3];
osg::ref_ptr<osg::Texture2D> mVideoTexture;
osg::ref_ptr<osg::Geode> geode;// = new osg::Geode;
osg::Image* img;



and to "OsgMainApp.cpp" (OsgMainApp::loadModels() method)


Code:
img = osgDB::readImageFile("/mnt/sdcard/VideoTest/1.avi.ffmpeg");
if (img!=NULL)
{
osg::notify(osg::ALWAYS)<<"AVI READ DONE"<<std::endl;

}
else
{
osg::notify(osg::ALWAYS)<<"AVI NOT RED----------------"<<std::endl;
}



Step 12) Compiled with android-ndk (version 8b)

Step 13) From Eclipse did "Run as Android Application".

Step 14) When enter model path and clicked "Accept" button then NULL from "readImageFile"

Is there any mistake in the above process (especially in generation of ffmpeg libs).

I am using Ubuntu - 12.04.

Testing device is Samsung Gulaxy (GT-I9000) model. Android version is 2.2.1.

Can you please guide how to solve this problem.

...


Thank you!

Koduri

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=52516#52516

David Longest

unread,
Feb 11, 2013, 11:56:33 AM2/11/13
to osg-...@lists.openscenegraph.org
Koduri,

> Code:
> 02-09 14:01:41.114: W/Osg Viewer(14026): FFmpegImageStream::open : av_open_input_file() failed
> 02-09 14:01:41.118: W/Osg Viewer(14026): Warning: Could not find plugin to read objects from file "/mnt/sdcard/VideoTest/1.avi.ffmpeg".

This leads me to believe you either don't have permission to read that folder from the application, or ffmpeg cannot read the file with your current build configuration. If you should have permissions to read from that folder, you may want to find the correct demuxer for the "avi" container. Otherwise, you can try getting a raw h264 file to play.

David
Reply all
Reply to author
Forward
0 new messages