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




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

Reply via email to