video encoding for Firefox

Use Firefogg on your site

To use Firefogg on your site, you have to use the Firefogg Javascript api.
After encoding you get a file object you can ues to upload with a regular multipart HTTP POST or more advanced chunk uploading.

Debug Firefogg on your site

to get more debug information from Firefogg go to about:config and set extensions.firefogg.debug to true

Firefogg API

the Firefogg object has these functions and properties:

cancel()abort encoding
deleteVideo()delete encoded video, use this to delete video after upload is done.
encode(options, callback, progress) options is a json string(see encoding options below)
callback is a function that gets called once encoding is done, the encoded file is passed as a File object as second parameter
progress is a function that gets called to update progress, the unfinished file is passed as a second parameter.
selectVideo()select video to encode, returns true if video was selected
setInput(file)set input to file object, i.e. from <input type=file>
bool setFormat(format)set default format used only for saveVideoAs dialog, options: ogg, webm; actuall format depends on video codec used: theora results in ogg, vp8,vp9 will be webm
bool saveVideoAs()opens a "save as..." dialog and sets output to selected target. has to be alled before encode/upload/render
sourceFilenamefilename of the selected source, availabe only after calling selectVideo()
sourceInfojson info about selected source video (example), availabe only after calling selectVideo()
versionreturns Firefogg version

Encoding Options


var options = JSON.stringify({'maxSize': 320, 'videoQuality': 6, 'noaudio': true}); 
videoCodecstringvideo codec, default: vp8, options: theora, vp8, vp9
widthintresize to given width, if only width is given, height is calculated
heightintresize to given height, if only height is given, widht is calculated
maxSizeintlimits the bigger widht/height to this, keeping aspect ratio
videoQualityfloat[0 to 10]
encoding quality for video, use higher values for better quality (default: 5)
videoBitrateint[1 to 16778] encoding bitrate for video (kb/s)
twopassbooleanTogether with videoBitrate this option can be used to do two-pass encoding.
frameratestringframerate can be fraction 25:2 or int 16
aspectstringaspect ratio can be fraction 4:3 or 16:9
keyframeIntervalint[1 to 65536]
keyframe interval (default: 64)
bufferDelayintBuffer delay (in frames). Longer delays allow smoother rate adaptation and provide better overall quality, but require more client side buffering and add latency. The default value is the keyframe interval for one-pass encoding (or somewhat larger if --soft-target is used) and infinite for two-pass encoding. (only works in bitrate mode)
softTargetbooleanUse a large reservoir and treat the rate as a soft target; rate control is less strict but resulting quality is usually higher/smoother overall. Soft target also allows an optional videoQuality setting to specify a minimum allowed quality.
denoisebooleandenoise input video
deinterlacebooleanmanually enable deinterlacing if video
brightnessfloat[-1.0 to 1.0] brightness correction (default: 0.0)
Note: lower values make the video darker.
contrastfloat[0.1 to 10.0] contrast correction (default: 1.0)
Note: lower values make the video darker.
gammafloat[0.1 to 10.0] gamma correction (default: 1.0)
Note: lower values make the video darker.
saturationfloat[0.1 to 10.0] saturation correction (default: 1.0)
Note: lower values make the video grey.
cropTopintcrop input at top
cropBottomintcrop input at bottom
cropLeftintcrop input at left
cropRightintcrop input at right
starttimefloatonly encode from time in seconds
endtimefloatonly encode to time in seconds
noUpscalingbooleando not make video bigger, use higher framerate or more audio channels than input, default false
audioCodecstringaudio codec, default: vorbis, options: vorbis, opus
audioQualityfloat[-1 to 10]
encoding quality for audio use higher values for better quality (default: 1)
audioBitrateint[32 to 500] encoding bitrate for audio (kb/s)
samplerateintset output samplerate (in Hz)
channelsintset number of channels, 1 for mono, 2 for stereo
noaudiobooleandisable possible audio input
novideobooleandisable possible video input
titlestringName of artist (director)
organizationstringName of organization (studio)
contactstringContact link
passthroughbooleanif passthrough is true, selected file will not be encoded but uploaded directly, can be used to upload other large files or vidoes that are already ogg theora. it is recommended to use ogg.sourceFilename and ogg.sourceInfo to make a descission is that is wanted.

Example Projects

Example Django Project using Firefogg to allow video uploads
  git clone git://
Example PHP Site using Firefogg to allow video uploads
  git clone git://

Firefogg development

to get the latest source checkout our git branch and read the instructions in the README.

  git clone git://