OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

How to play Video on Android

Goto page 1, 2  Next
 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Build system [build]
View previous topic :: View next topic  
Author Message
wizards2012
User


Joined: 16 Mar 2012
Posts: 85

PostPosted: Thu Nov 08, 2012 4:54 am    Post subject:
How to play Video on Android
Reply with quote

Hi,

I build OSG for Android with GLES1. I loaded models successfully on my mobile.
Now I want to play video instead of model (like the one in Windows desktop). Is it possible to play a video using OSG on Android.

Can you please help me how to build plugins for these if possible. I searched my build installed directory but i did not found any ffmpeg or any other plug ins.

I am using Ubuntu 11.10 OS and my Android OS version is 2.2.
My mobile device is Samsung GTI 9000.



...


Thank you!

Cheers,
Koduri
Back to top
View user's profile Send private message
Jordi Torres
Guest





PostPosted: Thu Nov 08, 2012 8:41 am    Post subject:
How to play Video on Android
Reply with quote

Hi Koduri,

I managed to show video in Android after a few modifications in the ffmpeg plugin. I was going to send a submission, but somebody sent updates to make possible to run OSG with the latest ffmepg library. So I am waiting this submission to be merged to make the modifications again if possible.

The main modificiation is that in GL_ES the GL_BGRA mode is not supported, so you should use GL_RGBA. And change PIX_FMT_RGB32 for PIX_FMT_BGR32 to be consistent with the GL_RGBA change.

Cheers.

2012/11/8 Koduri Lakshmi < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>
Quote:
Hi,

I build OSG for Android with GLES1. I loaded models successfully on my mobile.
Now  I want to play video instead of model (like the one in Windows desktop). Is it possible to play a video using OSG on Android.

Can you please help me how to build plugins for these if possible. I searched my build installed directory but i did not found any ffmpeg or any other plug ins.

I am using Ubuntu 11.10 OS and my Android OS version is 2.2.
My mobile device is Samsung GTI 9000.



...


Thank you!

Cheers,
Koduri

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




_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



--
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com
Instituto de Automática e Informática Industrial
http://www.ai2.upv.es

------------------
Post generated by Mail2Forum
Back to top
wizards2012
User


Joined: 16 Mar 2012
Posts: 85

PostPosted: Fri Nov 09, 2012 4:16 am    Post subject:
Reply with quote

Hi Jordi Torres,

Thank you very much for the great help.

When can I expect new release?

Now I am using OSG3.0.1.

...


Thank you!

Cheers,
Koduri
Back to top
View user's profile Send private message
wizards2012
User


Joined: 16 Mar 2012
Posts: 85

PostPosted: Fri Feb 01, 2013 7:24 am    Post subject:
Reply with quote

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
Back to top
View user's profile Send private message
Jan Ciger
Guest





PostPosted: Fri Feb 01, 2013 9:48 am    Post subject:
How to play Video on Android
Reply with quote

On Fri, Feb 1, 2013 at 8:24 AM, Koduri Lakshmi < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
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

 

------------------
Post generated by Mail2Forum
Back to top
Jordi Torres
Guest





PostPosted: Fri Feb 01, 2013 10:56 am    Post subject:
How to play Video on Android
Reply with quote

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 < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>
Quote:

On Fri, Feb 1, 2013 at 8:24 AM, Koduri Lakshmi < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
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

 





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




--
Jordi Torres Fabra

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

------------------
Post generated by Mail2Forum
Back to top
wizards2012
User


Joined: 16 Mar 2012
Posts: 85

PostPosted: Fri Feb 01, 2013 11:14 am    Post subject:
Reply with quote

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

libavformat.a, libavcodec.a, libavdevice.a, libswscale.a, libavutil.a, libswresample.a, 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 have "libosgdb_ffmpeg.a" in ".....osginstall/local//armeabi-v7a" 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


Last edited by wizards2012 on Fri Feb 01, 2013 11:39 am; edited 1 time in total
Back to top
View user's profile Send private message
Jordi Torres
Guest





PostPosted: Fri Feb 01, 2013 11:33 am    Post subject:
How to play Video on Android
Reply with quote

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 < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>
Quote:
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




_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org





--
Jordi Torres Fabra

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

------------------
Post generated by Mail2Forum
Back to top
wizards2012
User


Joined: 16 Mar 2012
Posts: 85

PostPosted: Fri Feb 01, 2013 11:43 am    Post subject:
Reply with quote

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 (What are the changes do I need to do in Android.mk file to compile with ffmpeg plugin.).



...


Thank you!

Cheers,
Koduri
Back to top
View user's profile Send private message
Jordi Torres
Guest





PostPosted: Fri Feb 01, 2013 11:50 am    Post subject:
How to play Video on Android
Reply with quote

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 < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>
Quote:
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:ShockedN );
                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




_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org





--
Jordi Torres Fabra

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

------------------
Post generated by Mail2Forum
Back to top
wizards2012
User


Joined: 16 Mar 2012
Posts: 85

PostPosted: Fri Feb 01, 2013 12:07 pm    Post subject:
Reply with quote

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
Back to top
View user's profile Send private message
Jordi Torres
Guest





PostPosted: Fri Feb 01, 2013 12:15 pm    Post subject:
How to play Video on Android
Reply with quote

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 < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>
Quote:
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




_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org





--
Jordi Torres Fabra

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

------------------
Post generated by Mail2Forum
Back to top
David Longest
Guest





PostPosted: Fri Feb 01, 2013 4:16 pm    Post subject:
How to play Video on Android
Reply with quote

Koduri,

Quote:
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



------------------
Post generated by Mail2Forum
Back to top
wizards2012
User


Joined: 16 Mar 2012
Posts: 85

PostPosted: Tue Feb 05, 2013 9:59 am    Post subject:
Reply with quote

Hi Jordi Torres & David Longest,

Thank you very much for the valuable information.

I modified Android.mk file as follows

Code:
LOCAL_LDLIBS := \
    $(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/libswresample.a  $(OSG_ANDROID_DIR)/obj/local/armeabi-v7a/libswresample.a \




and 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). For static build I think there is no need of .a files, but still have a little doubt as i don't have much knowledge in Android.

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


Can you please give any clue?


Here is my code to read avi file

Code:
img = osgDB::readImageFile("/mnt/sdcard/ffmpegTest/1.avi.ffmpeg");
   LOG("Going to check image validity");
   if (img!=NULL)
      {
         LOG( "a valid Got movie");

      }
      else
         {
                LOG( "Not a valid movie!");
         }

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

   if (videoStream[idx].valid())
   {
      LOG( "Got movie");
      videoStream[idx]->setLoopingMode( osg::ImageStream::NO_LOOPING);
      //videoStream[idx]->seek(0);
      //videoStream[idx]->pause();
   }
   else
      {
             LOG( "No movie!");
      }

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

    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]);


In .h file

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

...


Thank you!

Cheers,
Koduri
Back to top
View user's profile Send private message
David Longest
Guest





PostPosted: Wed Feb 06, 2013 2:45 pm    Post subject:
How to play Video on Android
Reply with quote

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



------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Build system [build] All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts How to actually play animation in osg... Warren93 General 3 Tue Oct 23, 2018 1:23 pm View latest post
No new posts Cross-platform examples for Linux, ma... kornerr Announcement [ANN] 6 Tue Aug 14, 2018 10:51 am View latest post
No new posts Synchronize FFMPEG Video with Clock MaFa18 Plugins [osgPlugins] 0 Tue Aug 07, 2018 7:45 am View latest post
No new posts Can Material, Color, LightSource, etc... jovo General 1 Thu Jul 19, 2018 10:02 am View latest post
No new posts Can't access to assets in Android jovo General 1 Wed Jul 11, 2018 1:40 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP