Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   rtmpdump (http://stream-recorder.com/forum/forumdisplay.php?f=54)
-   -  

Rtmpdump build for Android

(http://stream-recorder.com/forum/showthread.php?t=13466)

S74ck3r 08-23-2012 07:35 AM

Rtmpdump build for Android


 
So I've been struggling for a while to get Rtmpdump to build for Android on windows.

If anyone wants to try it I've uploaded the binaries here https://github.com/S74ck3r/rtmpdump/downloads

It's built from the latest code, again with no patches or additions. Don't know if it works properly as I haven't tested it yet but it does appear to load.

Shared library version not working.. will look at it later but don't bother downloading that one. --Update, rename the shared library to "librtmp." (without the quotes but with the fullstop at the end that's the important bit) and it will work.

I'm not responsible if it bricks your phone...

Richard

S74ck3r 08-24-2012 03:52 AM

Re: Rtmpdump build for Android


 
Mistake on shared library naming now fixed, new binaries uploaded (see first post for link).



Richard

dextor 09-09-2012 01:49 PM

Re: Rtmpdump build for Android


 
hi richard,

i would like to know more about making rtmpdump work on android. i tried to run it via terminal emulator but it keeps telling me "permission denied" even with root access.

how did you manage to make it run? does it require root?

thanks

S74ck3r 09-10-2012 01:53 AM

Re: Rtmpdump build for Android


 
Hi dextor,

I copied the lib file to /system/lib and the application files to /system/xbin.

After that you to set the application files as executable, just use adb shell, remount the file system as r/w and chmod them using 755.

Alternatively get es file explorer (it's free), make sure it has root access and set the file system as writeable, find the file and view it's properties.
From there you can make it executable by ticking a checkbox.

hope that helps
Richard

dextor 09-10-2012 03:18 AM

Re: Rtmpdump build for Android


 
thanks so much for your answer, that definitely helps me out.

i was wondering why rtmpdump needs root access though.. do you know the reason behind this?

S74ck3r 09-10-2012 03:57 AM

Re: Rtmpdump build for Android


 
I don't think it does, you just need root access to copy the files into the correct places.

It works find from a shell without requesting root access first.

dextor 09-10-2012 06:15 AM

Re: Rtmpdump build for Android


 
yes, but the library must be placed mandatory into the system directory in order for rtmpdump to work, right?

i'm looking for a completely non-root solution: since i need to execute rtmpdump from an Android application, i don't care if the libraries are installed, my only need is to launch an instance of rtmpdump

EDIT: thanks for your time :)

S74ck3r 09-10-2012 06:37 AM

Re: Rtmpdump build for Android


 
ah sorry, I see what you mean now..

Try the other download from my github (https://github.com/downloads/S74ck3r...-rtmpdump.zip), it is a static build so doesn't need the library (just make sure the binaries are executable).

If you need any testers for your app I'd be interested.

dextor 09-10-2012 10:28 AM

Re: Rtmpdump build for Android


 
that did the trick. i found out that executing from /sdcard/ is not possible if it is mounted just with r/ permissions. i copied your rtmpdump executable in /data/local/tmp and it totally works.

i love you, really :) once i integrate this solution on my application i will send a copy for you to test!

andygr 09-11-2012 06:42 AM

Re: Rtmpdump build for Android


 
Works great. Thanks you. Does somebody figured out how to launch vlc in Android like...
rtmpdump blabla | vlc -

S74ck3r 09-11-2012 09:12 AM

Re: Rtmpdump build for Android


 
this is the best I can come up with, but I'm no expert. Can't guarantee it will work as I don't have/can't get vlc on my phone but it does try and open the file once the download has started.

Basically you need to find the package and activity name of the application that you want to start (have a look here or google it http://simrandev.com/coding/launch-a...-adbterminal/). I just fired up adb logcat and started a video to find the activity.

The -d parameter is the location of your rtmpdump output file.

rtmpdump -r -W etc -o /sdcard/test.flv | am start -n com.cooliris.media/.MovieView -d /sdcard/test.flv

The standard android movie player doesn't handle flv so I just got an error saying the file couldn't be played.

andygr 09-12-2012 04:17 AM

Re: Rtmpdump build for Android


 
Thank you very much for your explanation. It worked but with rtmpgw. Its better for me cause it does not use temp files. I do like:

am start -a android.intent.action.VIEW -d http://127.0.0.1 -f 0x10000000 -n org.videolan.vlc.betav7neon/.gui.video.VideoPlayerActivity
rtmpgw -v -r etc

Only need to figure out how to start this terminal script through a widget.
Thank you very much for providing the port.

S74ck3r 09-12-2012 05:29 AM

Re: Rtmpdump build for Android


 
Glad you got it working and you find it useful.

flinki 09-16-2012 08:02 AM

Re: Rtmpdump build for Android


 
Great work guys! Thanks . About a year ago a thought it must pretty cool to watch streams on my galaxy s2 but i never managed to do so . I just had not much time to test it out either. A few days ago I got my nexus 7 tablet and I began to search in the internet and found this thread. Now everything is working and I can start to programm my app to watch my favourite streams. Thanks !!

S74ck3r maybe you could post the commands you used to compile rtmpdump for android on Windows. I'm very intrested in this. I guess you used cygwin win mingw compiler right?

S74ck3r 09-16-2012 02:56 PM

Re: Rtmpdump build for Android


 
hi flinki,

didn't use cygwin, just mingw. The build process is pretty much the same as a windows build once you've setup the android toolchain.

Basically cross compile polarssl then build rtmpdump as usual using
SYS=android.

flinki 09-17-2012 08:51 AM

Re: Rtmpdump build for Android


 
I'm currently working on my app and I'm trying to start rtmpgw or rtmpdump within the app . I placed the executables in the assets folder of my app so that i can access them and create the file :
Code:

InputStream inputStream = getAssets().open("rtmpgw");
                       
OutputStream out = new FileOutputStream(newFile(getFilesDir()+"/rtmpgw"));

Then I set the right permissions through :

Code:

Runtime.getRuntime().exec("/system/bin/chmod 777 "+"rtmpgw",getFilesDir());
that's also working . But when I try to start rtmpgw through:
Code:

Runtime.getRuntime().exec("./rtmpgw,getFilesDir());
nothing happens and I don't get output back.


I tried also to execute a shell first and then write to the Outputstream but nothing seems to work.

Maybe someone can provide me java code or shell script how to start rtmpgw within a app.

Ref:http://code.google.com/p/market-enab.../ShellCommands

http://gimite.net/en/index.php?Run%20native%20executable%20in%20Android %20App


Update :
Oh man , I forgot to read the error stream ..........
Now I get an Error message
rtmpdump doesn't start capturing because of a ERROR: Problem accessing the DNS. (addr: live.tv-kino.net) don't know why I'm getting this.
tried also other rtmp streams . But starting from adb shell works strange....

S74ck3r 09-17-2012 01:04 PM

Re: Rtmpdump build for Android


 
might be a stupid question but you have given your app the relevant permissions? (http://developer.android.com/referen...ermission.html)

S74ck3r 10-30-2012 11:24 AM

Re: Rtmpdump build for Android


 
updated build again, https://github.com/S74ck3r/rtmpdump/downloads

S74ck3r 11-02-2012 10:29 AM

Re: Rtmpdump build for Android


 
Ok, the builds I made previously weren't displaying the stream properties (codecs, length etc).

The new builds (Android and Windows) do.

S74ck3r 11-08-2012 03:51 AM

Re: Rtmpdump build for Android


 
New android and windows binaries available updated to PolarSSL 1.2.0.

CyKiller 11-09-2012 07:35 AM

Re: Rtmpdump build for Android


 
Quote:

Originally Posted by S74ck3r (Post 56238)
New android and windows binaries available updated to PolarSSL 1.2.0.

Any chance you can compile the librtmp.so for android please? Or relate on what lib files are needed for openssl, I get an error when compiling stating that the header file ssl.h is not in the hmac file. It is there I checked a million times and had no difference no matter what I tried.

Thanks.

S74ck3r 11-13-2012 03:53 AM

Re: Rtmpdump build for Android


 
no problem, new version uploaded.

CyKiller 11-14-2012 08:09 AM

Re: Rtmpdump build for Android


 
Much appreciated, I downloaded and noticed it was compiled for linux. I was wondering if you can cross compile it for android using

$ make CROSS_COMPILE=arm-none-linux- INC= I/my/cross/includes

with the extension librtmp.so which can be used under android. A tutorial would also be great, I been trying to figure this out for days now. Thanks a lot for the updated file it was much appreciated!!

S74ck3r 11-14-2012 10:27 AM

Re: Rtmpdump build for Android


 
Have you actually tried the files?

They are built with the android ndk using CC=arm-linux-androideabi

CyKiller 11-14-2012 07:27 PM

Re: Rtmpdump build for Android


 
Sorry for the soft explaination, it is for XBMC and the scripts read librtmp.so - I will give it a try but I am sure it will not recognize it. I will try it out and report back.

flinki 11-20-2012 12:51 PM

Re: Rtmpdump build for Android


 
Hey maybe could someone compile flvstreamer for android:
http://download.savannah.gnu.org/rel...reamer/source/
Thanks in advance

S74ck3r 11-21-2012 02:07 AM

Re: Rtmpdump build for Android


 
I haven't tried it out because I'm at work but this might be ok
https://github.com/downloads/S74ck3r....1c-android.7z

It's built from this svn://svn.sv.gnu.org/flvstreamer.

flinki 11-22-2012 11:42 AM

Re: Rtmpdump build for Android


 
Thanks !!

I have problems compiling it on my own... Maybe you can help me :
I created an standalone toolchain for android using androidNDK toolkit.
I crosscompiled polarssl using this command : make CC=arm-linux-androideabi-gcc APPS=

Now i have the polarssl library . I copied it to include path of the android standalone toolchain.
Then i modified the 2 makefiles of rtmpdump so that I use the arm-linux-androideabi-gcc compiler. But when i try to compile it somehow I get :


$ make all SHARED= SYS=android CRYPTO=POLARSSL LIBZ="-lz -static"
make[1]: Entering directory `/home/Florian/rtmpdump/librtmp'
/home/Florian/arm-linux-androideabi-4.6/arm-linux-androideabi-4.6/bin/arm-linux-
androideabi-gcc.exe -Wall -DRTMPDUMP_VERSION=\"v2.4\" -DUSE_POLARSSL -O2
-c -o rtmp.o rtmp.c
In file included from rtmp.c:33:0:
rtmp_sys.h:64:30: fatal error: polarssl/version.h: No such file or directory
compilation terminated.
<builtin>: recipe for target `rtmp.o' failed
make[1]: *** [rtmp.o] Error 1
make[1]: Leaving directory `/home/Florian/rtmpdump/librtmp'
Makefile:91: recipe for target `librtmp/librtmp.a' failed
make: *** [librtmp/librtmp.a] Error 2

Seems that the compiler can't find the polarssl library... I tried to figure out where I have to copy the libpolarssl.a file but up to now I didn't managed to...

S74ck3r 11-22-2012 01:30 PM

Re: Rtmpdump build for Android


 
After you compile polarssl run make install to copy the library and headers to the right place.

For my setup the command looks like this -

make install DESTDIR=/c/tmp/android-toolchain/sysroot

Then when you build rtmpdump you need to include something like;

INC="-I/c/tmp/android-toolchain/sysroot/include"

I'm getting round to putting together a step by step, will post it here probably on the weekend.

(edit) oh and I didn't include LIBZ='-lz -static' when building for android.

flinki 11-22-2012 06:28 PM

Re: Rtmpdump build for Android


 
Slowly moving foward... Finally found the place where the library has to be... :arm-linux-androideabi-4.6\arm-linux-androideabi-4.6\sysroot\usr\lib

Then i had another ERROR : it seemed , that the andoroid toolchian can't find the libz library. Although it's included in the android toolchain...

Finaly ! Don't know how and why but now it works.

Thanks for your help!

S74ck3r 11-23-2012 03:29 AM

Re: Rtmpdump build for Android


 
Howto compile Rtmpdump for Android

1) Get the Android ndk (http://developer.android.com/tools/sdk/ndk/index.html) and follow the instructions here (PATH_TO_NDK_INSTALL/../android-ndk-r7/docs/STANDALONE-TOOLCHAIN.html) to create a standalone android toolchain.

2) Download and install Mingw (http://sourceforge.net/projects/mingw/files/MinGW/).

3) Download PolarSSL source from (https://polarssl.org/download) and unzip it to your mingw/msys home directorys. For me this was C:\MinGW\msys\1.0\home\S74ck3r. Current builds are made with PolarSSL 1.2.0

If you're going to build with PolarSSL 1.2.0 you will need to download an additional header from (http://nuicode.com/projects/ccv-mult...e.h?format=raw) and copy it to your
mingw/include folder because it's not included in Mingw.


4) Open Mingw shell, add the path to the standalone android toolchain binaries to the path. On my system I did this, but it will depend on where you installed
the toolchain.

'export PATH=/c/tmp/android-toolchain/bin:$PATH'

5) CD to the unzipped PolarSSL directory and type;

'make CC=arm-linux-androideabi-gcc APPS='
'make install DESTDIR=/c/tmp/android-toolchain/sysroot'

(Obviously change the install destination directory if your toolchain is in a different location)

6) Get the Rtmpdump source. The following commands assume you have retrieved it from my repository (https://github.com/S74ck3r/rtmpdump.git).
You can obviously get the source directly from the official repository. There is no difference in the actual code (i.e. no added patches or additional functionality)
but I have added a target for android to the makefiles for convenience.

7) CD to the Rtmpdump source directory and type;

-- Shared library version
'make SYS=android CROSS_COMPILE=arm-linux-androideabi- INC="-I/c/tmp/android-toolchain/sysroot/include" CRYPTO=POLARSSL'
-- Static version
'make SYS=android CROSS_COMPILE=arm-linux-androideabi- INC="-I/c/tmp/android-toolchain/sysroot/include" CRYPTO=POLARSSL SHARED='

(Obviously change this if your toolchain is in a different location, make sure the include path is correct)


8) Done.

CyKiller 11-23-2012 05:43 PM

Re: Rtmpdump build for Android


 
Thank you so much, loaded up my ubunt virtual box session, and voila followed orders and all good with polarssl!! One major issue where I am completely lost, the librtmp.so.0 still maintains the .0 expression when I need it for librtmp.so, any tips on how to adjust the extension.

S74ck3r 11-24-2012 03:37 AM

Re: Rtmpdump build for Android


 
Maybe you could try renaming the file yourself, or running the install
target from the makefile which installs the shared library and creates a link to it with just the .so extension.

Dee Jay 12-08-2012 05:02 AM

Re: Rtmpdump build for Android


 
If i want watch "rtmpe" channels from android phone, or android TV Box, how i can do this, and make playlist of channel with names?
If this possible?
Thanks!

Dee Jay 12-12-2012 12:19 AM

Re: Rtmpdump build for Android


 
Somebody please help!

meddem 01-04-2013 03:46 PM

Re: Rtmpdump build for Android


 
has someone the updated librtmp.so file for android? :)

S74ck3r 01-05-2013 12:45 PM

Re: Rtmpdump build for Android


 
This should still work.

https://github.com/downloads/S74ck3r...-2012-11-13.7z

elBradford 01-15-2013 10:21 AM

Re: Rtmpdump build for Android


 
S74ck3r, thanks for your support in this thread.

I successfully got the rtmpgw static binary to work in my Android project. When I confirmed that the gateway is running, I try to view the video stream on the appropriate port and my video player crashes. I know the streams work in VLC, however they don't work correctly in the default VideoView OR the Vitamio Player (which is based on ffmpeg).

Do you have any insight into this problem? They are twitch.tv or justin.tv streams if that helps. Also, the streams in VLC say that the video codec is h264 and audio is usually mp3.

danturner 01-19-2013 06:19 PM

Re: Rtmpdump build for Android


 
ElBradford,

Are you saying that rtmpgw is successfully streaming out data with a http get request from inside your app, and simply not playing back in videoview? I have been trying to use vitamio as a streamer by including the rtmpgw info as part of the http get request from vitamio, with rtmpgw running on a different machine. All i am getting is 'range request not supported' errors in rtmpgw. Did you manage to circumvent this problem?

Regards


Dan

S74ck3r 01-30-2013 06:48 AM

Re: Rtmpdump build for Android


 
Moving downloads from github to bitbucket.

Current build is now here https://bitbucket.org/S74ck3r/rtmpdu...roid/downloads


All times are GMT -6. The time now is 08:37 AM.