Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to play streaming video (and audio)? #31

Open
misol101 opened this issue Jun 16, 2011 · 16 comments
Open

How to play streaming video (and audio)? #31

misol101 opened this issue Jun 16, 2011 · 16 comments

Comments

@misol101
Copy link

Hello,

your setDataSource doc states "Sets the data source (file-path or http/rtsp URL) to use", but it seems that it simply tries to open the supplied datasource as a file (with av_open_input_file), so it cannot play streams or remote files.

Are you working on enabling this as well in your library? If not, do you have any pointers on how it could be done?

Thanks for any help!

@tsingien
Copy link

config ffmpeg:
jni/libffmpeg/config.h

-CONFIG_HTTP_PROTOCOL 0
-CONFIG_TCP_PROTOCOL 0

+CONFIG_HTTP_PROTOCOL 1
+CONFIG_TCP_PROTOCOL 1

jni/libffmpeg/config-arm.mak:
-!CONFIG_TCP_PROTOCOL=yes
-!CONFIG_HTTP_PROTOCOL=yes

+CONFIG_TCP_PROTOCOL=yes
+CONFIG_HTTP_PROTOCOL=yes

@misol101
Copy link
Author

Thanks, but after a clean build with your changes I get:

/home/misol/Android/android-ndk-r5c/samples/havlenapetr-FFMpeg-7c27aa2/obj/local/armeabi/libavformat.a(allformats.o): In function av_register_all': /home/misol/Android/android-ndk-r5c/samples/havlenapetr-FFMpeg-7c27aa2/jni/libffmpeg/libavformat/allformats.c:237: undefined reference tohttp_protocol'
/home/misol/Android/android-ndk-r5c/samples/havlenapetr-FFMpeg-7c27aa2/jni/libffmpeg/libavformat/allformats.c:237: undefined reference to `tcp_protocol'
collect2: ld returned 1 exit status
make: *** [/home/misol/Android/android-ndk-r5c/samples/havlenapetr-FFMpeg-7c27aa2/obj/local/armeabi/libffmpeg_jni.so] Error 1

Can you help out again?

@misol101
Copy link
Author

Finally managed to compile with tcp/hhtp on, using the following (with a few ugly hacks, I'm no make build expert):

diff -r jni/libffmpeg/config-arm.mak ../../samples/havlenapetr-FFMpeg-7c27aa2/jni/libffmpeg/config-arm.mak
272c272
+CONFIG_NETWORK=yes
---
-!CONFIG_NETWORK=yes
948c948
+CONFIG_HTTP_PROTOCOL=yes
---
-!CONFIG_HTTP_PROTOCOL=yes
957c957
+CONFIG_TCP_PROTOCOL=yes
---
-!CONFIG_TCP_PROTOCOL=yes
diff -r jni/libffmpeg/config.h ../../samples/havlenapetr-FFMpeg-7c27aa2/jni/libffmpeg/config.h
199c199
+#define CONFIG_NETWORK 1
---
-#define CONFIG_NETWORK 0
875c875
+#define CONFIG_HTTP_PROTOCOL 1
---
-#define CONFIG_HTTP_PROTOCOL 0
884c884
+#define CONFIG_TCP_PROTOCOL 1
---
-#define CONFIG_TCP_PROTOCOL 0
diff -r jni/libffmpeg/config.mak ../../samples/havlenapetr-FFMpeg-7c27aa2/jni/libffmpeg/config.mak
272c272
+CONFIG_NETWORK=yes
---
-!CONFIG_NETWORK=yes
948c948
+CONFIG_HTTP_PROTOCOL=yes
---
-!CONFIG_HTTP_PROTOCOL=yes
957c957
+CONFIG_TCP_PROTOCOL=yes
---
-!CONFIG_TCP_PROTOCOL=yes
diff -r jni/libffmpeg/libavformat/network.h ../../samples/havlenapetr-FFMpeg-7c27aa2/jni/libffmpeg/libavformat/network.h
67c67
+#if 0
---
-
93d92
+ #endif
diff -r jni/libffmpeg/libavformat/os_support.h ../../samples/havlenapetr-FFMpeg-7c27aa2/jni/libffmpeg/libavformat/os_support.h
50c50
+//typedef int socklen_t;
---
-typedef int socklen_t;

Unfortunately (and like I suspected) there is no difference when setDataSource is called (av_open_input_file fails, which seems to make sense since it seems to work with files only?).
tsingien, how do I actually make any use of my now "http/tcp-enabled" library?

@tsingien
Copy link

maybe you should call
./configure --your parameters such as --enable-network --enable-http etc.
on linux.

this command will create config.h and config.mak. then copy config options to your havlenapetr project.

@misol101
Copy link
Author

But are you saying that remote streams and urls will in fact play "automagically" as long as my ffmpeg config is right? That av_open_input_file (as called in mediaplayer.cpp) will open and play these with no other modifications needed?
Is that working for you?

@tsingien
Copy link

yes.

Will u please give me your email address? I'll send my config.h and config.mak to u.

@misol101
Copy link
Author

Great, thanks! Send to ******@yahoo.com

@easycui
Copy link

easycui commented Aug 30, 2011

I also have such problem. Do you mind send me config.h and config.mak? My email is easy.cuiyuxin@gmail.com Thanks.

@Mag83
Copy link

Mag83 commented Sep 7, 2011

I'm getting the following errors updating the config files. Could you please also send me the config files? (_@_*.com)
/network.h:69: : redefinition of 'struct __kernel_sockaddr_storage'
/network.h:83: error: redefinition of 'struct addrinfo'

I just want to play an rtsp h264 HiP stream on 2.2 Android tablets.
Default Android MediaPlayer has at least 10s buffering delay and I need to reduce it.
Using ffmpeg with jni seems to be, at that time, the only way to reduce it.

@kietcao
Copy link

kietcao commented Nov 7, 2011

I'm getting the following errors updating the config files.
Compile thumb : ffmpeg_jni <= cmdutils.c
In file included from libffmpeg/cmdutils.c:44:
libffmpeg/libavformat/network.h:69: error: redefinition of 'struct __kernel_sockaddr_storage'
libffmpeg/libavformat/network.h:83: error: redefinition of 'struct addrinfo'
make: *** [libffmpeg/cmdutils.o] Error 1

I just want to play an rtsp h264 HiP stream on 2.2 Android tablets.
Default Android MediaPlayer has at least 10s buffering delay and I need to reduce it.
Using ffmpeg with jni seems to be, at that time, the only way to reduce it.
Email: caoanhkiet2003@gmail.com. Thanks for your reply.

@kietcao
Copy link

kietcao commented Nov 16, 2011

I build with configuration is successfull.

/libffmpeg/config.h
#define CONFIG_NETWORK 1
#define CONFIG_HTTP_PROTOCOL 1
#define CONFIG_TCP_PROTOCOL 1
#define CONFIG_RTMP_PROTOCOL 1
#define CONFIG_RTP_PROTOCOL 1
#define CONFIG_UDP_PROTOCOL 1
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
#define HAVE_STRUCT_ADDRINFO 1
#define HAVE_SOCKLEN_T 1


libffmpeg/config.mak
CONFIG_NETWORK=yes
CONFIG_HTTP_PROTOCOL=yes
CONFIG_TCP_PROTOCOL=yes
CONFIG_RTMP_PROTOCOL=yes
CONFIG_RTP_PROTOCOL=yes
CONFIG_UDP_PROTOCOL=yes
HAVE_STRUCT_SOCKADDR_STORAGE=yes
HAVE_SOCKLEN_T=yes
HAVE_STRUCT_ADDRINFO=yes

But It does not play rtsp. Please let me know, why is it?

@tsingien
Copy link

I never test rtsp stream. http is ok.

@kietcao
Copy link

kietcao commented Nov 19, 2011

Do You use http with m3u8? Please send me link to testing?

@xccloveny
Copy link

@kietcao can you send me the config.sh config.h and config.mak? xccloveny@gmail.com
Thank you very much!

@xccloveny
Copy link

@misol101 can you send me the config.sh config.h and config.mak? xccloveny@gmail.com
Thank you very much!
I have the same problem,maybe you had done this now :),please give me some advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@kietcao @misol101 @tsingien @easycui @Mag83 @xccloveny and others