DivX Calculator: Video Bitrate/Audio Bitrate/Resolution

Sep 27, 2003

/*
* var divx_video = new DivXVideo();
*/
function DivXVideo()
{
/*
* default values
*/
this.VideoLength = 0;
this.AspectRatio = 16 / 9;
this.Width = 720;
this.Height = 480;
this.CroppingTop = 0;
this.CroppingRight = 0;
this.CroppingBottom = 0;
this.CroppingLeft = 0;
this.FramesPerSecond = 23.976;
this.OutputFileSize = 703.125;
this.ResXModulus = 4;
this.ResYModulus = 2;
this.AudioBitrateModulus = 16;

/*
* videoLength();
* videoLength( seconds );
* videoLength( minutes, seconds );
* videoLength( hours, minutes, seconds );
*/
this.videoLength = function()
{
if (arguments.length > 2)
this.VideoLength = arguments[0] * 3600 + arguments[1] * 60 + arguments[2];
else if (arguments.length > 1)
this.VideoLength = arguments[0] * 60 + arguments[1];
else if (arguments.length)
this.VideoLength = arguments[0];
return this.VideoLength;
}

/*
* aspectRatio( [ ratio ] );
*/
this.aspectRatio = function()
{
if (arguments.length)
this.AspectRatio = arguments[0];
return this.AspectRatio;
}

/*
* width( [ n ] );
*/
this.width = function()
{
if (arguments.length)
this.Width = arguments[0];
return this.Width;
}

/*
* height( [ n ] );
*/
this.height = function()
{
if (arguments.length)
this.Height = arguments[0];
return this.Height;
}

/*
* croppingTop( [ n ] );
*/
this.croppingTop = function()
{
if (arguments.length)
this.CroppingTop = arguments[0];
return this.CroppingTop;
}

/*
* croppingRight( [ n ] );
*/
this.croppingRight = function()
{
if (arguments.length)
this.CroppingRight = arguments[0];
return this.CroppingRight;
}

/*
* croppingBottom( [ n ] );
*/
this.croppingBottom = function()
{
if (arguments.length)
this.CroppingBottom = arguments[0];
return this.CroppingBottom;
}

/*
* croppingLeft( [ n ] );
*/
this.croppingLeft = function()
{
if (arguments.length)
this.CroppingLeft = arguments[0];
return this.CroppingLeft;
}

/*
* framesPerSecond( [ fps ] );
*/
this.framesPerSecond = function()
{
if (arguments.length)
this.FramesPerSecond = arguments[0];
return this.FramesPerSecond;
}

/*
* outputFileSize( [ MB ] );
*/
this.outputFileSize = function()
{
if (arguments.length)
this.OutputFileSize = arguments[0];
return this.OutputFileSize;
}

/*
* resXModulus( [ modulus ] );
*/
this.resXModulus = function()
{
if (arguments.length)
this.ResXModulus = arguments[0];
return this.ResXModulus;
}

/*
* resYModulus( [ modulus ] );
*/
this.resYModulus = function()
{
if (arguments.length)
this.ResYModulus = arguments[0];
return this.ResYModulus;
}

/*
* audioBitrateModulus( [ modulus ] );
*/
this.audioBitrateModulus = function()
{
if (arguments.length)
this.AudioBitrateModulus = arguments[0];
return this.AudioBitrateModulus;
}

/*
* audioBitrate();
*
* Assume MP3 compression.
* Variable dependencies:
* - outputFileSize
* - videoLength
* - audioBitrateModulus
*/
this.audioBitrate = function()
{
var kbps = Math.round(this.OutputFileSize * 8192 / (this.VideoLength * 7.09375));
kbps -= kbps % this.AudioBitrateModulus;
return kbps > 128 ? 128 : kbps;
}

/*
* videoBitrate();
*
* Variable dependencies:
* - outputFileSize
* - videoLength
* - audioBitrateModulus
*/
this.videoBitrate = function()
{
return Math.floor((this.OutputFileSize - this.kbps2MB(this.audioBitrate(), this.VideoLength)) * 8192 / this.VideoLength);
}

/*
* resX();
*
* Variable dependencies:
* - width
* - croppingLeft
* - croppingRight
* - height
* - croppingTop
* - croppingBottom
* - aspectRatio
* - outputFileSize
* - videoLength
* - audioBitrateModulus
* - framesPerSecond
* - resXModulus
*/
this.resX = function()
{
var x = this.Width - this.CroppingLeft - this.CroppingRight;
var y = this.Height - this.CroppingTop - this.CroppingBottom;
if (Math.round(this.Width / this.AspectRatio) > this.Height)
x /= this.Width / Math.round(this.Height * this.AspectRatio)
else
y /= this.Height / Math.round(this.Width / this.AspectRatio);
var optimum_res_x = Math.sqrt(1024 * this.videoBitrate() * (x / y) / (.2 * this.FramesPerSecond));
if (optimum_res_x < x)
x = optimum_res_x;
x = Math.round(x);
x -= x % this.ResXModulus;
return x;
}

/*
* resY();
*
* Variable dependencies:
* - width
* - croppingLeft
* - croppingRight
* - height
* - croppingTop
* - croppingBottom
* - aspectRatio
* - outputFileSize
* - videoLength
* - audioBitrateModulus
* - framesPerSecond
* - resXModulus
* - resYModulus
*/
this.resY = function()
{
var x = this.Width - this.CroppingLeft - this.CroppingRight;
var y = this.Height - this.CroppingTop - this.CroppingBottom;
if (Math.round(this.Width / this.AspectRatio) > this.Height)
x /= this.Width / Math.round(this.Height * this.AspectRatio)
else
y /= this.Height / Math.round(this.Width / this.AspectRatio);
y = Math.round(this.resX() / (x / y));
y -= y % this.ResYModulus;
return y
}

/*
* kbps2MB( bitrate, seconds );
*
* Convert kbps for a given number of seconds to file size in MB.
*/
this.kbps2MB = function(bitrate, seconds)
{
return bitrate * seconds / 8192;
}
}

View 3 Replies


ADVERTISEMENT

Creating An Own Audio/video Player?

Jun 2, 2011

I am not sure whether this requires flash or not, therefore I'd like to ask if it is technically possible to create your own audio/video player with JavaScript/jQuery? If not, could I create something similar just not with full functionality? Like stop, next, previous, etc. buttons?

View 3 Replies View Related

Playing Random Video - Not Just Audio

Aug 3, 2011

I managed to construct a script to play random sound files to make listening tests for students. The audio files were actually taken from video files and I would now like students to be able to see the video too. I have the code below which works fine for my (and the students') needs, except that only the audio is played and not the video (and the mov files definitely do contain video). Can anyone suggest how I might change the code so that the video is shown too, either on the same page, or in a pop-up window? I would have thought it would be a matter of changing the window.doSound lines, but if so I can't figure out how.

Code:

View 1 Replies View Related

HTML5 Video & JS - Only Audio Plays?

Nov 23, 2011

I worked on this website :[URL]and cannot find out why it does not work in IE while it works in other browsers. The small video does not play while the sound does. As far as I can see it works fine in FF and Chrome.

View 1 Replies View Related

Opening New Windows From Sites With Audio / Video Files?

Apr 13, 2010

My computer seems to have problems with its javascript when opening new windows from certain sites that are either audio or video files. I simply have not got a clue where to begin.

View 3 Replies View Related

Google Video Embed Continues To Play Audio?

May 3, 2011

I'm using VS2008Pro with Master pages. On a child page, I have a modalPopupExtender that calls a panel with an embedded Google video. Everything works great - the popup appears with the video,background greyed.But, when I close the panel,the audio keeps playing in IE 7 & 8. Netscape is fine.I went and tried what Google recommended, but it still continues.

'//In child page header
<script src="../swfObject/swfobject.js" type="text/javascript"></script>
<script type="text/javascript"> [code].....

View 1 Replies View Related

JQuery :: Load Any Resource (well, Popular Ones: Images, Audio, Video) Given A Url?

Mar 20, 2011

Is there an extension or plugin that could take a url to some media -- video, audio, image -- and just load it / display it on the page? I came across jQuery Media [URL]... and it looks like a good start at what I'd need. Although it just focuses on video and audio, not general images.

View 3 Replies View Related

JQuery :: Load Shoutcast Stream With JMediaelement (jme) Audio Video Plugin?

Jul 19, 2010

im trying to load url for Shoutcast Stream [URL] with jMediaelement plugin[URL],

View 8 Replies View Related

Youtube Video Gallery - Clicking On A Video From The Smaller Div See The Video Being Displayed In The Bigger Div ?

Dec 3, 2011

I have a video gallery with a bigger div with width 500 pixels where the main video is waiting to be played and below is a smaller div with all the others videos from the gallery having width of 80 pixels.The list of video are managed by a content management system in PHP and are the result of youtube "Share Embed action" where the result is an iframe with the link for the video.How can i clicking on a video from the smaller div see the video being displayed in the bigger div ? already playing? or in a new layer above the website ?For now the video plays in the div it is located at.As an example here is the source video format :

<iframe width="420" height="315" src="http://www.youtube.com/embed/somevideourlhere" frameborder="0" allowfullscreen></iframe>

View 3 Replies View Related

Api - Embed A YouTube Video Into A Page And Then Extract Key Information About That Video

Jul 18, 2011

I am currently writing a CMS and I need a few minor variable values from the YouTube Api. I wish to embed a YouTube video into a page and then extract key information about that video such as:

1. The Title
2. The duration
3. The number of hits

View 2 Replies View Related

Create Video Box On Website That Plays YouTube Video

Nov 27, 2011

I'm trying to create a video box on a website that plays a youtube video and then automatically plays random recommended videos with no break in playback. An endless playlist created by youtube based on the initial video. Youtube uses Javascript API. I have never used Javascript before but i'm just trying to get the video to play as above. There are few tutorials online and I couldn't find anyone trying to do a similar thing.

View 5 Replies View Related

Video Player Not Playing Video Fully Only First 15secs?

Sep 21, 2011

We are having an issue with the video playing on our client's site. The video plays fully locally but not fully once set live on the any of the browsers, it plays just the first 15secs, then it stops.

Can anyone share some ideas as to how we can resolve this. The player is in Flash, and uses an eternal XML file for the video. We have checked and all connection are correct.

Header Code:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
Body Code
<script type="text/javascript">
var flashvars = {

[Code]....

View 1 Replies View Related

Showing Count And Video Title On Video Gallery?

May 29, 2011

I'm trying to adapt the following plugin:

youtubeplaylist

so that when you click on the thumbnails it also displays the video description underneath the video, a count, i.e. 1 of 3 etc. and previous and next buttons. Should I be using another plugin or is there a way with this one?

View 1 Replies View Related

Amount Of Video Buffered Already By Client And Whole Duration Of Video

Jun 28, 2011

I am new to javascript (I started learning it today) so please explain it for newbies.I am trying to get the amount of video (in seconds) buffered already by the client and the whole duration of the video.Then, I divide them to get the precentage which was buffered so far.I have no problem storing the durating using:var duration = document.getElementById('vid').duration- returns "12.6" (seconds).I am struggling with getting the buffered time. I tried: var buffered = document.getElementById('vid').buffered.This one returns "[object TimeRanges]".From what I understood this is some kind of an object (Like an array?).I tried returning "buffered.length" and I get "1" back.

View 2 Replies View Related

Hyperlink To Video Player And Start Video?

Apr 30, 2009

On my website I have a video player at the top and below that a list of videos. Users click on one of the videos and that video begins playing in the player at the top of the page. Is there any way that the link the user clicks to play the video can also jump to the video player at the top of the page? I've tried various hyperlinks but I can't get it to work. The videos play fine, but the users don't realize that they need to scroll back up to the top of the page to see the video.

[URL]

#### below is the video player ####
<div id='videoPlayback' style='width: 425px; height:344px;'>
<!-- <div style='width: 425px; margin-left: auto; margin-right: auto; margin-top: 10px;'> -->

[Code]....

View 2 Replies View Related

Flash Video Streaming With "fall Forward" To HTML5 Video For Mobile Only

Jul 19, 2010

I'm looking to duplicate the video-embedding technique shown on revision5.com, whereby they show the flash video to all platforms where flash is available, and only show the HTML5 player on mobile devices. Is there a browser-sniffing framework, or some other method available to accomplish this?

View 3 Replies View Related

Get A Flash Video To Appear On Another Website - Created A Transparent Flash Video - Virtual Spokesperson

Nov 2, 2010

I have created a transparent flash video (virtual spokesperson) for my website. For demoing purposes, I would like to have this appear on any desired website.

This is what I am trying to produce - here a virtual spokesperson appears on the [url]website: [url]

Have a look at other sites which enable one to type in a URL and their demo virtual spokesperson appears on the given site: [url] [url]

I believe they do this within an iframe to display the underlying website.

View 5 Replies View Related

Video Button Rollover - Have The Video (button) Play

Feb 26, 2010

01) I would like to rollover (onmouseover?) a button that is a video and have the video (button) play. (A 5 sec video that stops at end)

02) On rolloff (onmouseoff?) the same button I would like it to rewind to the beginning for next rollover.

03) I would like to add more of these "Video Button Rollovers" to the same website page in the future. I would like to use DreamWeaver CS4, and stay away from flash for more accessibility and less memory intensive overhead. (obviously no control-bar for video)

I have all the parts to this to try a variety of solutions. The video is a box with untied string on a white background. When played a person fades-on and ties the string into a bow. (white background matches website background)

Parts:

01) video from untied box to tied box with person .mov
02) image of first frame of video .jpg
03) video from untied box to tied box with person to person fade-off and untied box .mov
04) video of tied box with person to person fade-off and untied box.mov

View 5 Replies View Related

Determine Resolution

Feb 11, 2006

is there a code for determining the resolution of the computer?

View 3 Replies View Related

IE7 Image Switcher And Audio

Aug 20, 2007

PROBLEM 1:

I spent a lot of time finding code that would play an audio (.wav) file on a
mouseover cue that would work in Internet Explorer 6 and FireFox without any
user prompt to allow active-x scripts to be run etc, but unfortunately the
code does not work in Internet Explorer 7. Can you suggest an alternative?

PROBLEM 2:

When using a image switching code to swap an image to a .gif anim that plays
just once (created using Ulead Gif Animator 5), Internet Explorer 6 and
FireFox begin the animation cycle only when the image has been switched.
Unfortunately, Internet Explorer 7 seems to play the animation as soon as it
has been loaded so when it’s switched you only see the last frame. Can you
suggest an alternative? Code:

View 4 Replies View Related

JQuery :: Animated Gif With Audio?

Oct 25, 2011

I am using the Google audio player on a website and the html is:

[Code]...

and write a click function but it doesn't work. How can I do this?

View 6 Replies View Related

Stop Audio In Flash?

May 12, 2010

I have a webpage with a Flash audio player in it. I then implemented Facebox a JQuery lightbox. To stop the Flash movie showing through the Facebox I have added a show/hide javascript which does the job in Firefox and Safari but in IE the audio still plays when I hide the div. what I could add to my 'hidediv' function that will stop sound of Flash movie once div is hidden when in IE![URL]

View 3 Replies View Related

IE Keeps Playing Audio Of Hidden Div

Feb 24, 2011

I'm trying to stop the audio in a hidden div from playing once a user clicks on the next video clip. i know this is a known bug in IE but i can't figure out how to fix this (as i am a total noob). can someone tell me how i can do this? And yes, my client refuses to use firefox and only IE

Here is my current code.

View 1 Replies View Related

Resolution Css Redirect Script

Aug 2, 2006

The script below works perfectly in Mozilla, but not in IE... any ideas? It specifies a specific style sheet for 3 types of resolutions. Code:

View 2 Replies View Related

Popups Relative To Resolution?

Jul 20, 2005

Does anyone know where I can get a script for a pop-up where I can control fixed positioning of a popup based on browser resolution?

two res's: 800 x 600 and 1024 x 768 ....

View 2 Replies View Related

Works For One Screen Resolution But Not In Another?

Jan 6, 2010

I'm new to javascript and im trying to teach myself how to use it, however, ive come accross a problem. I'm using this code embeded in a HTML page for rollover images:

<script language="JavaScript" type="text/javascript">
<!--
if (document.images) {[code].....

This works completly fine in 1280 x 800 but goes mental when you hover over it in 1024 x 768 screen resolution.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved