[android-developers] Calculate percentage of a video file

2011-11-24 Thread Naveen
Hello Sir,


I am playing a video file , i want to calculate percentage of video
file . using this code

int current=video.getDuration();
int total= video.getCurrentPosition();
int per = (current/total)*100;


This way is wrong behave please confirm me this is right or wrong.


which is easiest way solve my issue.


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Calculate percentage of a video file

2011-11-24 Thread arun kumar
*Manually calculate the bitrate**
*The basic bitrate formula is

(*S*ize - (*A*udio x *L*ength )) / *L*ength = *V*ideo bitrate

L = Lenght of the whole movie in seconds
S = Size you like to use in KB (note 700 MB x 1024*°* = 716 800 KB)
A = Audio bitrate in KB/s (note 224 kbit/s = 224 / 8*°* = 28 KB/s)
V = Video bitrate in KB/s, to get kbit/s multiply with 8*°*.

*°8 bit = 1 byte.*
*°1024 = 1 kilo in the computer world.*

Example
90 minutes video, L = 90 x 60 = 5 400 seconds
700 MB CD but be sure that if fits use a bit lower like 695 MB, S = 695 x
1024 = 711 680 KB
Audio bitrate, A = 224 kbit/s / 8 = 28 KB/s

(711 680 - (5400 x 28) ) / 5400 = 104 KB/s x 8*°* = 830 kbit/s.


WITH REGARDS
ARUN KUMAR P D
+91-9663471079

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Calculate percentage of a video file

2011-11-24 Thread NaveenShrivastva
In android  i have instance of videoview is video, how to handle this for
calculate percentage?

On Thu, Nov 24, 2011 at 3:51 PM, arun kumar hariarun2...@gmail.com wrote:

 *Manually calculate the bitrate**
 *The basic bitrate formula is

 (*S*ize - (*A*udio x *L*ength )) / *L*ength = *V*ideo bitrate

 L = Lenght of the whole movie in seconds
 S = Size you like to use in KB (note 700 MB x 1024*°* = 716 800 KB)
 A = Audio bitrate in KB/s (note 224 kbit/s = 224 / 8*°* = 28 KB/s)
 V = Video bitrate in KB/s, to get kbit/s multiply with 8*°*.

 *°8 bit = 1 byte.*
 *°1024 = 1 kilo in the computer world.*

 Example
 90 minutes video, L = 90 x 60 = 5 400 seconds
 700 MB CD but be sure that if fits use a bit lower like 695 MB, S = 695 x
 1024 = 711 680 KB
 Audio bitrate, A = 224 kbit/s / 8 = 28 KB/s

 (711 680 - (5400 x 28) ) / 5400 = 104 KB/s x 8*°* = 830 kbit/s.


 WITH REGARDS
 ARUN KUMAR P D
 +91-9663471079

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Calculate percentage of a video file

2011-11-24 Thread Jim Graham
On Thu, Nov 24, 2011 at 03:51:50PM +0530, arun kumar wrote:

 *The basic bitrate formula is

First, I don't see where you've included framing and CRC overhead.
You need to include that, unless you're only interested in the HDD-HDD
throughput.

 S = Size you like to use in KB (note 700 MB x 1024*?* = 716 800 KB)

KB is not a valid unit.  I think you meant kB  Uppercase 'K' has
absolutely *NO* meaning in this context.  kilo is a lowercase 'k'.

 A = Audio bitrate in KB/s (note 224 kbit/s = 224 / 8*?* = 28 KB/s)
 V = Video bitrate in KB/s, to get kbit/s multiply with 8*?*.

Same for both of these (but you got it right for kb/s).  As for your
formula, I'm not wasting my time to even review it.  Too much to do
this morning.

 Audio bitrate, A = 224 kbit/s / 8 = 28 KB/s
 (711 680 - (5400 x 28) ) / 5400 = 104 KB/s x 8*?* = 830 kbit/s.

Again, you need to get your units straight

Later,
   --jim

-- 
THE SCORE:  ME:  2  CANCER:  0
73 DE N5IAL (/4)|  There it was, right in the title bar:
spooky1...@gmail.com|   Microsoft Operations POS.
 Running FreeBSD 7.0  | 
ICBM / Hurricane:   | Never before has a TLA been so appropriately
   30.44406N 86.59909W  |  mis-parsed. (alt.sysadmin.recovery)

Android Apps Listing at http://www.jstrack.org/barcodes.html

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Calculate percentage of a video file

2011-11-24 Thread Lew
On Thursday, November 24, 2011 7:50:07 AM UTC-8, Spooky wrote:

 On Thu, Nov 24, 2011 at 03:51:50PM +0530, arun kumar wrote:

  *The basic bitrate formula is

 First, I don't see where you've included framing and CRC overhead.
 You need to include that, unless you're only interested in the HDD-HDD
 throughput.

  S = Size you like to use in KB (note 700 MB x 1024*?* = 716 800 KB)

 KB is not a valid unit.  I think you meant kB  Uppercase 'K' has
 absolutely *NO* meaning in this context.  kilo is a lowercase 'k'.


It is universal in the computer world to use KB to mean kilobytes.  You 
weren't aware of this?  It's been like this for decades.

In non-standard use, K is often used as a symbol prefix to the units bit 
and byte to designate the binary prefix kibi = 210 = 1024.
- 
 
http://en.wikipedia.org/wiki/SI_prefix#Units_used_in_computing_and_telecommunications

 A = Audio bitrate in KB/s (note 224 kbit/s = 224 / 8*?* = 28 KB/s)
  V = Video bitrate in KB/s, to get kbit/s multiply with 8*?*.

 Same for both of these (but you got it right for kb/s).  As for your
 formula, I'm not wasting my time to even review it.  Too much to do
 this morning.


So basically, you chimed in merely to berate the OP for something they 
hadn't even done wrong, but not to answer their question?  You have too 
much to do this morning but still found a few minutes to troll, eh?

Good you have your priorities straight, at least.

 Audio bitrate, A = 224 kbit/s / 8 = 28 KB/s
  (711 680 - (5400 x 28) ) / 5400 = 104 KB/s x 8*?* = 830 kbit/s.

 Again, you need to get your units straight


That chore list isn't getting any shorter!

One knows the length of the video file up front, be it in seconds or KB or 
whatever unit,  The only tricky thing is to determine what fraction of that 
size/length has been consumed at a particular point in playback.

The technique depends in part on how precise you need to be.  If you're 
just showing a progress bar, or calculating to, say, the nearest 5%, you 
can probably get away with ignoring the wobble factors like CRC, perhaps 
with a correction applied every 100 MB or so to reduce cumulative error. 
 If you need ppm resolution your calculations will need to be more precise.

You can measure time or you can measure stream size.  If you know the 
number of seconds of the entire video, and you have the current tickmark 
from the video, then Bob's your uncle.  You can skip all that fooferol of 
bytes/second, yada yada, and just use the timestamp-to-duration ratio.  If 
you cannot get at that data, you can use the system clock to approximate, 
but you'd have to factor out any pauses, fast-forward or whatnot.

I'd venture that dealing with rewind, pause and fast-forward will cause you 
more trouble than the raw calculation of ratio completed.  It all hinges on 
determination of your current position in the video.

-- 
Lew

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Calculate percentage of a video file

2011-11-24 Thread Jim Graham
On Thu, Nov 24, 2011 at 10:14:24AM -0800, Lew wrote:
 On Thursday, November 24, 2011 7:50:07 AM UTC-8, Spooky wrote:

 It is universal in the computer world to use KB to mean kilobytes.
 You weren't aware of this?  It's been like this for decades.

Correction:  that's kB (lowercase 'k'.  And yes, I have known this
for decades.  Uppercase 'K' is a common mis-use, but that doesn't make
it correct any more than mb is correct for MB.

Next time you try to correct someone on units used in telecom,
networking, etc., try not to do so with a senior network engineer.

 In non-standard use, K is often used as a symbol prefix to the units bit 
 and byte to designate the binary prefix kibi = 210 = 1024.
 - 
  
 http://en.wikipedia.org/wiki/SI_prefix#Units_used_in_computing_and_telecommunications

Yep...just looked at that.  Notice that the chart shows a *lowercase*
'k'.

Thanks for proving my point.


 So basically, you chimed in merely to berate the OP for something they 
 hadn't even done wrong, but not to answer their question?  You have too 
 much to do this morning but still found a few minutes to troll, eh?

After seeing someone post about how their app was something like
8 mb  (8 millibits) in size...yeah, I felt like the mis-use of these
prefixes is getting out of hand

 Good you have your priorities straight, at least.

Do you have any idea how many times I've run into cases where throughput
is listed as kb/s in one spot, and kB/s in another, on the same screen,
with the same numbers?  So which fscking value is it?  You tell me.

Later,
   --jim

-- 
THE SCORE:  ME:  2  CANCER:  0
73 DE N5IAL (/4)| Peter da Silva:  No, try rm -rf /
spooky1...@gmail.com| Dave Aronson:As your life flashes before
 Running FreeBSD 7.0  |  your eyes, in the unit of time known as an
ICBM / Hurricane:   |  ohnosecond (alt.sysadmin.recovery)
   30.44406N 86.59909W  |

Android Apps Listing at http://www.jstrack.org/barcodes.html

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Calculate percentage of a video file

2011-11-24 Thread Jim Graham
On Thu, Nov 24, 2011 at 12:51:38PM -0600, Jim Graham wrote:

 Do you have any idea how many times I've run into cases where throughput
 is listed as kb/s in one spot, and kB/s in another, on the same screen,
 with the same numbers?  So which fscking value is it?  You tell me.

Now correcting myself.  :-)  Make that Mb/s and MB/s on the same
screenkB/s went out a long, long time ago.  :-)

Later,
   --jim

-- 
THE SCORE:  ME:  2  CANCER:  0
73 DE N5IAL (/4)MiSTie #49997   Running FreeBSD 7.0 
spooky1...@gmail.com ICBM/Hurricane: 30.44406N 86.59909W

Do not look into waveguide with remaining eye.

Android Apps Listing at http://www.jstrack.org/barcodes.html

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Calculate percentage of a video file

2011-11-24 Thread Raghav Sood
 Now correcting myself.  :-)  Make that Mb/s and MB/s on the same
 screenkB/s went out a long, long time ago.  :-)

Not so. Here in India we still have kB/s connections. MB/s ones have only
recently turned up here.

Thanks

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en