BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-17-2007, 10:46 AM   #1 (permalink)
iwr
New Member
 
Join Date: Sep 2007
Model: 8800
PIN: N/A
Carrier: Orange
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default mpeg4 stream on 8800

Please Login to Remove!

Hello,

I'm trying to develope an application that plays mpeg4 stream from a proprietry remote source (non-rtsp etc.). I know that the "classic" way to play video is by means of the java microedition multimedia framework (Player, DataSource, SourceStream an so on...). However I'd like to get more control over the process of decoding and playing the frames, so I'd like to decode & draw them on my own. The question is whether it's possible or not?
I tried to use java mpeg4 decoder but it is extremally slow. Is it possible to write the decoder in assemley and then use it from the java Midlet?

I'm a newbie in this area, so I'll appreciate any related information!

Thank you.
Offline  
Old 09-17-2007, 11:57 AM   #2 (permalink)
New Member
 
Join Date: Sep 2007
Model: 8830
PIN: N/A
Carrier: Sprint
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

writing your own player (the drawing frames part) is the only way to get true streaming to work. Both the mmapi player and rim mediaplayer require the entire stream to be downloaded before allowing you to start playing it.

As for custom binaries/libraries on a blackberry i don't think its possible. It looks like the only thing you load onto your blackberry is a .cod file. They've gone out of their way to control what can and can't be done on the device, allowing binaries of any kind would certainly break this.

If you do find a way to load libraries let me know because I'd like to port helix player to the blackberry. It would handle streaming media in most formats. until then I'm working on a standalone RTSP player.
Offline  
Old 09-17-2007, 02:17 PM   #3 (permalink)
iwr
New Member
 
Join Date: Sep 2007
Model: 8800
PIN: N/A
Carrier: Orange
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

kreneskyp,
Thanks for your response!
If the only way is to reneder each frame manually (that's exactly what I was afraid of), then how would you decode mpeg4 frame? There definitely exists a build-in decoder, but how can I access it?
I haven't managed so far to find either mpeg4 decoding api or a "low-level way" to make own...
Offline  
Old 09-17-2007, 03:10 PM   #4 (permalink)
New Member
 
Join Date: Sep 2007
Model: 8830
PIN: N/A
Carrier: Sprint
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by iwr View Post
kreneskyp,
Thanks for your response!
If the only way is to reneder each frame manually (that's exactly what I was afraid of), then how would you decode mpeg4 frame? There definitely exists a build-in decoder, but how can I access it?
I haven't managed so far to find either mpeg4 decoding api or a "low-level way" to make own...
I haven't figured out how to do that. Unfortunately the decoders and players don't appear to be in net_rim_api.jar.


Just to be clear. You can integrate a streaming protocol with the mmapi player but it will download the entire stream before playback begins. It sucks that you have to wait for playback to start but it is a good first step.
Offline  
Old 09-17-2007, 03:46 PM   #5 (permalink)
iwr
New Member
 
Join Date: Sep 2007
Model: 8800
PIN: N/A
Carrier: Orange
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Just to be clear. You can integrate a streaming protocol with the mmapi player but it will download the entire stream before playback begins.
Well, in my case it's not an acceptable solution. By the way, how does it know that the stream ended? I play "raw" stream, without any container (the framework can play it, i already tested it by putting raw mpeg4 data into *.m4v file).
Offline  
Old 09-17-2007, 05:00 PM   #6 (permalink)
New Member
 
Join Date: Sep 2007
Model: 8830
PIN: N/A
Carrier: Sprint
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by iwr View Post
Well, in my case it's not an acceptable solution. By the way, how does it know that the stream ended? I play "raw" stream, without any container (the framework can play it, i already tested it by putting raw mpeg4 data into *.m4v file).
I havent come up with a good way with rtsp either. the protocol doesn't appear to send any info about file size or eof/end_of_stream. The best i could come up with is timeout when packets stop being read.
Offline  
Old 09-18-2007, 10:10 AM   #7 (permalink)
iwr
New Member
 
Join Date: Sep 2007
Model: 8800
PIN: N/A
Carrier: Orange
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well... Probably, writing few frames to a new file each time and playing this file would work...
Actually, I don't get the point: playing a live stream seems to be rather basic task, is it possible that noone is doing it on bb8800?
Offline  
Old 09-18-2007, 11:37 AM   #8 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

kreneskyp - i'm pretty sure you're wrong about having to download the entire stream - there's a knowledgebase article on the official bb dev site about how to do just this.

[update - cant find it - i may have been dreaming]
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!

Last edited by jfisher : 09-18-2007 at 11:39 AM.
Offline  
Old 09-18-2007, 04:44 PM   #9 (permalink)
New Member
 
Join Date: Sep 2007
Model: 8830
PIN: N/A
Carrier: Sprint
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by jfisher View Post
kreneskyp - i'm pretty sure you're wrong about having to download the entire stream - there's a knowledgebase article on the official bb dev site about how to do just this.

[update - cant find it - i may have been dreaming]
I know for certain that the player that comes with sun j2me functions that way. I even decompiled one of the players to see if there was a way around it. aside from writing your own implementation, there wasn't. It read the entire stream during player.realize() and stored it as an internal variable before returning.

its entirely possible that RIM's mmapi player implementation for bb is different. 3gp, mp4 and other formats aren't in sun j2me so RIM either wrote it themselves or bought it. either way there is the chance that the player was implemented correctly.

I'm still working on getting my stream to play so hopefully ill have a definitive answer soon. All the data appears to transfer, i just can't seem to get video out of the player (no controls).
Offline  
Old 09-19-2007, 02:58 AM   #10 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

yeah - the kb article i saw was very very low level - sorry i cant remember more or what format they were streaming.
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 09-19-2007, 10:11 AM   #11 (permalink)
New Member
 
Join Date: Sep 2007
Model: 8830
PIN: N/A
Carrier: Sprint
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

it does appear that streaming starts when player.start() is called. this is very exciting, now if only the player would do something with the streams i'm giving it
Offline  
Old 09-20-2007, 07:12 AM   #12 (permalink)
iwr
New Member
 
Join Date: Sep 2007
Model: 8800
PIN: N/A
Carrier: Orange
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by kreneskyp View Post
it does appear that streaming starts when player.start() is called. this is very exciting, now if only the player would do something with the streams i'm giving it
By the way - sometimes I've got strange behavior with BB sockets, I send data successfully, then perform read() on an input stream of the same tpc socket, and it never returns (server send data for sure). Did you encounter something like that?
Offline  
Old 09-20-2007, 11:08 AM   #13 (permalink)
New Member
 
Join Date: Sep 2007
Model: 8830
PIN: N/A
Carrier: Sprint
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by iwr View Post
By the way - sometimes I've got strange behavior with BB sockets, I send data successfully, then perform read() on an input stream of the same tpc socket, and it never returns (server send data for sure). Did you encounter something like that?
yes I started this thread about it ( i see that you already found it): Trouble with socketconnection, Data transmits ok but EOF times out
Offline  
Old 09-23-2007, 05:17 PM   #14 (permalink)
iwr
New Member
 
Join Date: Sep 2007
Model: 8800
PIN: N/A
Carrier: Orange
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

kreneskyp,
by the way, did you see this:
Livelink - Redirection
Offline  
Old 09-24-2007, 03:47 PM   #15 (permalink)
New Member
 
Join Date: Sep 2007
Model: 8830
PIN: N/A
Carrier: Sprint
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by iwr View Post
kreneskyp,
by the way, did you see this:
Livelink - Redirection
i had not seen it, that is a good find. I was implementing DataSource and SourceStream at first but the included mmapi player does not support h263+ (h263-1998).

I found an h263 decoder but not one for AMR so I may be at a total deadend because I dont think i want to get into writing codecs from scratch.
Offline  
Old 09-24-2007, 04:23 PM   #16 (permalink)
iwr
New Member
 
Join Date: Sep 2007
Model: 8800
PIN: N/A
Carrier: Orange
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I'm dealing with mpeg4 profile that 8800 plays well.
But I don't realize why I have to use shared stream/file, if I'm able to read the data online from my remote source and fill the buffer they supply in read() method.
I tried to implement it this way, during debug session it seems to go write way, but for some reason the Midlet is getting stuck (no image, no playback - BB just freezes)...
Offline  
Old 02-04-2008, 04:41 PM   #17 (permalink)
New Member
 
Join Date: Sep 2006
Model: 8800
Carrier: O2
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I wrestled with the same options and did some research: the processor used in the pearl, 8800, etc. *seems* to have a hardware codec for this (h263).
I suspect that is where the decoding is being done. That is totally unconfirmed and unofficial, its just my assuption from the processor specs and the fact that any reference sample Java codecs seem much slower, and so are unlikely to lead to realtime decoding.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.