stream buffering customization - Android Apps and Games

i want to customize the stream buffer and need some guidance
specifically, radio streaming apps that i've used seem to not have a very large buffer size, and if the network speed drops (as it usually does while moving in a car) once the buffered data is played through, the sound stops, until enough of a buffer is filled, and the network speed is better again. Then it starts playing again, that is, unless the player background service has been stopped.
i think that this could be greatly minimized if the stream buffer size was ALOT bigger. i'm willing to wait a bit at the beginning of my streaming experience for the sound to start playing. if it means that i wont get any stoppages in play, im willing to wait at least a minute or so if i have to. i dont care.
so, the question is, where is this value of buffer size being set? in the music player? in each individual app? in the kernel? wtf? where is it? libmediaplayerservice.so?
i have searched the forums, and have not found this answer
found these: http://developer.android.com/reference/java/io/BufferedInputStream.html
http://developer.android.com/reference/java/io/InputStream.html
http://d.android.com/reference/java/io/PipedInputStream.html
and cant make heads nor tails out of them.
i'm a "cut and paster" and im not bad at it
but unless i know where to cut and paste, im lost (usually)
hey, an app or setting that allows one to choose the buffer size (if it is a global setting) would be awesome, maybe something for spare parts if thats possible

Related

Is it possible to encode a DVD for the HD2 that doesn’t have “lip sync” issues??

I would be really, really greatfull if anybody could point me in the direction of any video/audio encoder software for a pc that I will convert a DVD to MP4 that will play on the HD2 with out BLOODY LIP SYNC issues??? (I don’t mind paying for it if it works)
I am beginning to wonder if it is possible to play any MP4 material on the HD2 with out the video/audio sync being out.
I used to own a HD1 and used protection’s great free app for this and the results were very good. Video was a little bit jerky but the lip sync was spot on
The audio is about a second behind when I play those files on the HD2???????, (When playing them on a PC sync is also spot on, so the video is not artificially delayed for the purposes of being in sync for the HD1)
I have tried Videora HTC Converter; trial version of DVD Catalyst 3, Handbrake, and Mp4ForHD and no matter how I set them up the lip sync is always out???
The main reason I upgraded to a HD2 was because of the large screen and fast processor for playing back video but it is worse that the HD1 due to lip sync. (also the video is still not any where near as smooth as the iphone and it has a 1GHz processor!!!!)
I am beginning to get very disappointed in the HD2 and any help would be much appreciated.
(P.S, this is using stock rom and various Cooked roms and the results as the same)
Thanks
Jason
Try this. After encoding there is an ability to synchronisize picture and sound. Most time this toll isn´t needed, because the rips are in high quality. Use the archos7 settings for the rip. And set volume to +2, otherwize it´s much to loud. Brightness has the best results with +6, the sound quality at 7% and the picture at 80%, because more quality let the file grow to more than 1 GB. For Playback use the Leo TCPMP, it´s the best player for these rips.
Neo XL said:
Try this. After encoding there is an ability to synchronisize picture and sound. Most time this toll isn´t needed, because the rips are in high quality. Use the archos7 settings for the rip. And set volume to +2, otherwize it´s much to loud. Brightness has the best results with +6, the sound quality at 7% and the picture at 80%, because more quality let the file grow to more than 1 GB. For Playback use the Leo TCPMP, it´s the best player for these rips.
Click to expand...
Click to collapse
Cheers for reply Neo XL, will give it a go
I had the same problem, but got good results from: mp4forHD. There is an update/add-on for the HD2 which gives good picture and sound. Easy to use and all the settings are there for you.
Plays back perfectly in the standard HD2 video player.
Search this forum for the link....
this is the answer to your request
http://forum.xda-developers.com/showthread.php?t=649798
enjoy!
I use Handbrake 0.9.4,
Settings : MP4 , i dont use H.264,
Use FFmpeg, bitrate : 1500Kbps for anime, 2000Kbps for movie/songs.
Plays flawlessly on HD2.
converted 1080p, 720p, DVD, Youtube HD Vids, all to mp4 and plays well on HD2. no problem.
Thanks for all the answers, I have tried them all and I find that the lip sync is still out?
On mp4forHD, I used the HD2 profile and the sync was still way out.
I found that Handbrake 0.9.4, was the best using MP4, instead of H.264 but it is still not perfect.
I am playing the material using both WMP and HTC player. What I am doing wrong?
The HD2 is a bit if a disappointment to me in the video play back department considering its spec it promised so much.
I already used protections Video encoding GUI for my HD1 and don’t recall any lip sync issues on that device.
hi all,
3/4 of synchronization problems come from encoding when it is done with a variable rate codec VBR, for greater compatibility, it is recommended to use a fixed rate compression call CBR when encoding audio
Ok, but what I don’t understand is why files that are perfectly in sync when played on a pc and on the HD1 are out of sync when played on the HD2???
It’s as if the only way to get them in sync is to artificially delay the video when encoding...
I could sort of understand it more if it was the other way round as video generally takes longer to process than audio, but why should the audio be around 0.5 to 1 second delayed??? Don’t make sense to me.
Another thing I have noticed is that videos plays a lot smother when using WMP than using the HTC player, which is a shame as the HTC player is nicer to use in my opinion. The disappointing thing is I really didn’t expect any juddering of video on the HD2 after using the HD1 considering that it has a 1ghz processor which is FOUR times fast than the HD1, and I certainly wasn’t expecting this annoying lip sync issue.
People I know with iphones just laugh when I show them the never 100% smooth and, at best, slightly out of sync video performance on the HD2. The only thing they are jealous of is the bigger screen, which rumours say the next iphone will address.
Oh well, I suppose you have to put it down to the HD2’s main handicap, Windows Mobile. Hope version WM7 is better (if we can even use it on our HD2’s) sorry rambling onto a completely new subject now.
Never really had any massive problems with Handbrake. Ripped Top Gun and it was perfectly in sync for the entire movie.
If anyone here thinks the movies aren't desynced, look again. You might have just missed it the first time because the effect is subtle.
CBR, ABR, VBR, 3 different AAC codecs, 2 different MP3 codecs, even tried encoding the video differently. Every single time the sync was perfect on every device, computer, etc EXCEPT THE HD2.
There MUST be a way to fix this-- what's happening is that the audio is delayed slightly. To account for this, I'm currently purposefully encoding the audio at about 1/5 of a second in so that it accounts for the ~200-250ms desync (which is present in every video...including the stock ROM's Transformers movies!). This works but the file can't be played on any other system or computer of course because the file will be off by that 1/5 or 1/4 second.
Tried stock and 4 other ROMs. All exactly the same. I tried not to keep a single setting in common--fresh hard reset, etc. It's always there, and people have been complaining about it. Some people just don't notice 1/5 or 1/4 second delays. XD Or you think it's normal for the mouths to move a bit before the talking can be heard.
Surely a setting? Maybe it's something BSB tweaks can address? Somebody must know _something_, and the whole community would like to know what it is and how to fix our $450-700 de-synced movie players (HD2).
i use imTOO ultimate video converter. converted Spiderman, great quality and great sound. 10/10. file size was about 1.2gb. around the same size of transformers that it came with. but it looks the same
curiousGeorge said:
If anyone here thinks the movies aren't desynced, look again. You might have just missed it the first time because the effect is subtle.
CBR, ABR, VBR, 3 different AAC codecs, 2 different MP3 codecs, even tried encoding the video differently. Every single time the sync was perfect on every device, computer, etc EXCEPT THE HD2.
There MUST be a way to fix this-- what's happening is that the audio is delayed slightly. To account for this, I'm currently purposefully encoding the audio at about 1/5 of a second in so that it accounts for the ~200-250ms desync (which is present in every video...including the stock ROM's Transformers movies!). This works but the file can't be played on any other system or computer of course because the file will be off by that 1/5 or 1/4 second.
Tried stock and 4 other ROMs. All exactly the same. I tried not to keep a single setting in common--fresh hard reset, etc. It's always there, and people have been complaining about it. Some people just don't notice 1/5 or 1/4 second delays. XD Or you think it's normal for the mouths to move a bit before the talking can be heard.
Surely a setting? Maybe it's something BSB tweaks can address? Somebody must know _something_, and the whole community would like to know what it is and how to fix our $450-700 de-synced movie players (HD2).
Click to expand...
Click to collapse
What programs can you use that will create an audio delay?
Hi,
I have found audio sync (amongst other) issues with all the free products noted on XDA that i've tried. Another issue I also noticed was the complicated configuration recommendations from people. Whilst helpful, it was fruitless as all the output was still desynced (and some products couldn't even output 800x480). I downloaded a demo of SPB Mobile DVD and with a couple of clicks I can convert stored video files and DVD's with perfect sync to quality 800x480 xvid or WMV ro watch on either media player or the HTC player. I also found that the DivX Player provides options for audio sync so if you want to use one of the free products which doesn't sync you can align the audio when you watch it on your HD2.
cMMY69 said:
Hi,
I have found audio sync (amongst other) issues with all the free products noted on XDA that i've tried. Another issue I also noticed was the complicated configuration recommendations from people. Whilst helpful, it was fruitless as all the output was still desynced (and some products couldn't even output 800x480). I downloaded a demo of SPB Mobile DVD and with a couple of clicks I can convert stored video files and DVD's with perfect sync to quality 800x480 xvid or WMV ro watch on either media player or the HTC player. I also found that the DivX Player provides options for audio sync so if you want to use one of the free products which doesn't sync you can align the audio when you watch it on your HD2.
Click to expand...
Click to collapse
Sorry, but it's not a software issue at all. The only way "SPB Mobile DVD" or any other conversion program can produce files which play without the audio delay is if these programs ruin the video by delaying in the opposite direction. Yes, there are programs that you can use to introduce a negative delay--ffdshow will do it if you can get directshow to use it. Avisynth has a delayaudio(float) function which accepts negative values.
But none of these workarounds solves the problem of why all audio is delayed on the HD2. Not just videos--Games, etc all have the problem. Coreplayer is a software decoder you can use to set a manual delay decoder-side... but this means you can't use the powersaving video acceleration of the device, and the files don't play back properly (skipped frames, reduced colors, no HE-AAC support, aliasing).
I have tried just about every bit software and settings on this forum and I am unable to get any decent quality in sync results.
Thought I would try SPB Mobile DVD, don’t what I am doing wrong, but I can’t seem to get it to convert from a DVD. It gets al the way to the last screen then just “freezes” and doesn’t start converting. Have tried with a number of DVD’s.
It starts converting ok when I pick a single file to convert, (it for some reason will only let you select one file and not multiple DVD files from this option??) but I don’t want to do that, I want to convert a DVD.
Any Ideas?????
That confirms it. This is not a software issue. The HD2 has an audio/video bug that HTC needs to fix: a 250ms audio delay.
curiousGeorge said:
That confirms it. This is not a software issue. The HD2 has an audio/video bug that HTC needs to fix: a 250ms audio delay.
Click to expand...
Click to collapse
Sorry curiousGeorge what confirms it?
I too believe that the HD2 is at fault here as everything I encode via about 15 different pieces of software I have tried play back with perfect sync on the PC and out of sync on the HD2
THIS REALLY IS DRIVING ME NUTS!!!!!!
The only saving hope I have of the HD2 video play back capabilities is a clip I downloaded from post 14 of this thread http://forum.xda-developers.com/showthread.php?t=628092&page=2
It plays back perfectly in sync and perfectly smooth and the quality is amazing.
I would just LOVE to know how this was encoded and if it is possible to get anything near this from a DVD.
(I tried the program and settings mentioned on the thread and all I got was a load of MPEG4 files that looked rubbish and were out of sync)
With regard to SPB Mobile DVD, I finally got this to work on my pc but the resulting file does not play back with any sound???!!! So I don’t know if it has sync issues or not. It is also CRAP video quality and juggers all over the place.
I am really getting pi**ed off with this!!!!!!!!!!!!!!!!
DVD Encode
I've found there is no need to encode Dvds specifically for the hd2. I've downloaded films from the net and copied them straight to the sd card. Played them through coreplayer and they play perfectly. Divx play with great quality.
jab1972 said:
Sorry curiousGeorge what confirms it?
I too believe that the HD2 is at fault here as everything I encode via about 15 different pieces of software I have tried play back with perfect sync on the PC and out of sync on the HD2
THIS REALLY IS DRIVING ME NUTS!!!!!!
The only saving hope I have of the HD2 video play back capabilities is a clip I downloaded from post 14 of this thread http://forum.xda-developers.com/showthread.php?t=628092&page=2
It plays back perfectly in sync and perfectly smooth and the quality is amazing.
I would just LOVE to know how this was encoded and if it is possible to get anything near this from a DVD.
(I tried the program and settings mentioned on the thread and all I got was a load of MPEG4 files that looked rubbish and were out of sync)
With regard to SPB Mobile DVD, I finally got this to work on my pc but the resulting file does not play back with any sound???!!! So I don’t know if it has sync issues or not. It is also CRAP video quality and juggers all over the place.
I am really getting pi**ed off with this!!!!!!!!!!!!!!!!
Click to expand...
Click to collapse
Because that video was encoded with a audio delayed added. It's a system flaw of the HD2 to play normal in synced video with a slight audio delay. Not really that audible to those who ain't looking for it, but it's there. And unless HTC does something to solve it, posting it in every thread out there isn't gonna change anything but sound irritating.
Do you know how to use the DVD encoding portion of winmenc? That could account for your wrong outputs. Or are the dvds CSS protected? Only non-protected dvds can be decoded direct. If not, you should use an app like DVDShrink to extract and decode those dvds to your pc, then use those source files in winmenc. Those will encode fine.

[Q] 2.3 changes default buffer amount for streaming audio apps? At my wit's end!

I have a samsung vibrant and use streamfurious to listen to a shoutcast stream*. While on froyo, the 16k stream buffers for about three seconds. When I run CM7 2.3 it buffers for around 90 seconds. Identical stream, identical app.
I tried other apps, like xiialive, including the pro version (even after setting the buffer amount manually) but it still buffers way way more than it did on 2.2. I tested this all on my wifi at home so I know it's not a bandwidth thing.
If I use the official scanner radio app, with the "android player" selected in settings it does the same thing. If I switch it to the 'alternate' player it does not. I don't want to use the scanner radio app though because it does not support the metadata in the stream, which I want to see.
My wife has a G2 running CM7 2.3 and streamfurious does the same thing, buffering for a very long time before it plays.
I've tried a ton of different players on the market, googled around, etc. The most I can figure out is that it seems like something in stagefright was changed that affects how much data is buffered. Despite finding people reporting similar problems on 2.3 (stock or not) for different roms and phones, I can't find any kind of solution.
So I come here. Does anyone, perhaps with knowledge of the stagefright libraries, have at least an answer for me? Is there a setting or hack I can use to stop this behavior?
I'd really appreciate any help, I'm at my wit's end.
*m.radioreference.com has a ton of feeds that all work the same way. I just launch them in the browser and choose the streamfurious player I've installed prior.
going to try bumping this for attention

[Q]Play mp3's without art and view bigger group,song name?

I've been trying to use MX player on my smartphone to play mp3's (offline). There are 2 things I'd like to do if possible:
1. Turn off all artwork. I never want to look at it (too small) especially while driving. Is there a setting to get rid of it?
2. Increase font size for the group name and song? I'd be happy if it took the entire space of the artwork I don't want. Sometimes I wonder what song is playing but can't take my eyes off the road long enough to see it if it's too small or jammed into the top line.
Thanks

How can I get audio mixer output or playing music stream?

Sorry this is not "general" question but I have no enough posts to ask in developers room. I do not want waste a time therefore I ask what I really need. Please answer on topic.
I need get stereo PCM 44/16 audio in buffer but I still cannot find good way to do that. I can get "mic" stream but it is not exactly stereo - buffer has odd samples equal to even. It is 2 channels mono instead. Any solution for native Qt/C++ or Java code is acceptable for me. But it must work in all Android versions starting from 4.0.3. I need "what you hear" signal or at least "now playing music" stream. This must work with any music source. I look at tiny-ALSA but I'm not sure if it will solve my task. Should I distribute tiny-ALSA with my application or it is built in all Android devices? Or may be I can get just a stream like OSS /dev/dsp gives? I tried copy from /dev/snd/pcmC0D0 but without success. Any help appreciated.

How long is the livestream pause buffer? What happens when it’s full?

When playing livestreams over the internet, it’s possible to press PAUSE in MX Player.
The stream will pause and you can later press PLAY to resume from the moment you were paused at!
But this is super mysterious to me?
- WHERE is it buffering? To RAM? To hard disk?
- HOW LONG is the pause buffer? After a while the RAM/HD will become full! But MX Player doesn’t indicate that space is running out! And of course, pausing a HD stream would need a lot more data (per second) than an SD stream. But right now there’s no indicator at all for how full the buffer is. Not even a ”132mb of 400mb used” indicator.
- WHAT happens if the buffer gets 100% full? Does the video auto-begin playing again (slightly before the buffer is completely full) to prevent 100% full RAM/HD? If not then MX really would benefit from code that auto-plays as soon as the buffer is 90% full, to avoid system crashes or data loss from being completely full and not leaving anything left for the rest of the system!
Very curious!
Best Regards
svartchimpans said:
When playing livestreams over the internet, it’s possible to press PAUSE in MX Player.
The stream will pause and you can later press PLAY to resume from the moment you were paused at!
But this is super mysterious to me?
- WHERE is it buffering? To RAM? To hard disk?
- HOW LONG is the pause buffer? After a while the RAM/HD will become full! But MX Player doesn’t indicate that space is running out! And of course, pausing a HD stream would need a lot more data (per second) than an SD stream. But right now there’s no indicator at all for how full the buffer is. Not even a ”132mb of 400mb used” indicator.
- WHAT happens if the buffer gets 100% full? Does the video auto-begin playing again (slightly before the buffer is completely full) to prevent 100% full RAM/HD? If not then MX really would benefit from code that auto-plays as soon as the buffer is 90% full, to avoid system crashes or data loss from being completely full and not leaving anything left for the rest of the system!
Very curious!
Best Regards
Click to expand...
Click to collapse
MX Player never loads the complete file into buffers. The buffer size is dynamically determined based on the available RAM. So, it's less likely to cause such system-level crash or data issues. If you are facing any issues, please provide us with more details so that we can assist you better.
MXPlayer said:
MX Player never loads the complete file into buffers. The buffer size is dynamically determined based on the available RAM. So, it's less likely to cause such system-level crash or data issues. If you are facing any issues, please provide us with more details so that we can assist you better.
Click to expand...
Click to collapse
Thanks for clarifying that it uses RAM and that it limits itself to prevent crashes! Great!
Well I did some testing to see what happens if I leave the player paused for a long time, on live TV streams: When I try to resume it fails to continue pulling data from the stream, and I end up with a black screen.
This makes me worried about pausing and makes it hard to relax. Do you think it would be a good idea to add an optional setting to allow MX to auto-resume when the buffer is full in LIVESTREAM mode (only)? So that the person no longer risks losing their whole playback if they wait too long.
Basically: User pauses live TV for a few minutes, and the buffer becomes full so it auto-plays and continues from the buffer, while continuing to buffer new livestream data, to ensure that the user never gets a black screen/data loss gap.
I would also think a pause buffer % display would be useful when pausing livestreams. So the user can see it fill up and estimate how much time they have left to pause.
Lastly, the ability to fast forward in the livestream pause buffer would help too.
Well this is sounding like a list of feature requests. Hehe...
Anyway, try playing live TV streams and pausing in MX. You’ll see that the experience is pretty unreliable. Oh well it’s not a huge problem.

Categories

Resources