PDA

View Full Version : Rtmpdump build for Android


S74ck3r
08-23-2012, 07:35 AM
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
Mistake on shared library naming now fixed, new binaries uploaded (see first post for link).

https://github.com/downloads/S74ck3r/rtmpdump/rtmpdump.png

Richard

dextor
09-09-2012, 01:49 PM
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
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
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
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
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
ah sorry, I see what you mean now..

Try the other download from my github (https://github.com/downloads/S74ck3r/rtmpdump/android-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
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
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
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-apps-from-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
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
Glad you got it working and you find it useful.

flinki
09-16-2012, 08:02 AM
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
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
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 :

InputStream inputStream = getAssets().open("rtmpgw");

OutputStream out = new FileOutputStream(newFile(getFilesDir()+"/rtmpgw"));

Then I set the right permissions through :

Runtime.getRuntime().exec("/system/bin/chmod 777 "+"rtmpgw",getFilesDir());

that's also working . But when I try to start rtmpgw through:
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-enabler/wiki/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
might be a stupid question but you have given your app the relevant permissions? (http://developer.android.com/reference/android/Manifest.permission.html)

S74ck3r
10-30-2012, 11:24 AM
updated build again, https://github.com/S74ck3r/rtmpdump/downloads

S74ck3r
11-02-2012, 10:29 AM
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
New android and windows binaries available updated to PolarSSL 1.2.0.

CyKiller
11-09-2012, 07:35 AM
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
no problem, new version uploaded.

CyKiller
11-14-2012, 08:09 AM
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
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
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
Hey maybe could someone compile flvstreamer for android:
http://download.savannah.gnu.org/releases/flvstreamer/source/
Thanks in advance

S74ck3r
11-21-2012, 02:07 AM
I haven't tried it out because I'm at work but this might be ok
https://github.com/downloads/S74ck3r/rtmpdump/flvstreamer-2.1c-android.7z

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

flinki
11-22-2012, 11:42 AM
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
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
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
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-multi/repository/revisions/129/entry/branches/test/videoInput_GUID/videoInputSrcAndDemos/libs/DShow/Include/strsafe.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
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
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
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
Somebody please help!

meddem
01-04-2013, 03:46 PM
has someone the updated librtmp.so file for android? :)

S74ck3r
01-05-2013, 12:45 PM
This should still work.

https://github.com/downloads/S74ck3r/rtmpdump/rtmpdump-android-polarssl-1.2.0-shared-lib-2012-11-13.7z

elBradford
01-15-2013, 10:21 AM
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
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
Moving downloads from github to bitbucket.

Current build is now here https://bitbucket.org/S74ck3r/rtmpdump-android/downloads

danturner
01-30-2013, 09:02 AM
Hi S74ck3r,

Have you managed to succesfully cross-compile librtmp with the librtmp.a archive included? I see you've managed to compile the librtmp.so.0 file, it seems. I'm trying to add librtmp support to ffmpeg for Android, and need a cross-compiled librtmp in order to do this.

danturner
01-30-2013, 09:03 AM
Thanks for all your hard work, by the way....

S74ck3r
01-31-2013, 01:59 AM
All the hard work has been done by people much cleverer than me.

I just wanted to find out a bit about how the android ndk worked and thought I'd share.

Anyway, I've put up an archive of all the build artefacts at the bitbucket link above (local.7z). Hopefully it contains the files that you need.

danturner
01-31-2013, 04:43 AM
Exactly what I was after! Thanks so much! Now to see if it works.....

elBradford
02-22-2013, 03:10 PM
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

Dan,

Sorry for the long delay. I don't have email notifications turned on apparently.

Yes, I got it running properly. I confirmed through adb shell and saw the process. I even saw the logs as it started converting the stream. What you might be experiencing is a problem with ports. Check out "ephemeral ports" or something like that. You need a good port # otherwise it won't have the proper permissions. If you can get a root adb shell then you can troubleshoot as root.

Have you had any further luck since you last posted?

Bradford

thebearnecessities
02-22-2013, 03:33 PM
I'm trying to get rtmpdump working on android.

The reason is because I am using xbmc media centre and would like to use xbmc media centre to access a UK based video on demand service called 4OD (its channel 4's on demand service).

I know nothing about RTMPDUMP or what it does but i know that I need it in order to use 4OD no xbmc.

Is anyone able to point me in the right direction of how to get it working on android? have other people been using it successfully?

the addon simply wants to know where the rtmpdump.exe file is (on the windows version) but on android i don't know what to point it towards since i presume the exe file is no use on android.

i have been looking at your downloads page https://bitbucket.org/S74ck3r/rtmpdump-android/downloads but i don't know which one is for me and where to put the files on my android box etc.

any help much appreciated.

also how come i cant subscribe to the thread? i click on thread tools and get taken t the main forum page. is it because i dont have enough posts maybe?

danturner
02-28-2013, 02:03 PM
Dan,

Sorry for the long delay. I don't have email notifications turned on apparently.

Yes, I got it running properly. I confirmed through adb shell and saw the process. I even saw the logs as it started converting the stream. What you might be experiencing is a problem with ports. Check out "ephemeral ports" or something like that. You need a good port # otherwise it won't have the proper permissions. If you can get a root adb shell then you can troubleshoot as root.

Have you had any further luck since you last posted?

Bradford

Kinda.... I thought my issue was that Vitamio uses an older version of ffmpeg, that doesn't support non-seekable http streams. When i corrected this in ffmpeg and tested it in Linux it seemed to work, but the recompiliation for Android never worked properly.

Are you using Vitamio in your app? I assume you are because videoview won't support flash streams. May i be so forthright as to ask for a brief overview of your exact process? This has been causing me quite a bit of grief recently.

Thanks,

Dan

elBradford
03-06-2013, 10:21 AM
Kinda.... I thought my issue was that Vitamio uses an older version of ffmpeg, that doesn't support non-seekable http streams. When i corrected this in ffmpeg and tested it in Linux it seemed to work, but the recompiliation for Android never worked properly.

Are you using Vitamio in your app? I assume you are because videoview won't support flash streams. May i be so forthright as to ask for a brief overview of your exact process? This has been causing me quite a bit of grief recently.

Thanks,

Dan

I used both Vitamio and the native videoview, neither of them worked.

I got rtmpgw running by doing something like this: https://code.google.com/p/market-enabler/wiki/ShellCommands

I tested it by getting a root adb shell to make sure I could run it, then when I ran it in my app I made sure to use a ephemeral port so it could run without root permissions.

I think the issue is that rtmpgw creates a http stream, but what is the format of that stream? Is it a flv stream? I don't really understand how rtmpgw changes the rtmp stream, and what its output is besides it being a http stream.

danturner
03-07-2013, 08:50 AM
It's an flv stream, I believe. The native videoview won't ever play this format, while Vitamio will. The problem is, however, that the version of ffmpeg used to build Vitamio doesn't not support non-seekable streams (such as that given out by rtmpgw). This is why rtmpgw won't start streaming when sent an http GET request from Vitamio. The latest version of ffmpeg does support this, however, and hopefully a future build of Vitamio will include this too.

That's the reason for your (and my) pain.

ivied
03-13-2013, 11:24 AM
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.

..


8) Done.

Hello! thx for this instructions!
Sorry for my epic noobish question. i'm complete all instruction(it was really hard for me, near 8 hours for that) and cross compile files(on my PC). And so what i must doo for run this files on my android device:confused: How this program work? Give me direction for the study, realy thx for answer!
And one more question. Now I make an application for android, where I have to get rtmp stream from online flash player (player passed html code). I need read this stream for display in the my application as html code. will rtpmdump help me for that? or maybe you know a more efficient implementation?

aaes
09-17-2013, 07:38 AM
Hi Richard,

May you compile customized rtmpdump for android? http://stream-recorder.com/forum/customized-rtmpdump-binaries-patch-file-t16103.html :)

Yours sincerely

S74ck3r
09-18-2013, 03:13 AM
I probably won't have time to do this for a couple of days.

If you can't wait that long, or just want to be able to do it for yourself so you don't have to rely on others then follow the instructions here
(https://bitbucket.org/S74ck3r/rtmpdump-android/downloads) for building rtmpdump for xbmc.

This should be all you need.

Found a spare 5 mins... try this https://bitbucket.org/S74ck3r/rtmpdump-android/downloads/rtmpdump%20-%20android%20-%20KSV%20-%20shared%20-%2018-09-13.zip

I haven't tested it but it should work ok. It should work with xbmc.

Also there is a static build (won't work with xbmc) here https://bitbucket.org/S74ck3r/rtmpdump-android/downloads/rtmpdump%20-%20android%20-%20KSV%20-%20static%20-%2018-09-13.zip


Richard

elBradford
12-19-2013, 10:34 PM
It's an flv stream, I believe. The native videoview won't ever play this format, while Vitamio will. The problem is, however, that the version of ffmpeg used to build Vitamio doesn't not support non-seekable streams (such as that given out by rtmpgw). This is why rtmpgw won't start streaming when sent an http GET request from Vitamio. The latest version of ffmpeg does support this, however, and hopefully a future build of Vitamio will include this too.

That's the reason for your (and my) pain.

Dan,

I'm still working on this. Yep! I found your stackoverflow questions in my search, and your conversation on the last question here (http://stackoverflow.com/questions/14687059/vitamio-libffmpeg-so) makes it sound like you figured it out. How's it going for you?

I've kind of switched gears, trying to compile Vitamio's ffmpeg with librtmp support so that I don't need to run rtmpgw separately. Is that what you did? If so, any pointers? I can't get ffmpeg to compile properly.

Bradford

Elgero
01-31-2014, 02:12 PM
I need some help with creating a script that I can run with Android Terminal Emulator.

Yesterday I bought my first tablet and rooted it. I downloaded the Android version of rtmpdump with KSV's patches (static version) and copied it to "/system/bin/" and gave it R/W and execute permissions. I'm using it with Chaturbate and it works fine, but I'd like to use a script to make it easier to use, but having some problems with it. I need to enter the modelname for the webpage (-p) and I need the modelname + date/time for the filename (-o), but this doesn't work. I can get the date/time, but the 'model' variable is always empty. I also tried to pass the modelname as an argument, but it doesn't recognize $1.


#!/system/bin/sh

now=$(date +"_%Y-%m-%d_%H-%M-%S").flv

echo "Enter model name: "

read model

echo "Saving stream as: $model$now"

rtmpdump -r "rtmp://...." -p "http://chaturbate.com/$model/" -o "/storage/UsbDriveA/$model$now"

This is the result (removed rtmpdump line).

u0_a160@android:/ $ su
u0_a160@android:/ # cd sdcard
u0_a160@android:/sdcard # sh cb.sh
: not found
: not found
Enter model name:
: not found
milfy
: not found
Saving stream as: _2014-01-31_22-03-14.flv
cb.sh[12]: u0_a160@android:/: not found
cb.sh[13]: u0_a160@android:/: not found
cb.sh[14]: u0_a160@android:/sdcard: not found
cb.sh[17]: Enter: not found
u0_a160@android:/sdcard #

S74ck3r
02-27-2014, 03:21 AM
So I haven't been able to sort out building ffmpeg with librtmp for android but it looks like someone else has;

https://github.com/OnlyInAmerica/FFmpeg-Android

There's a script there, I haven't tried it but if it works then please thank the author.

ilje
05-02-2014, 09:25 AM
plz how to use rtmpsuck ?

snuky
10-02-2014, 11:42 AM
Hi, i get rtmpdump [1] syntax error '@4D4' unexpected on Andoid 4.4 and 4.0 with 2.3 build and https://bitbucket.org/S74ck3r/rtmpdump-android/ builds. Any idea?