[longomatch] Use qualities instead of bitrates



commit 46c41fc5ccfe8dd861addea98280c9610b2df7a7
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Jun 17 17:48:41 2013 +0200

    Use qualities instead of bitrates

 LongoMatch.Core/Common/CaptureSettings.cs          |    3 +-
 LongoMatch.Core/Common/EncodingProfiles.cs         |   57 +++++-
 LongoMatch.Core/Common/EncodingQuality.cs          |   80 ++++++++
 LongoMatch.Core/Common/EncodingSettings.cs         |    8 +-
 LongoMatch.Core/Common/VideoStandards.cs           |   56 ++++++-
 LongoMatch.Core/LongoMatch.Core.mdp                |    1 +
 LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs       |    4 +-
 .../Gui/Component/ProjectDetailsWidget.cs          |   55 ++++--
 LongoMatch.GUI/Gui/Dialog/VideoConversionTool.cs   |    5 +-
 .../Gui/Dialog/VideoEditionProperties.cs           |   67 ++++----
 ...ongoMatch.Gui.Component.ProjectDetailsWidget.cs |  135 +++++---------
 ...LongoMatch.Gui.Dialog.VideoEditionProperties.cs |    5 -
 LongoMatch.GUI/gtk-gui/gui.stetic                  |  118 +++---------
 LongoMatch.Multimedia/Capturer/FakeCapturer.cs     |    4 +-
 .../Capturer/GstCameraCapturer.cs                  |   16 +-
 .../Converter/GstVideoConverter.cs                 |    8 +-
 LongoMatch.Multimedia/Editor/GstVideoSplitter.cs   |   18 +-
 LongoMatch.Multimedia/Interfaces/ICapturer.cs      |    4 +-
 libcesarplayer/gst-camera-capturer.c               |  194 ++++---------------
 libcesarplayer/gst-video-encoder.c                 |  156 +++--------------
 libcesarplayer/gst-video-encoder.h                 |    4 +-
 libcesarplayer/video-utils.c                       |  142 ++++++++++++++
 libcesarplayer/video-utils.h                       |    7 +
 23 files changed, 580 insertions(+), 567 deletions(-)
---
diff --git a/LongoMatch.Core/Common/CaptureSettings.cs b/LongoMatch.Core/Common/CaptureSettings.cs
index 4f5a7fd..d3e0c4e 100644
--- a/LongoMatch.Core/Common/CaptureSettings.cs
+++ b/LongoMatch.Core/Common/CaptureSettings.cs
@@ -32,7 +32,8 @@ namespace LongoMatch.Common
                        settings.CaptureSourceType = CaptureSourceType.System;
                        settings.EncodingSettings = new EncodingSettings(VideoStandards.P480_4_3,
                                                                         EncodingProfiles.MP4,
-                                                                        25, 1, 1000, 128, "", 20);
+                                                                        EncodingQualities.Medium,
+                                                                        25, 1, "", 20);
                        return settings;
                }
        }
diff --git a/LongoMatch.Core/Common/EncodingProfiles.cs b/LongoMatch.Core/Common/EncodingProfiles.cs
index c0344a5..9365159 100644
--- a/LongoMatch.Core/Common/EncodingProfiles.cs
+++ b/LongoMatch.Core/Common/EncodingProfiles.cs
@@ -16,11 +16,22 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 // 
 using System;
+using System.Collections.Generic;
+
+
 namespace LongoMatch.Common
 {
        [Serializable]
-       public struct EncodingProfile
+       public class EncodingProfile
        {
+               public string Name;
+               public string Extension;
+               public VideoEncoderType VideoEncoder;
+               public AudioEncoderType AudioEncoder;
+               public VideoMuxerType Muxer;
+
+               public EncodingProfile () {}
+
                public EncodingProfile(string name, string extension,
                                       VideoEncoderType videoEncoder,
                                       AudioEncoderType audioEncoder,
@@ -32,11 +43,24 @@ namespace LongoMatch.Common
                        Muxer = muxer;
                }
                
-               public string Name;
-               public string Extension;
-               public VideoEncoderType VideoEncoder;
-               public AudioEncoderType AudioEncoder;
-               public VideoMuxerType Muxer;
+               public override bool Equals (object obj)
+               {
+                       EncodingProfile prof;
+                       if (!(obj is EncodingProfile))
+                               return false;
+                       prof = (EncodingProfile)obj;
+                       return prof.Name == Name &&
+                               prof.Extension == Extension &&
+                               prof.VideoEncoder == VideoEncoder &&
+                               prof.AudioEncoder == AudioEncoder &&
+                               prof.Muxer == Muxer;
+               }
+
+               public override int GetHashCode ()
+               {
+                       return String.Format ("{0}-{1}-{2}-{3}-{4}", Name, Extension,
+                                             VideoEncoder, AudioEncoder, Muxer).GetHashCode();
+               }
        }
        
        public class EncodingProfiles {
@@ -64,6 +88,25 @@ namespace LongoMatch.Common
                                                                        VideoEncoderType.H264,
                                                                        AudioEncoderType.Aac,
                                                                        VideoMuxerType.Matroska);
+               
+               public static List<EncodingProfile> Capture {
+                       get {
+                               List<EncodingProfile> list = new List<EncodingProfile> ();
+                               list.Add (MP4);
+                               list.Add (Avi);
+                               list.Add (WebM);
+                               return list;
+                       }
+               }
+               
+               public static List<EncodingProfile> Render {
+                       get {
+                               List<EncodingProfile> list = new List<EncodingProfile> ();
+                               list.Add (MP4);
+                               list.Add (Avi);
+                               list.Add (WebM);
+                               return list;
+                       }
+               }
        }
-       
 }
diff --git a/LongoMatch.Core/Common/EncodingQuality.cs b/LongoMatch.Core/Common/EncodingQuality.cs
new file mode 100644
index 0000000..8e990ff
--- /dev/null
+++ b/LongoMatch.Core/Common/EncodingQuality.cs
@@ -0,0 +1,80 @@
+//
+//  Copyright (C) 2013 Andoni Morales Alastruey
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+using Mono.Unix;
+using System.Collections.Generic;
+
+namespace LongoMatch.Common
+{
+       
+       [Serializable]
+       public class EncodingQuality
+       {
+               public string Name;
+               public uint AudioQuality;
+               public uint VideoQuality;
+               
+               public EncodingQuality ()
+               {
+               }
+               
+               public EncodingQuality (string name, uint videoQuality, uint audioQuality)
+               {
+                       Name = name;
+                       VideoQuality = videoQuality;
+                       AudioQuality = audioQuality;
+               }
+               
+               public override bool Equals (object obj)
+               {
+                       EncodingQuality q;
+                       if (!(obj is EncodingQuality))
+                               return false;
+                       q = (EncodingQuality) obj;      
+                       return q.Name == Name &&
+                               q.AudioQuality == AudioQuality &&
+                               q.VideoQuality == VideoQuality;
+               }
+               
+               public override int GetHashCode ()
+               {
+                       return String.Format ("{0}-{1}-{2}", Name, AudioQuality, VideoQuality).GetHashCode();
+               }
+
+       }
+       
+       public class EncodingQualities
+       {
+               public static EncodingQuality Low = new EncodingQuality ("Low", 25, 50); 
+               public static EncodingQuality Medium = new EncodingQuality ("Medium", 50, 50); 
+               public static EncodingQuality High = new EncodingQuality ("High", 75, 75); 
+               public static EncodingQuality Highest = new EncodingQuality ("Highest", 100, 75); 
+               
+               public static List<EncodingQuality> All {
+                       get {
+                               List<EncodingQuality> list = new List<EncodingQuality>();
+                               list.Add (Low);
+                               list.Add (Medium);
+                               list.Add (High);
+                               list.Add (Highest);
+                               return list;
+                       }
+               }
+       }
+}
+
diff --git a/LongoMatch.Core/Common/EncodingSettings.cs b/LongoMatch.Core/Common/EncodingSettings.cs
index 7e37aeb..ec151e3 100644
--- a/LongoMatch.Core/Common/EncodingSettings.cs
+++ b/LongoMatch.Core/Common/EncodingSettings.cs
@@ -22,24 +22,22 @@ namespace LongoMatch.Common
        public struct EncodingSettings
        {
                public EncodingSettings(VideoStandard videoStandard, EncodingProfile encodingProfile,
-                                       uint fr_n, uint fr_d, uint videoBitrate, uint audioBitrate, 
+                                       EncodingQuality encodingQuality, uint fr_n, uint fr_d,
                                        string outputFile, uint titleSize) {
                        VideoStandard = videoStandard;
                        EncodingProfile = encodingProfile;
+                       EncodingQuality = encodingQuality;
                        Framerate_n = fr_n;
                        Framerate_d = fr_d;
-                       AudioBitrate = audioBitrate;
-                       VideoBitrate = videoBitrate;
                        OutputFile = outputFile;
                        TitleSize = titleSize;
                }
                
                public VideoStandard VideoStandard;
                public EncodingProfile EncodingProfile;
+               public EncodingQuality EncodingQuality;
                public uint Framerate_n;
                public uint Framerate_d;
-               public uint VideoBitrate;
-               public uint AudioBitrate;
                public string OutputFile;
                public uint TitleSize;
        }
diff --git a/LongoMatch.Core/Common/VideoStandards.cs b/LongoMatch.Core/Common/VideoStandards.cs
index 415fd12..35c1b83 100644
--- a/LongoMatch.Core/Common/VideoStandards.cs
+++ b/LongoMatch.Core/Common/VideoStandards.cs
@@ -17,21 +17,38 @@
 // 
 using System;
 using Mono.Unix;
+using System.Collections.Generic;
 
 namespace LongoMatch.Common
 {
        [Serializable]
-       public struct VideoStandard
+       public class VideoStandard
        {
+               public string Name;
+               public uint Height;
+               public uint Width;
+               
+               public VideoStandard() {}
+               
                public VideoStandard(string name, uint height, uint width) {
                        Name = name;
                        Height = height;
                        Width = width;
                }
                
-               public string Name;
-               public uint Height;
-               public uint Width;
+               public override bool Equals (object obj)
+               {
+                       VideoStandard vstd;
+                       if (!(obj is VideoStandard))
+                               return false;
+                       vstd = (VideoStandard)obj;
+                       return vstd.Name == Name && vstd.Height == Height && vstd.Width == Width;
+               }
+               
+               public override int GetHashCode ()
+               {
+                       return String.Format ("{0}-{1}-{2}", Name, Width, Height).GetHashCode();
+               }
        }
        
        public class VideoStandards {
@@ -48,6 +65,37 @@ namespace LongoMatch.Common
                public static VideoStandard P720_16_9 = new VideoStandard("720p (16:9)", 720, 1280);
                public static VideoStandard P1080_4_3 = new VideoStandard("1080p (4:3)", 1080, 1440);
                public static VideoStandard P1080_16_9 = new VideoStandard("1080p (16:9)", 1080, 1920);
+               
+               public static List<VideoStandard> Rendering {
+                       get {
+                               List<VideoStandard> list = new List<VideoStandard>();
+                               list.Add (P240_4_3);
+                               list.Add (P240_16_9);
+                               list.Add (P480_4_3);
+                               list.Add (P480_16_9);
+                               list.Add (P720_4_3);
+                               list.Add (P720_16_9);
+                               list.Add (P1080_4_3);
+                               list.Add (P1080_16_9);
+                               return list;
+                       }
+               }
+               
+               public static List<VideoStandard> Capture {
+                       get {
+                               List<VideoStandard> list = new List<VideoStandard>();
+                               list.Add (Original);
+                               list.Add (P240_4_3);
+                               list.Add (P240_16_9);
+                               list.Add (P480_4_3);
+                               list.Add (P480_16_9);
+                               list.Add (P720_4_3);
+                               list.Add (P720_16_9);
+                               list.Add (P1080_4_3);
+                               list.Add (P1080_16_9);
+                               return list;
+                       }
+               }
        }
        
 }
diff --git a/LongoMatch.Core/LongoMatch.Core.mdp b/LongoMatch.Core/LongoMatch.Core.mdp
index eb4226e..e0a28c0 100644
--- a/LongoMatch.Core/LongoMatch.Core.mdp
+++ b/LongoMatch.Core/LongoMatch.Core.mdp
@@ -104,6 +104,7 @@
     <File subtype="Code" buildaction="Compile" name="Interfaces/Multimedia/IVideoConverter.cs" />
     <File subtype="Code" buildaction="Compile" name="Common/SysInfo.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/IDataBaseManager.cs" />
+    <File subtype="Code" buildaction="Compile" name="Common/EncodingQuality.cs" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
diff --git a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
index 52c2003..3688e4c 100644
--- a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
@@ -219,8 +219,8 @@ namespace LongoMatch.Gui
                        capturer.SetAudioEncoder(captureProps.EncodingSettings.EncodingProfile.AudioEncoder);
                        capturer.SetVideoMuxer(muxer);
                        capturer.SetSource(captureProps.CaptureSourceType);
-                       capturer.VideoBitrate = captureProps.EncodingSettings.VideoBitrate;
-                       capturer.AudioBitrate = captureProps.EncodingSettings.AudioBitrate;
+                       capturer.VideoQuality = captureProps.EncodingSettings.EncodingQuality.VideoQuality;
+                       capturer.AudioQuality = captureProps.EncodingSettings.EncodingQuality.AudioQuality;
                }
 
                protected virtual void OnRecbuttonClicked(object sender, System.EventArgs e)
diff --git a/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs 
b/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
index d88c7e5..a3201a2 100644
--- a/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
@@ -56,8 +56,7 @@ namespace LongoMatch.Gui.Component
                ITemplatesService service;
                ProjectType useType;
                List<Device> videoDevices;
-               ListStore videoStandardList;
-               ListStore encProfileList;
+               ListStore videoStandardList, encProfileList, qualList;
                private const string DV_SOURCE = "DV Source";
                private const string GCONF_SOURCE = "GConf Source";
 
@@ -241,8 +240,6 @@ namespace LongoMatch.Gui.Component
                                CaptureSettings s = new CaptureSettings();
                                
                                encSettings.OutputFile = fileEntry.Text;
-                               encSettings.AudioBitrate = (uint)audiobitratespinbutton.Value;
-                               encSettings.VideoBitrate = (uint)videobitratespinbutton.Value;
                                if (useType == ProjectType.CaptureProject) {
                                        s.CaptureSourceType = videoDevices[devicecombobox.Active].DeviceType;
                                        s.DeviceID = videoDevices[devicecombobox.Active].ID;
@@ -251,8 +248,12 @@ namespace LongoMatch.Gui.Component
                                        s.DeviceID = urientry.Text;
                                }
                                
+                               /* Get quality info */
+                               qualitycombobox.GetActiveIter(out iter);
+                               encSettings.EncodingQuality = (EncodingQuality) qualList.GetValue(iter, 1);
+                               
                                /* Get size info */
-                               sizecombobox.GetActiveIter(out iter);
+                               qualitycombobox.GetActiveIter(out iter);
                                encSettings.VideoStandard = (VideoStandard) videoStandardList.GetValue(iter, 
1);
                        
                                /* Get encoding profile info */
@@ -422,25 +423,39 @@ namespace LongoMatch.Gui.Component
                }
 
                private void FillFormats() {
+                       int index = 0, active = 0;
                        videoStandardList = new ListStore(typeof(string), typeof (VideoStandard));
-                       videoStandardList.AppendValues(VideoStandards.Original.Name, VideoStandards.Original);
-                       videoStandardList.AppendValues(VideoStandards.P240_4_3.Name, VideoStandards.P240_4_3);
-                       videoStandardList.AppendValues(VideoStandards.P240_16_9.Name, 
VideoStandards.P240_16_9);
-                       videoStandardList.AppendValues(VideoStandards.P480_4_3.Name, VideoStandards.P480_4_3);
-                       videoStandardList.AppendValues(VideoStandards.P480_16_9.Name, 
VideoStandards.P480_16_9);
-                       videoStandardList.AppendValues(VideoStandards.P720_4_3.Name, VideoStandards.P720_4_3);
-                       videoStandardList.AppendValues(VideoStandards.P720_16_9.Name, 
VideoStandards.P720_16_9);
-                       videoStandardList.AppendValues(VideoStandards.P1080_4_3.Name, 
VideoStandards.P1080_4_3);
-                       videoStandardList.AppendValues(VideoStandards.P1080_16_9.Name, 
VideoStandards.P1080_16_9);
-                       sizecombobox.Model = videoStandardList;
-                       sizecombobox.Active = 0;
+                       foreach (VideoStandard std in VideoStandards.Capture) {
+                               videoStandardList.AppendValues (std.Name, std);
+                               if (Config.CaptureVideoStandard == std)
+                                       active = index;
+                               index ++;
+                       }
+                       qualitycombobox.Model = videoStandardList;
+                       qualitycombobox.Active = active;
 
+                       index = active = 0;
                        encProfileList = new ListStore(typeof(string), typeof (EncodingProfile));
-                       encProfileList.AppendValues(EncodingProfiles.MP4.Name, EncodingProfiles.MP4);
-                       encProfileList.AppendValues(EncodingProfiles.Avi.Name, EncodingProfiles.Avi);
-                       encProfileList.AppendValues(EncodingProfiles.WebM.Name, EncodingProfiles.WebM);
+                       foreach (EncodingProfile prof in EncodingProfiles.Capture) {
+                               encProfileList.AppendValues(prof.Name, prof);
+                               if (Config.CaptureEncodingProfile == prof)
+                                       active = index;
+                               index ++;
+                               
+                       }
                        videoformatcombobox.Model = encProfileList;
-                       videoformatcombobox.Active = 0;
+                       videoformatcombobox.Active = active;
+                       
+                       index = active = 0;
+                       qualList = new ListStore(typeof(string), typeof (EncodingQuality));
+                       foreach (EncodingQuality qual in EncodingQualities.All) {
+                               qualList.AppendValues(qual.Name, qual);
+                               if (Config.CaptureEncodingQuality == qual)
+                                       active = index;
+                               index ++;
+                       }
+                       qualitycombobox.Model = qualList;
+                       qualitycombobox.Active = active;
                }
                
                private void StartEditor(TemplateEditorDialog editor) {
diff --git a/LongoMatch.GUI/Gui/Dialog/VideoConversionTool.cs 
b/LongoMatch.GUI/Gui/Dialog/VideoConversionTool.cs
index 707c471..961a1b8 100644
--- a/LongoMatch.GUI/Gui/Dialog/VideoConversionTool.cs
+++ b/LongoMatch.GUI/Gui/Dialog/VideoConversionTool.cs
@@ -144,8 +144,9 @@ namespace LongoMatch.Gui.Dialog
                        sizecombobox.GetActiveIter(out iter);
                        std = (VideoStandard) stdStore.GetValue(iter, 1);
                        
-                       encSettings = new EncodingSettings(std, EncodingProfiles.MP4, 25, 1, 4000,
-                                                          128, outputFile, 0);
+                       encSettings = new EncodingSettings(std, EncodingProfiles.MP4,
+                                                          EncodingQualities.High,
+                                                          25, 1, outputFile, 0);
                        EncodingSettings = encSettings;
                        Respond (ResponseType.Ok);
                }
diff --git a/LongoMatch.GUI/Gui/Dialog/VideoEditionProperties.cs 
b/LongoMatch.GUI/Gui/Dialog/VideoEditionProperties.cs
index 6da8d31..5fe090b 100644
--- a/LongoMatch.GUI/Gui/Dialog/VideoEditionProperties.cs
+++ b/LongoMatch.GUI/Gui/Dialog/VideoEditionProperties.cs
@@ -33,8 +33,7 @@ namespace LongoMatch.Gui.Dialog
        public partial class VideoEditionProperties : Gtk.Dialog
        {
                EncodingSettings encSettings;
-               ListStore stdStore;
-               ListStore encStore;
+               ListStore stdStore, encStore, qualStore;
 
                #region Constructors
                public VideoEditionProperties()
@@ -43,6 +42,7 @@ namespace LongoMatch.Gui.Dialog
                        encSettings = new EncodingSettings();
                        FillVideoStandards();
                        FillEncodingProfiles();
+                       FillQualities();
                }
                #endregion
 
@@ -89,49 +89,48 @@ namespace LongoMatch.Gui.Dialog
                #endregion
 
                private void FillVideoStandards() {
+                       int index = 0, active = 0;
                        stdStore = new ListStore(typeof(string), typeof (VideoStandard));
-                       stdStore.AppendValues(VideoStandards.P240_4_3.Name, VideoStandards.P240_4_3);
-                       stdStore.AppendValues(VideoStandards.P240_16_9.Name, VideoStandards.P240_16_9);
-                       stdStore.AppendValues(VideoStandards.P480_4_3.Name, VideoStandards.P480_4_3);
-                       stdStore.AppendValues(VideoStandards.P480_16_9.Name, VideoStandards.P480_16_9);
-                       stdStore.AppendValues(VideoStandards.P720_4_3.Name, VideoStandards.P720_4_3);
-                       stdStore.AppendValues(VideoStandards.P720_16_9.Name, VideoStandards.P720_16_9);
-                       stdStore.AppendValues(VideoStandards.P1080_4_3.Name, VideoStandards.P1080_4_3);
-                       stdStore.AppendValues(VideoStandards.P1080_16_9.Name, VideoStandards.P1080_16_9);
+                       foreach (VideoStandard std in VideoStandards.Rendering) {
+                               stdStore.AppendValues (std.Name, std);
+                               if (std == Config.RenderVideoStandard)
+                                       active = index;
+                               index ++;
+                       } 
                        sizecombobox.Model = stdStore;
-                       sizecombobox.Active = 2;
+                       sizecombobox.Active = active;
                }
 
                private void FillEncodingProfiles() {
+                       int index = 0, active = 0;
                        encStore = new ListStore(typeof(string), typeof (EncodingProfile));
-                       encStore.AppendValues(EncodingProfiles.MP4.Name, EncodingProfiles.MP4);
-                       encStore.AppendValues(EncodingProfiles.Avi.Name, EncodingProfiles.Avi);
-                       encStore.AppendValues(EncodingProfiles.WebM.Name, EncodingProfiles.WebM);
+                       foreach (EncodingProfile prof in EncodingProfiles.Render) {
+                               encStore.AppendValues(prof.Name, prof);
+                               if (prof == Config.RenderEncodingProfile)
+                                       active = index;
+                               index++;
+                       }
                        formatcombobox.Model = encStore;
-                       formatcombobox.Active = 0;
+                       formatcombobox.Active = active;
+               }
+               
+               private void FillQualities() {
+                       int index = 0, active = 0;
+                       qualStore = new ListStore(typeof(string), typeof (EncodingQuality));
+                       foreach (EncodingQuality qual in EncodingQualities.All) {
+                               qualStore.AppendValues(qual.Name, qual);
+                               if (qual == Config.RenderEncodingQuality)
+                                       active = index;
+                               index++;
+                       }
+                       qualitycombobox.Model = qualStore;
+                       qualitycombobox.Active = active;
                }
                
                protected virtual void OnButtonOkClicked(object sender, System.EventArgs e)
                {
                        TreeIter iter;
                        
-                       if(qualitycombobox.ActiveText == Catalog.GetString("Low")) {
-                               encSettings.VideoBitrate = (uint) VideoQuality.Low;
-                               encSettings.AudioBitrate = (uint) AudioQuality.Low;
-                       }
-                       else if(qualitycombobox.ActiveText == Catalog.GetString("Normal")) {
-                               encSettings.VideoBitrate = (uint) VideoQuality.Normal;
-                               encSettings.AudioBitrate =(uint)  AudioQuality.Normal;
-                       }
-                       else if(qualitycombobox.ActiveText == Catalog.GetString("Good")) {
-                               encSettings.VideoBitrate =(uint)  VideoQuality.Good;
-                               encSettings.AudioBitrate =(uint)  AudioQuality.Good;
-                       }
-                       else if(qualitycombobox.ActiveText == Catalog.GetString("Extra")) {
-                               encSettings.VideoBitrate =(uint)  VideoQuality.Extra;
-                               encSettings.AudioBitrate =(uint)  AudioQuality.Extra;
-                       }
-
                        /* Get size info */
                        sizecombobox.GetActiveIter(out iter);
                        encSettings.VideoStandard = (VideoStandard) stdStore.GetValue(iter, 1);
@@ -140,6 +139,10 @@ namespace LongoMatch.Gui.Dialog
                        formatcombobox.GetActiveIter(out iter);
                        encSettings.EncodingProfile = (EncodingProfile) encStore.GetValue(iter, 1);
                        
+                       /* Get quality info */
+                       qualitycombobox.GetActiveIter(out iter);
+                       encSettings.EncodingQuality = (EncodingQuality) qualStore.GetValue(iter, 1);
+                       
                        encSettings.OutputFile = filelabel.Text;
                        
                        /* FIXME: Configure with the UI */
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.ProjectDetailsWidget.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.ProjectDetailsWidget.cs
index a6b43af..6fd0cf1 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.ProjectDetailsWidget.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.ProjectDetailsWidget.cs
@@ -41,14 +41,12 @@ namespace LongoMatch.Gui.Component
                private global::Gtk.Label urilabel;
                private global::Gtk.Expander expander1;
                private global::Gtk.Table table2;
-               private global::Gtk.Label audiobitratelabel;
-               private global::Gtk.SpinButton audiobitratespinbutton;
                private global::Gtk.Label device;
                private global::Gtk.ComboBox devicecombobox;
-               private global::Gtk.ComboBox sizecombobox;
+               private global::Gtk.Label label2;
+               private global::Gtk.ComboBox qualitycombobox;
+               private global::Gtk.ComboBox sizecombobox1;
                private global::Gtk.Label sizelabel;
-               private global::Gtk.Label videobitratelabel1;
-               private global::Gtk.SpinButton videobitratespinbutton;
                private global::Gtk.ComboBox videoformatcombobox;
                private global::Gtk.Label videoformatlabel;
                private global::Gtk.Label GtkLabel5;
@@ -432,64 +430,57 @@ namespace LongoMatch.Gui.Component
                        this.expander1 = new global::Gtk.Expander (null);
                        this.expander1.CanFocus = true;
                        this.expander1.Name = "expander1";
+                       this.expander1.Expanded = true;
                        // Container child expander1.Gtk.Container+ContainerChild
-                       this.table2 = new global::Gtk.Table (((uint)(5)), ((uint)(2)), false);
+                       this.table2 = new global::Gtk.Table (((uint)(4)), ((uint)(2)), false);
                        this.table2.Name = "table2";
                        this.table2.RowSpacing = ((uint)(6));
                        this.table2.ColumnSpacing = ((uint)(6));
                        // Container child table2.Gtk.Table+TableChild
-                       this.audiobitratelabel = new global::Gtk.Label ();
-                       this.audiobitratelabel.Name = "audiobitratelabel";
-                       this.audiobitratelabel.LabelProp = global::Mono.Unix.Catalog.GetString ("Audio 
Bitrate (kbps):");
-                       this.table2.Add (this.audiobitratelabel);
-                       global::Gtk.Table.TableChild w43 = ((global::Gtk.Table.TableChild)(this.table2 
[this.audiobitratelabel]));
-                       w43.TopAttach = ((uint)(4));
-                       w43.BottomAttach = ((uint)(5));
+                       this.device = new global::Gtk.Label ();
+                       this.device.Name = "device";
+                       this.device.LabelProp = global::Mono.Unix.Catalog.GetString ("Device:");
+                       this.table2.Add (this.device);
+                       global::Gtk.Table.TableChild w43 = ((global::Gtk.Table.TableChild)(this.table2 
[this.device]));
                        w43.XOptions = ((global::Gtk.AttachOptions)(4));
                        w43.YOptions = ((global::Gtk.AttachOptions)(4));
                        // Container child table2.Gtk.Table+TableChild
-                       this.audiobitratespinbutton = new global::Gtk.SpinButton (0, 360, 1);
-                       this.audiobitratespinbutton.CanFocus = true;
-                       this.audiobitratespinbutton.Name = "audiobitratespinbutton";
-                       this.audiobitratespinbutton.Adjustment.PageIncrement = 10;
-                       this.audiobitratespinbutton.ClimbRate = 1;
-                       this.audiobitratespinbutton.Numeric = true;
-                       this.audiobitratespinbutton.Value = 64;
-                       this.table2.Add (this.audiobitratespinbutton);
-                       global::Gtk.Table.TableChild w44 = ((global::Gtk.Table.TableChild)(this.table2 
[this.audiobitratespinbutton]));
-                       w44.TopAttach = ((uint)(4));
-                       w44.BottomAttach = ((uint)(5));
+                       this.devicecombobox = global::Gtk.ComboBox.NewText ();
+                       this.devicecombobox.Name = "devicecombobox";
+                       this.table2.Add (this.devicecombobox);
+                       global::Gtk.Table.TableChild w44 = ((global::Gtk.Table.TableChild)(this.table2 
[this.devicecombobox]));
                        w44.LeftAttach = ((uint)(1));
                        w44.RightAttach = ((uint)(2));
-                       w44.XOptions = ((global::Gtk.AttachOptions)(1));
-                       w44.YOptions = ((global::Gtk.AttachOptions)(1));
+                       w44.YOptions = ((global::Gtk.AttachOptions)(4));
                        // Container child table2.Gtk.Table+TableChild
-                       this.device = new global::Gtk.Label ();
-                       this.device.Name = "device";
-                       this.device.LabelProp = global::Mono.Unix.Catalog.GetString ("Device:");
-                       this.table2.Add (this.device);
-                       global::Gtk.Table.TableChild w45 = ((global::Gtk.Table.TableChild)(this.table2 
[this.device]));
+                       this.label2 = new global::Gtk.Label ();
+                       this.label2.Name = "label2";
+                       this.label2.LabelProp = global::Mono.Unix.Catalog.GetString ("Quality:");
+                       this.table2.Add (this.label2);
+                       global::Gtk.Table.TableChild w45 = ((global::Gtk.Table.TableChild)(this.table2 
[this.label2]));
+                       w45.TopAttach = ((uint)(3));
+                       w45.BottomAttach = ((uint)(4));
                        w45.XOptions = ((global::Gtk.AttachOptions)(4));
                        w45.YOptions = ((global::Gtk.AttachOptions)(4));
                        // Container child table2.Gtk.Table+TableChild
-                       this.devicecombobox = global::Gtk.ComboBox.NewText ();
-                       this.devicecombobox.Name = "devicecombobox";
-                       this.table2.Add (this.devicecombobox);
-                       global::Gtk.Table.TableChild w46 = ((global::Gtk.Table.TableChild)(this.table2 
[this.devicecombobox]));
+                       this.qualitycombobox = global::Gtk.ComboBox.NewText ();
+                       this.qualitycombobox.Name = "qualitycombobox";
+                       this.table2.Add (this.qualitycombobox);
+                       global::Gtk.Table.TableChild w46 = ((global::Gtk.Table.TableChild)(this.table2 
[this.qualitycombobox]));
+                       w46.TopAttach = ((uint)(2));
+                       w46.BottomAttach = ((uint)(3));
                        w46.LeftAttach = ((uint)(1));
                        w46.RightAttach = ((uint)(2));
-                       w46.XOptions = ((global::Gtk.AttachOptions)(4));
                        w46.YOptions = ((global::Gtk.AttachOptions)(4));
                        // Container child table2.Gtk.Table+TableChild
-                       this.sizecombobox = global::Gtk.ComboBox.NewText ();
-                       this.sizecombobox.Name = "sizecombobox";
-                       this.table2.Add (this.sizecombobox);
-                       global::Gtk.Table.TableChild w47 = ((global::Gtk.Table.TableChild)(this.table2 
[this.sizecombobox]));
-                       w47.TopAttach = ((uint)(2));
-                       w47.BottomAttach = ((uint)(3));
+                       this.sizecombobox1 = global::Gtk.ComboBox.NewText ();
+                       this.sizecombobox1.Name = "sizecombobox1";
+                       this.table2.Add (this.sizecombobox1);
+                       global::Gtk.Table.TableChild w47 = ((global::Gtk.Table.TableChild)(this.table2 
[this.sizecombobox1]));
+                       w47.TopAttach = ((uint)(3));
+                       w47.BottomAttach = ((uint)(4));
                        w47.LeftAttach = ((uint)(1));
                        w47.RightAttach = ((uint)(2));
-                       w47.XOptions = ((global::Gtk.AttachOptions)(4));
                        w47.YOptions = ((global::Gtk.AttachOptions)(4));
                        // Container child table2.Gtk.Table+TableChild
                        this.sizelabel = new global::Gtk.Label ();
@@ -502,52 +493,25 @@ namespace LongoMatch.Gui.Component
                        w48.XOptions = ((global::Gtk.AttachOptions)(4));
                        w48.YOptions = ((global::Gtk.AttachOptions)(4));
                        // Container child table2.Gtk.Table+TableChild
-                       this.videobitratelabel1 = new global::Gtk.Label ();
-                       this.videobitratelabel1.Name = "videobitratelabel1";
-                       this.videobitratelabel1.LabelProp = global::Mono.Unix.Catalog.GetString ("Video 
Bitrate (kbps):");
-                       this.table2.Add (this.videobitratelabel1);
-                       global::Gtk.Table.TableChild w49 = ((global::Gtk.Table.TableChild)(this.table2 
[this.videobitratelabel1]));
-                       w49.TopAttach = ((uint)(3));
-                       w49.BottomAttach = ((uint)(4));
-                       w49.XOptions = ((global::Gtk.AttachOptions)(4));
-                       w49.YOptions = ((global::Gtk.AttachOptions)(4));
-                       // Container child table2.Gtk.Table+TableChild
-                       this.videobitratespinbutton = new global::Gtk.SpinButton (1000, 8000, 1);
-                       this.videobitratespinbutton.CanFocus = true;
-                       this.videobitratespinbutton.Name = "videobitratespinbutton";
-                       this.videobitratespinbutton.Adjustment.PageIncrement = 10;
-                       this.videobitratespinbutton.ClimbRate = 1;
-                       this.videobitratespinbutton.Numeric = true;
-                       this.videobitratespinbutton.Value = 4000;
-                       this.table2.Add (this.videobitratespinbutton);
-                       global::Gtk.Table.TableChild w50 = ((global::Gtk.Table.TableChild)(this.table2 
[this.videobitratespinbutton]));
-                       w50.TopAttach = ((uint)(3));
-                       w50.BottomAttach = ((uint)(4));
-                       w50.LeftAttach = ((uint)(1));
-                       w50.RightAttach = ((uint)(2));
-                       w50.XOptions = ((global::Gtk.AttachOptions)(1));
-                       w50.YOptions = ((global::Gtk.AttachOptions)(1));
-                       // Container child table2.Gtk.Table+TableChild
                        this.videoformatcombobox = global::Gtk.ComboBox.NewText ();
                        this.videoformatcombobox.Name = "videoformatcombobox";
                        this.table2.Add (this.videoformatcombobox);
-                       global::Gtk.Table.TableChild w51 = ((global::Gtk.Table.TableChild)(this.table2 
[this.videoformatcombobox]));
-                       w51.TopAttach = ((uint)(1));
-                       w51.BottomAttach = ((uint)(2));
-                       w51.LeftAttach = ((uint)(1));
-                       w51.RightAttach = ((uint)(2));
-                       w51.XOptions = ((global::Gtk.AttachOptions)(4));
-                       w51.YOptions = ((global::Gtk.AttachOptions)(4));
+                       global::Gtk.Table.TableChild w49 = ((global::Gtk.Table.TableChild)(this.table2 
[this.videoformatcombobox]));
+                       w49.TopAttach = ((uint)(1));
+                       w49.BottomAttach = ((uint)(2));
+                       w49.LeftAttach = ((uint)(1));
+                       w49.RightAttach = ((uint)(2));
+                       w49.YOptions = ((global::Gtk.AttachOptions)(4));
                        // Container child table2.Gtk.Table+TableChild
                        this.videoformatlabel = new global::Gtk.Label ();
                        this.videoformatlabel.Name = "videoformatlabel";
                        this.videoformatlabel.LabelProp = global::Mono.Unix.Catalog.GetString ("Video 
Format:");
                        this.table2.Add (this.videoformatlabel);
-                       global::Gtk.Table.TableChild w52 = ((global::Gtk.Table.TableChild)(this.table2 
[this.videoformatlabel]));
-                       w52.TopAttach = ((uint)(1));
-                       w52.BottomAttach = ((uint)(2));
-                       w52.XOptions = ((global::Gtk.AttachOptions)(4));
-                       w52.YOptions = ((global::Gtk.AttachOptions)(4));
+                       global::Gtk.Table.TableChild w50 = ((global::Gtk.Table.TableChild)(this.table2 
[this.videoformatlabel]));
+                       w50.TopAttach = ((uint)(1));
+                       w50.BottomAttach = ((uint)(2));
+                       w50.XOptions = ((global::Gtk.AttachOptions)(4));
+                       w50.YOptions = ((global::Gtk.AttachOptions)(4));
                        this.expander1.Add (this.table2);
                        this.GtkLabel5 = new global::Gtk.Label ();
                        this.GtkLabel5.Name = "GtkLabel5";
@@ -555,17 +519,16 @@ namespace LongoMatch.Gui.Component
                        this.GtkLabel5.UseUnderline = true;
                        this.expander1.LabelWidget = this.GtkLabel5;
                        this.vbox2.Add (this.expander1);
-                       global::Gtk.Box.BoxChild w54 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.expander1]));
-                       w54.Position = 1;
-                       w54.Expand = false;
-                       w54.Fill = false;
+                       global::Gtk.Box.BoxChild w52 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.expander1]));
+                       w52.Position = 1;
+                       w52.Expand = false;
+                       w52.Fill = false;
                        this.Add (this.vbox2);
                        if ((this.Child != null)) {
                                this.Child.ShowAll ();
                        }
                        this.editbutton.Hide ();
                        this.device.Hide ();
-                       this.videobitratelabel1.Hide ();
                        this.Show ();
                        this.seasonentry.Changed += new global::System.EventHandler (this.OnEdited);
                        this.dateEntry.Changed += new global::System.EventHandler (this.OnEdited);
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Dialog.VideoEditionProperties.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Dialog.VideoEditionProperties.cs
index 02fe1b1..4104b3e 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Dialog.VideoEditionProperties.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Dialog.VideoEditionProperties.cs
@@ -66,12 +66,7 @@ namespace LongoMatch.Gui.Dialog
                        w2.Position = 0;
                        // Container child hbox2.Gtk.Box+BoxChild
                        this.qualitycombobox = global::Gtk.ComboBox.NewText ();
-                       this.qualitycombobox.AppendText (global::Mono.Unix.Catalog.GetString ("Low"));
-                       this.qualitycombobox.AppendText (global::Mono.Unix.Catalog.GetString ("Normal"));
-                       this.qualitycombobox.AppendText (global::Mono.Unix.Catalog.GetString ("Good"));
-                       this.qualitycombobox.AppendText (global::Mono.Unix.Catalog.GetString ("Extra"));
                        this.qualitycombobox.Name = "qualitycombobox";
-                       this.qualitycombobox.Active = 1;
                        this.hbox2.Add (this.qualitycombobox);
                        global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.qualitycombobox]));
                        w3.Position = 1;
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index 0f6bd86..5a6d223 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -620,21 +620,21 @@
           <widget class="Gtk.Expander" id="expander1">
             <property name="MemberName" />
             <property name="CanFocus">True</property>
+            <property name="Expanded">True</property>
             <child>
               <widget class="Gtk.Table" id="table2">
                 <property name="MemberName" />
-                <property name="NRows">5</property>
+                <property name="NRows">4</property>
                 <property name="NColumns">2</property>
                 <property name="RowSpacing">6</property>
                 <property name="ColumnSpacing">6</property>
                 <child>
-                  <widget class="Gtk.Label" id="audiobitratelabel">
+                  <widget class="Gtk.Label" id="device">
                     <property name="MemberName" />
-                    <property name="LabelProp" translatable="yes">Audio Bitrate (kbps):</property>
+                    <property name="Visible">False</property>
+                    <property name="LabelProp" translatable="yes">Device:</property>
                   </widget>
                   <packing>
-                    <property name="TopAttach">4</property>
-                    <property name="BottomAttach">5</property>
                     <property name="AutoSize">True</property>
                     <property name="XOptions">Fill</property>
                     <property name="YOptions">Fill</property>
@@ -647,39 +647,32 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="Gtk.SpinButton" id="audiobitratespinbutton">
+                  <widget class="Gtk.ComboBox" id="devicecombobox">
                     <property name="MemberName" />
-                    <property name="CanFocus">True</property>
-                    <property name="Upper">360</property>
-                    <property name="PageIncrement">10</property>
-                    <property name="StepIncrement">1</property>
-                    <property name="ClimbRate">1</property>
-                    <property name="Numeric">True</property>
-                    <property name="Value">64</property>
+                    <property name="IsTextCombo">True</property>
+                    <property name="Items" translatable="yes" />
                   </widget>
                   <packing>
-                    <property name="TopAttach">4</property>
-                    <property name="BottomAttach">5</property>
                     <property name="LeftAttach">1</property>
                     <property name="RightAttach">2</property>
                     <property name="AutoSize">False</property>
-                    <property name="XOptions">Expand</property>
-                    <property name="YOptions">Expand</property>
+                    <property name="YOptions">Fill</property>
                     <property name="XExpand">True</property>
-                    <property name="XFill">False</property>
+                    <property name="XFill">True</property>
                     <property name="XShrink">False</property>
-                    <property name="YExpand">True</property>
-                    <property name="YFill">False</property>
+                    <property name="YExpand">False</property>
+                    <property name="YFill">True</property>
                     <property name="YShrink">False</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="Gtk.Label" id="device">
+                  <widget class="Gtk.Label" id="label2">
                     <property name="MemberName" />
-                    <property name="Visible">False</property>
-                    <property name="LabelProp" translatable="yes">Device:</property>
+                    <property name="LabelProp" translatable="yes">Quality:</property>
                   </widget>
                   <packing>
+                    <property name="TopAttach">3</property>
+                    <property name="BottomAttach">4</property>
                     <property name="AutoSize">True</property>
                     <property name="XOptions">Fill</property>
                     <property name="YOptions">Fill</property>
@@ -692,18 +685,19 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="Gtk.ComboBox" id="devicecombobox">
+                  <widget class="Gtk.ComboBox" id="qualitycombobox">
                     <property name="MemberName" />
                     <property name="IsTextCombo">True</property>
                     <property name="Items" translatable="yes" />
                   </widget>
                   <packing>
+                    <property name="TopAttach">2</property>
+                    <property name="BottomAttach">3</property>
                     <property name="LeftAttach">1</property>
                     <property name="RightAttach">2</property>
-                    <property name="AutoSize">True</property>
-                    <property name="XOptions">Fill</property>
+                    <property name="AutoSize">False</property>
                     <property name="YOptions">Fill</property>
-                    <property name="XExpand">False</property>
+                    <property name="XExpand">True</property>
                     <property name="XFill">True</property>
                     <property name="XShrink">False</property>
                     <property name="YExpand">False</property>
@@ -712,20 +706,19 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="Gtk.ComboBox" id="sizecombobox">
+                  <widget class="Gtk.ComboBox" id="sizecombobox1">
                     <property name="MemberName" />
                     <property name="IsTextCombo">True</property>
                     <property name="Items" translatable="yes" />
                   </widget>
                   <packing>
-                    <property name="TopAttach">2</property>
-                    <property name="BottomAttach">3</property>
+                    <property name="TopAttach">3</property>
+                    <property name="BottomAttach">4</property>
                     <property name="LeftAttach">1</property>
                     <property name="RightAttach">2</property>
-                    <property name="AutoSize">True</property>
-                    <property name="XOptions">Fill</property>
+                    <property name="AutoSize">False</property>
                     <property name="YOptions">Fill</property>
-                    <property name="XExpand">False</property>
+                    <property name="XExpand">True</property>
                     <property name="XFill">True</property>
                     <property name="XShrink">False</property>
                     <property name="YExpand">False</property>
@@ -753,54 +746,6 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="Gtk.Label" id="videobitratelabel1">
-                    <property name="MemberName" />
-                    <property name="Visible">False</property>
-                    <property name="LabelProp" translatable="yes">Video Bitrate (kbps):</property>
-                  </widget>
-                  <packing>
-                    <property name="TopAttach">3</property>
-                    <property name="BottomAttach">4</property>
-                    <property name="AutoSize">True</property>
-                    <property name="XOptions">Fill</property>
-                    <property name="YOptions">Fill</property>
-                    <property name="XExpand">False</property>
-                    <property name="XFill">True</property>
-                    <property name="XShrink">False</property>
-                    <property name="YExpand">False</property>
-                    <property name="YFill">True</property>
-                    <property name="YShrink">False</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="Gtk.SpinButton" id="videobitratespinbutton">
-                    <property name="MemberName" />
-                    <property name="CanFocus">True</property>
-                    <property name="Lower">1000</property>
-                    <property name="Upper">8000</property>
-                    <property name="PageIncrement">10</property>
-                    <property name="StepIncrement">1</property>
-                    <property name="ClimbRate">1</property>
-                    <property name="Numeric">True</property>
-                    <property name="Value">4000</property>
-                  </widget>
-                  <packing>
-                    <property name="TopAttach">3</property>
-                    <property name="BottomAttach">4</property>
-                    <property name="LeftAttach">1</property>
-                    <property name="RightAttach">2</property>
-                    <property name="AutoSize">False</property>
-                    <property name="XOptions">Expand</property>
-                    <property name="YOptions">Expand</property>
-                    <property name="XExpand">True</property>
-                    <property name="XFill">False</property>
-                    <property name="XShrink">False</property>
-                    <property name="YExpand">True</property>
-                    <property name="YFill">False</property>
-                    <property name="YShrink">False</property>
-                  </packing>
-                </child>
-                <child>
                   <widget class="Gtk.ComboBox" id="videoformatcombobox">
                     <property name="MemberName" />
                     <property name="IsTextCombo">True</property>
@@ -811,10 +756,9 @@
                     <property name="BottomAttach">2</property>
                     <property name="LeftAttach">1</property>
                     <property name="RightAttach">2</property>
-                    <property name="AutoSize">True</property>
-                    <property name="XOptions">Fill</property>
+                    <property name="AutoSize">False</property>
                     <property name="YOptions">Fill</property>
-                    <property name="XExpand">False</property>
+                    <property name="XExpand">True</property>
                     <property name="XFill">True</property>
                     <property name="XShrink">False</property>
                     <property name="YExpand">False</property>
@@ -3222,11 +3166,7 @@ new one.</property>
                   <widget class="Gtk.ComboBox" id="qualitycombobox">
                     <property name="MemberName" />
                     <property name="IsTextCombo">True</property>
-                    <property name="Items" translatable="yes">Low
-Normal
-Good
-Extra</property>
-                    <property name="Active">1</property>
+                    <property name="Items" />
                   </widget>
                   <packing>
                     <property name="Position">1</property>
diff --git a/LongoMatch.Multimedia/Capturer/FakeCapturer.cs b/LongoMatch.Multimedia/Capturer/FakeCapturer.cs
index 8ad8563..2542af4 100644
--- a/LongoMatch.Multimedia/Capturer/FakeCapturer.cs
+++ b/LongoMatch.Multimedia/Capturer/FakeCapturer.cs
@@ -90,14 +90,14 @@ namespace LongoMatch.Video.Capturer
                        set {}
                }
 
-               public uint VideoBitrate {
+               public uint VideoQuality {
                        get {
                                return 0;
                        }
                        set {}
                }
 
-               public uint AudioBitrate {
+               public uint AudioQuality {
                        get {
                                return 0;
                        }
diff --git a/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs 
b/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs
index d41dfe5..453d3a1 100644
--- a/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs
+++ b/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs
@@ -89,17 +89,17 @@ namespace LongoMatch.Video.Capturer {
                        }
                }
 
-               [GLib.Property("video_bitrate")]
-               public uint VideoBitrate {
+               [GLib.Property("video_quality")]
+               public uint VideoQuality {
                        get {
-                               GLib.Value val = GetProperty("video_bitrate");
+                               GLib.Value val = GetProperty("video_quality");
                                uint ret = (uint) val;
                                val.Dispose();
                                return ret;
                        }
                        set {
                                GLib.Value val = new GLib.Value(value);
-                               SetProperty("video_bitrate", val);
+                               SetProperty("video_quality", val);
                                val.Dispose();
                        }
                }
@@ -119,17 +119,17 @@ namespace LongoMatch.Video.Capturer {
                        }
                }
 
-               [GLib.Property("audio_bitrate")]
-               public uint AudioBitrate {
+               [GLib.Property("audio_quality")]
+               public uint AudioQuality {
                        get {
-                               GLib.Value val = GetProperty("audio_bitrate");
+                               GLib.Value val = GetProperty("audio_quality");
                                uint ret = (uint) val;
                                val.Dispose();
                                return ret;
                        }
                        set {
                                GLib.Value val = new GLib.Value(value);
-                               SetProperty("audio_bitrate", val);
+                               SetProperty("audio_quality", val);
                                val.Dispose();
                        }
                }
diff --git a/LongoMatch.Multimedia/Converter/GstVideoConverter.cs 
b/LongoMatch.Multimedia/Converter/GstVideoConverter.cs
index f8d5a4d..c23255a 100644
--- a/LongoMatch.Multimedia/Converter/GstVideoConverter.cs
+++ b/LongoMatch.Multimedia/Converter/GstVideoConverter.cs
@@ -210,8 +210,8 @@ namespace LongoMatch.Video.Converter {
                                                                         VideoEncoderType video_codec,
                                                                         AudioEncoderType audio_codec,
                                                                         VideoMuxerType muxer,
-                                                                        uint video_bitrate,
-                                                                        uint audio_bitrate,
+                                                                        uint video_quality,
+                                                                        uint audio_quality,
                                                                         uint height,
                                                                         uint width,
                                                                         uint fps_n,
@@ -223,8 +223,8 @@ namespace LongoMatch.Video.Converter {
                                                                       value.EncodingProfile.VideoEncoder,
                                                                       value.EncodingProfile.AudioEncoder,
                                                                       value.EncodingProfile.Muxer,
-                                                                      value.VideoBitrate,
-                                                                      value.AudioBitrate,
+                                                                      value.EncodingQuality.VideoQuality,
+                                                                      value.EncodingQuality.AudioQuality,
                                                                       value.VideoStandard.Height,
                                                                       value.VideoStandard.Width,
                                                                       value.Framerate_n,
diff --git a/LongoMatch.Multimedia/Editor/GstVideoSplitter.cs 
b/LongoMatch.Multimedia/Editor/GstVideoSplitter.cs
index 090e328..42bdbf4 100644
--- a/LongoMatch.Multimedia/Editor/GstVideoSplitter.cs
+++ b/LongoMatch.Multimedia/Editor/GstVideoSplitter.cs
@@ -83,32 +83,32 @@ namespace LongoMatch.Video.Editor {
                        }
                }
 
-               [GLib.Property("video_bitrate")]
-               public int VideoBitrate {
+               [GLib.Property("video_quality")]
+               public int VideoQuality {
                        get {
-                               GLib.Value val = GetProperty("video_bitrate");
+                               GLib.Value val = GetProperty("video_quality");
                                int ret = (int) val;
                                val.Dispose();
                                return ret;
                        }
                        set {
                                GLib.Value val = new GLib.Value(value);
-                               SetProperty("video_bitrate", val);
+                               SetProperty("video_quality", val);
                                val.Dispose();
                        }
                }
 
                [GLib.Property("audio_bitrate")]
-               public int AudioBitrate {
+               public int AudioQuality {
                        get {
-                               GLib.Value val = GetProperty("audio_bitrate");
+                               GLib.Value val = GetProperty("audio_quality");
                                int ret = (int) val;
                                val.Dispose();
                                return ret;
                        }
                        set {
                                GLib.Value val = new GLib.Value(value);
-                               SetProperty("audio_bitrate", val);
+                               SetProperty("audio_quality", val);
                                val.Dispose();
                        }
                }
@@ -385,8 +385,8 @@ namespace LongoMatch.Video.Editor {
                                /* FIXME: This should only be possible with the editor in the NULL state.
                                 * For now keep this exact order setting the properties in the editor,
                                 * otherwise it won't work */
-                               VideoBitrate = (int) value.VideoBitrate;
-                               AudioBitrate = (int) value.AudioBitrate;
+                               VideoQuality = (int) value.EncodingQuality.VideoQuality;
+                               AudioQuality = (int) value.EncodingQuality.AudioQuality;
                                Height = (int) value.VideoStandard.Height;
                                Width = (int) value.VideoStandard.Width;
                                AudioEncoder = value.EncodingProfile.AudioEncoder;
diff --git a/LongoMatch.Multimedia/Interfaces/ICapturer.cs b/LongoMatch.Multimedia/Interfaces/ICapturer.cs
index 62b4a9f..4c49bcc 100644
--- a/LongoMatch.Multimedia/Interfaces/ICapturer.cs
+++ b/LongoMatch.Multimedia/Interfaces/ICapturer.cs
@@ -48,12 +48,12 @@ namespace LongoMatch.Multimedia.Interfaces
                        set ;
                }
 
-               uint VideoBitrate {
+               uint VideoQuality {
                        get;
                        set ;
                }
 
-               uint AudioBitrate {
+               uint AudioQuality {
                        get ;
                        set ;
                }
diff --git a/libcesarplayer/gst-camera-capturer.c b/libcesarplayer/gst-camera-capturer.c
index 35d8bd5..725f25b 100644
--- a/libcesarplayer/gst-camera-capturer.c
+++ b/libcesarplayer/gst-camera-capturer.c
@@ -67,8 +67,8 @@ enum
   PROP_0,
   PROP_OUTPUT_HEIGHT,
   PROP_OUTPUT_WIDTH,
-  PROP_VIDEO_BITRATE,
-  PROP_AUDIO_BITRATE,
+  PROP_VIDEO_QUALITY,
+  PROP_AUDIO_QUALITY,
   PROP_AUDIO_ENABLED,
   PROP_OUTPUT_FILE,
   PROP_DEVICE_ID,
@@ -82,8 +82,8 @@ struct GstCameraCapturerPrivate
   gchar *device_id;
   guint output_height;
   guint output_width;
-  guint audio_bitrate;
-  guint video_bitrate;
+  guint audio_quality;
+  guint video_quality;
   gboolean audio_enabled;
   VideoEncoderType video_encoder_type;
   AudioEncoderType audio_encoder_type;
@@ -362,8 +362,8 @@ gst_camera_capturer_init (GstCameraCapturer * object)
 
   priv->output_height = 480;
   priv->output_width = 640;
-  priv->audio_bitrate = 128;
-  priv->video_bitrate = 5000;
+  priv->audio_quality = 50;
+  priv->video_quality = 50;
   priv->last_buffer = NULL;
   priv->expand_logo = TRUE;
   priv->current_recording_start_ts = GST_CLOCK_TIME_NONE;
@@ -437,20 +437,20 @@ gst_camera_capturer_finalize (GObject * object)
 }
 
 static void
-gst_camera_capturer_set_video_bit_rate (GstCameraCapturer * gcc, gint bitrate)
+gst_camera_capturer_set_video_quality (GstCameraCapturer * gcc, gint quality)
 {
-  gcc->priv->video_bitrate = bitrate;
-  GST_INFO_OBJECT (gcc, "Changed video bitrate to: %d",
-      gcc->priv->video_bitrate);
+  gcc->priv->video_quality = quality;
+  GST_INFO_OBJECT (gcc, "Changed video quality to: %d",
+      gcc->priv->video_quality);
 }
 
 static void
-gst_camera_capturer_set_audio_bit_rate (GstCameraCapturer * gcc, gint bitrate)
+gst_camera_capturer_set_audio_quality (GstCameraCapturer * gcc, gint quality)
 {
 
-  gcc->priv->audio_bitrate = bitrate;
-  GST_INFO_OBJECT (gcc, "Changed audio bitrate to: %d",
-      gcc->priv->audio_bitrate);
+  gcc->priv->audio_quality = quality;
+  GST_INFO_OBJECT (gcc, "Changed audio quality to: %d",
+      gcc->priv->audio_quality);
 }
 
 static void
@@ -492,11 +492,11 @@ gst_camera_capturer_set_property (GObject * object, guint property_id,
     case PROP_OUTPUT_WIDTH:
       gcc->priv->output_width = g_value_get_uint (value);
       break;
-    case PROP_VIDEO_BITRATE:
-      gst_camera_capturer_set_video_bit_rate (gcc, g_value_get_uint (value));
+    case PROP_VIDEO_QUALITY:
+      gst_camera_capturer_set_video_quality (gcc, g_value_get_uint (value));
       break;
-    case PROP_AUDIO_BITRATE:
-      gst_camera_capturer_set_audio_bit_rate (gcc, g_value_get_uint (value));
+    case PROP_AUDIO_QUALITY:
+      gst_camera_capturer_set_audio_quality (gcc, g_value_get_uint (value));
       break;
     case PROP_AUDIO_ENABLED:
       gst_camera_capturer_set_audio_enabled (gcc, g_value_get_boolean (value));
@@ -528,11 +528,11 @@ gst_camera_capturer_get_property (GObject * object, guint property_id,
     case PROP_OUTPUT_WIDTH:
       g_value_set_uint (value, gcc->priv->output_width);
       break;
-    case PROP_AUDIO_BITRATE:
-      g_value_set_uint (value, gcc->priv->audio_bitrate);
+    case PROP_AUDIO_QUALITY:
+      g_value_set_uint (value, gcc->priv->audio_quality);
       break;
-    case PROP_VIDEO_BITRATE:
-      g_value_set_uint (value, gcc->priv->video_bitrate);
+    case PROP_VIDEO_QUALITY:
+      g_value_set_uint (value, gcc->priv->video_quality);
       break;
     case PROP_AUDIO_ENABLED:
       g_value_set_boolean (value, gcc->priv->audio_enabled);
@@ -576,11 +576,11 @@ gst_camera_capturer_class_init (GstCameraCapturerClass * klass)
   g_object_class_install_property (object_class, PROP_OUTPUT_WIDTH,
       g_param_spec_uint ("output_width", NULL,
           NULL, 0, 5600, 720, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_VIDEO_BITRATE,
-      g_param_spec_uint ("video_bitrate", NULL,
+  g_object_class_install_property (object_class, PROP_VIDEO_QUALITY,
+      g_param_spec_uint ("video_quality", NULL,
           NULL, 100, G_MAXUINT, 1000, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_AUDIO_BITRATE,
-      g_param_spec_uint ("audio_bitrate", NULL,
+  g_object_class_install_property (object_class, PROP_AUDIO_QUALITY,
+      g_param_spec_uint ("audio_quality", NULL,
           NULL, 12, G_MAXUINT, 128, G_PARAM_READWRITE));
   g_object_class_install_property (object_class, PROP_AUDIO_ENABLED,
       g_param_spec_boolean ("audio_enabled", NULL,
@@ -1434,72 +1434,19 @@ static gboolean
 gst_camera_capturer_create_video_encoder (GstCameraCapturer * gcc,
     VideoEncoderType type, GError ** err)
 {
-  gchar *name = NULL;
+  GstElement *encoder = NULL;
 
   g_return_val_if_fail (gcc != NULL, FALSE);
   g_return_val_if_fail (GST_IS_CAMERA_CAPTURER (gcc), FALSE);
 
-  switch (type) {
-    case VIDEO_ENCODER_MPEG4:
-      gcc->priv->video_enc =
-          gst_element_factory_make ("ffenc_mpeg4", "video-encoder");
-      g_object_set (gcc->priv->video_enc, "pass", 512,
-          "max-key-interval", -1, NULL);
-      name = "FFmpeg mpeg4 video encoder";
-      break;
-
-    case VIDEO_ENCODER_XVID:
-      gcc->priv->video_enc =
-          gst_element_factory_make ("xvidenc", "video-encoder");
-      g_object_set (gcc->priv->video_enc, "pass", 1,
-          "profile", 146, "max-key-interval", -1, NULL);
-      name = "Xvid video encoder";
-      break;
-
-    case VIDEO_ENCODER_H264:
-      gcc->priv->video_enc =
-          gst_element_factory_make ("x264enc", "video-encoder");
-      g_object_set (gcc->priv->video_enc, "key-int-max", 25, "pass", 17,
-          "speed-preset", 3, NULL);
-      name = "X264 video encoder";
-      break;
-
-    case VIDEO_ENCODER_THEORA:
-      gcc->priv->video_enc =
-          gst_element_factory_make ("theoraenc", "video-encoder");
-      g_object_set (gcc->priv->video_enc, "keyframe-auto", FALSE,
-          "keyframe-force", 25, NULL);
-      name = "Theora video encoder";
-      break;
-
-    case VIDEO_ENCODER_VP8:
-    default:
-      gcc->priv->video_enc =
-          gst_element_factory_make ("vp8enc", "video-encoder");
-      g_object_set (gcc->priv->video_enc, "speed", 2, "threads", 8,
-          "max-keyframe-distance", 25, NULL);
-      name = "VP8 video encoder";
-      break;
-
-  }
-  if (!gcc->priv->video_enc) {
-    g_set_error (err,
-        GCC_ERROR,
-        GST_ERROR_PLUGIN_LOAD,
-        "Failed to create the %s element. "
-        "Please check your GStreamer installation.", name);
+  encoder = lgm_create_video_encoder (type, gcc->priv->video_quality,
+      GCC_ERROR, err);
+  if (!encoder) {
     return FALSE;
   }
 
-  if (gcc->priv->video_encoder_type == VIDEO_ENCODER_MPEG4 ||
-      gcc->priv->video_encoder_type == VIDEO_ENCODER_XVID)
-    g_object_set (gcc->priv->video_enc, "bitrate", gcc->priv->video_bitrate * 1000, NULL);
-  else
-    g_object_set (gcc->priv->video_enc, "bitrate", gcc->priv->video_bitrate,
-        NULL);
-
-  GST_INFO_OBJECT(gcc, "Video encoder %s created", name);
   gcc->priv->video_encoder_type = type;
+  gcc->priv->video_enc = encoder;
   return TRUE;
 }
 
@@ -1507,49 +1454,19 @@ static gboolean
 gst_camera_capturer_create_audio_encoder (GstCameraCapturer * gcc,
     AudioEncoderType type, GError ** err)
 {
-  gchar *name = NULL;
+  GstElement *encoder = NULL;
 
   g_return_val_if_fail (gcc != NULL, FALSE);
   g_return_val_if_fail (GST_IS_CAMERA_CAPTURER (gcc), FALSE);
 
-  switch (type) {
-    case AUDIO_ENCODER_MP3:
-      gcc->priv->audio_enc =
-          gst_element_factory_make ("lamemp3enc", "audio-encoder");
-      g_object_set (gcc->priv->audio_enc, "target", 0, NULL);
-      name = "Mp3 audio encoder";
-      break;
-
-    case AUDIO_ENCODER_AAC:
-      gcc->priv->audio_enc = gst_element_factory_make ("faac", "audio-encoder");
-      name = "AAC audio encoder";
-      break;
-
-    case AUDIO_ENCODER_VORBIS:
-    default:
-      gcc->priv->audio_enc =
-          gst_element_factory_make ("vorbisenc", "audio-encoder");
-      name = "Vorbis audio encoder";
-      break;
-  }
-
-  if (!gcc->priv->audio_enc) {
-    g_set_error (err,
-        GCC_ERROR,
-        GST_ERROR_PLUGIN_LOAD,
-        "Failed to create the %s element. "
-        "Please check your GStreamer installation.", name);
+  encoder = lgm_create_audio_encoder (type, gcc->priv->audio_quality,
+      GCC_ERROR, err);
+  if (!encoder) {
     return FALSE;
   }
 
-  if (gcc->priv->audio_encoder_type == AUDIO_ENCODER_MP3)
-    g_object_set (gcc->priv->audio_enc, "bitrate", gcc->priv->audio_bitrate, NULL);
-  else
-    g_object_set (gcc->priv->audio_enc, "bitrate", 1000 * gcc->priv->audio_bitrate, NULL);
-
-  GST_INFO_OBJECT(gcc, "Audio encoder %s created", name);
-
   gcc->priv->audio_encoder_type = type;
+  gcc->priv->audio_enc = encoder;
   return TRUE;
 }
 
@@ -1557,46 +1474,17 @@ static gboolean
 gst_camera_capturer_create_video_muxer (GstCameraCapturer * gcc,
     VideoMuxerType type, GError ** err)
 {
-  gchar *name = NULL;
+  GstElement *muxer = NULL;
 
   g_return_val_if_fail (gcc != NULL, FALSE);
   g_return_val_if_fail (GST_IS_CAMERA_CAPTURER (gcc), FALSE);
 
-  switch (type) {
-    case VIDEO_MUXER_OGG:
-      name = "OGG muxer";
-      gcc->priv->muxer = gst_element_factory_make ("oggmux", "video-muxer");
-      break;
-    case VIDEO_MUXER_AVI:
-      name = "AVI muxer";
-      gcc->priv->muxer = gst_element_factory_make ("avimux", "video-muxer");
-      break;
-    case VIDEO_MUXER_MATROSKA:
-      name = "Matroska muxer";
-      gcc->priv->muxer =
-          gst_element_factory_make ("matroskamux", "video-muxer");
-      break;
-    case VIDEO_MUXER_MP4:
-      name = "MP4 muxer";
-      gcc->priv->muxer = gst_element_factory_make ("qtmux", "video-muxer");
-      break;
-    case VIDEO_MUXER_WEBM:
-    default:
-      name = "WebM muxer";
-      gcc->priv->muxer = gst_element_factory_make ("webmmux", "video-muxer");
-      break;
-  }
-
-  if (!gcc->priv->muxer) {
-    g_set_error (err,
-        GCC_ERROR,
-        GST_ERROR_PLUGIN_LOAD,
-        "Failed to create the %s element. "
-        "Please check your GStreamer installation.", name);
+  muxer = lgm_create_muxer (type, GCC_ERROR, err);
+  if (!muxer) {
+    return FALSE;
   }
-
-  GST_INFO_OBJECT(gcc, "Muxer %s created", name);
   gcc->priv->video_muxer_type = type;
+  gcc->priv->muxer = muxer;
   return TRUE;
 }
 
diff --git a/libcesarplayer/gst-video-encoder.c b/libcesarplayer/gst-video-encoder.c
index 4210956..6f390ad 100644
--- a/libcesarplayer/gst-video-encoder.c
+++ b/libcesarplayer/gst-video-encoder.c
@@ -46,8 +46,8 @@ struct GstVideoEncoderPrivate
   GList *current_file;
   guint output_height;
   guint output_width;
-  guint audio_bitrate;
-  guint video_bitrate;
+  guint audio_quality;
+  guint video_quality;
   guint fps_n;
   guint fps_d;
   VideoEncoderType video_encoder_type;
@@ -104,8 +104,8 @@ gst_video_encoder_init (GstVideoEncoder * object)
 
   priv->output_height = 480;
   priv->output_width = 640;
-  priv->audio_bitrate = 128;
-  priv->video_bitrate = 5000;
+  priv->audio_quality = 50;
+  priv->video_quality = 50;
   priv->video_encoder_type = VIDEO_ENCODER_VP8;
   priv->audio_encoder_type = AUDIO_ENCODER_VORBIS;
   priv->video_muxer_type = VIDEO_MUXER_WEBM;
@@ -430,72 +430,19 @@ static gboolean
 gst_video_encoder_create_video_encoder (GstVideoEncoder * gve,
     VideoEncoderType type, GError ** err)
 {
-  gchar *name = NULL;
+  GstElement *encoder = NULL;
 
   g_return_val_if_fail (gve != NULL, FALSE);
   g_return_val_if_fail (GST_IS_VIDEO_ENCODER (gve), FALSE);
 
-  switch (type) {
-    case VIDEO_ENCODER_MPEG4:
-      gve->priv->video_enc =
-          gst_element_factory_make ("ffenc_mpeg4", "video-encoder");
-      g_object_set (gve->priv->video_enc, "pass", 512,
-          "max-key-interval", -1, NULL);
-      name = "FFmpeg mpeg4 video encoder";
-      break;
-
-    case VIDEO_ENCODER_XVID:
-      gve->priv->video_enc =
-          gst_element_factory_make ("xvidenc", "video-encoder");
-      g_object_set (gve->priv->video_enc, "pass", 1,
-          "profile", 146, "max-key-interval", -1, NULL);
-      name = "Xvid video encoder";
-      break;
-
-    case VIDEO_ENCODER_H264:
-      gve->priv->video_enc =
-          gst_element_factory_make ("x264enc", "video-encoder");
-      g_object_set (gve->priv->video_enc, "key-int-max", 25, "pass", 17,
-          "speed-preset", 3, NULL);
-      name = "X264 video encoder";
-      break;
-
-    case VIDEO_ENCODER_THEORA:
-      gve->priv->video_enc =
-          gst_element_factory_make ("theoraenc", "video-encoder");
-      g_object_set (gve->priv->video_enc, "keyframe-auto", FALSE,
-          "keyframe-force", 25, NULL);
-      name = "Theora video encoder";
-      break;
-
-    case VIDEO_ENCODER_VP8:
-    default:
-      gve->priv->video_enc =
-          gst_element_factory_make ("vp8enc", "video-encoder");
-      g_object_set (gve->priv->video_enc, "speed", 2, "threads", 8,
-          "max-keyframe-distance", 25, NULL);
-      name = "VP8 video encoder";
-      break;
-
-  }
-  if (!gve->priv->video_enc) {
-    g_set_error (err,
-        GVE_ERROR,
-        GST_ERROR_PLUGIN_LOAD,
-        "Failed to create the %s element. "
-        "Please check your GStreamer installation.", name);
+  encoder = lgm_create_video_encoder (type, gve->priv->video_quality,
+      GVE_ERROR, err);
+  if (!encoder) {
     return FALSE;
   }
 
-  if (gve->priv->video_encoder_type == VIDEO_ENCODER_MPEG4 ||
-      gve->priv->video_encoder_type == VIDEO_ENCODER_XVID)
-    g_object_set (gve->priv->video_enc, "bitrate", gve->priv->video_bitrate * 1000, NULL);
-  else
-    g_object_set (gve->priv->video_enc, "bitrate", gve->priv->video_bitrate,
-        NULL);
-
-  GST_INFO_OBJECT(gve, "Video encoder %s created", name);
   gve->priv->video_encoder_type = type;
+  gve->priv->video_enc = encoder;
   return TRUE;
 }
 
@@ -503,49 +450,19 @@ static gboolean
 gst_video_encoder_create_audio_encoder (GstVideoEncoder * gve,
     AudioEncoderType type, GError ** err)
 {
-  gchar *name = NULL;
+  GstElement *encoder = NULL;
 
   g_return_val_if_fail (gve != NULL, FALSE);
   g_return_val_if_fail (GST_IS_VIDEO_ENCODER (gve), FALSE);
 
-  switch (type) {
-    case AUDIO_ENCODER_MP3:
-      gve->priv->audio_enc =
-          gst_element_factory_make ("lamemp3enc", "audio-encoder");
-      g_object_set (gve->priv->audio_enc, "target", 0, NULL);
-      name = "Mp3 audio encoder";
-      break;
-
-    case AUDIO_ENCODER_AAC:
-      gve->priv->audio_enc = gst_element_factory_make ("faac", "audio-encoder");
-      name = "AAC audio encoder";
-      break;
-
-    case AUDIO_ENCODER_VORBIS:
-    default:
-      gve->priv->audio_enc =
-          gst_element_factory_make ("vorbisenc", "audio-encoder");
-      name = "Vorbis audio encoder";
-      break;
-  }
-
-  if (!gve->priv->audio_enc) {
-    g_set_error (err,
-        GVE_ERROR,
-        GST_ERROR_PLUGIN_LOAD,
-        "Failed to create the %s element. "
-        "Please check your GStreamer installation.", name);
+  encoder = lgm_create_audio_encoder (type, gve->priv->audio_quality,
+      GVE_ERROR, err);
+  if (!encoder) {
     return FALSE;
   }
 
-  if (gve->priv->audio_encoder_type == AUDIO_ENCODER_MP3)
-    g_object_set (gve->priv->audio_enc, "bitrate", gve->priv->audio_bitrate, NULL);
-  else
-    g_object_set (gve->priv->audio_enc, "bitrate", 1000 * gve->priv->audio_bitrate, NULL);
-
-  GST_INFO_OBJECT(gve, "Audio encoder %s created", name);
-
   gve->priv->audio_encoder_type = type;
+  gve->priv->audio_enc = encoder;
   return TRUE;
 }
 
@@ -553,46 +470,17 @@ static gboolean
 gst_video_encoder_create_video_muxer (GstVideoEncoder * gve,
     VideoMuxerType type, GError ** err)
 {
-  gchar *name = NULL;
+  GstElement *muxer = NULL;
 
   g_return_val_if_fail (gve != NULL, FALSE);
   g_return_val_if_fail (GST_IS_VIDEO_ENCODER (gve), FALSE);
 
-  switch (type) {
-    case VIDEO_MUXER_OGG:
-      name = "OGG muxer";
-      gve->priv->muxer = gst_element_factory_make ("oggmux", "video-muxer");
-      break;
-    case VIDEO_MUXER_AVI:
-      name = "AVI muxer";
-      gve->priv->muxer = gst_element_factory_make ("avimux", "video-muxer");
-      break;
-    case VIDEO_MUXER_MATROSKA:
-      name = "Matroska muxer";
-      gve->priv->muxer =
-          gst_element_factory_make ("matroskamux", "video-muxer");
-      break;
-    case VIDEO_MUXER_MP4:
-      name = "MP4 muxer";
-      gve->priv->muxer = gst_element_factory_make ("qtmux", "video-muxer");
-      break;
-    case VIDEO_MUXER_WEBM:
-    default:
-      name = "WebM muxer";
-      gve->priv->muxer = gst_element_factory_make ("webmmux", "video-muxer");
-      break;
-  }
-
-  if (!gve->priv->muxer) {
-    g_set_error (err,
-        GVE_ERROR,
-        GST_ERROR_PLUGIN_LOAD,
-        "Failed to create the %s element. "
-        "Please check your GStreamer installation.", name);
+  muxer = lgm_create_muxer (type, GVE_ERROR, err);
+  if (!muxer) {
+    return FALSE;
   }
-
-  GST_INFO_OBJECT(gve, "Muxer %s created", name);
   gve->priv->video_muxer_type = type;
+  gve->priv->muxer = muxer;
   return TRUE;
 }
 
@@ -769,14 +657,14 @@ gst_video_encoder_dump_graph (GstVideoEncoder * gve)
 void
 gst_video_encoder_set_encoding_format (GstVideoEncoder * gve,
     VideoEncoderType video_codec, AudioEncoderType audio_codec,
-    VideoMuxerType muxer, guint video_bitrate, guint audio_bitrate,
+    VideoMuxerType muxer, guint video_quality, guint audio_quality,
     guint width, guint height, guint fps_n, guint fps_d)
 {
   gve->priv->video_encoder_type = video_codec;
   gve->priv->audio_encoder_type = audio_codec;
   gve->priv->video_muxer_type = muxer;
-  gve->priv->video_bitrate = video_bitrate;
-  gve->priv->audio_bitrate = audio_bitrate;
+  gve->priv->video_quality = video_quality;
+  gve->priv->audio_quality = audio_quality;
   gve->priv->output_width = width;
   gve->priv->output_height = height;
   gve->priv->fps_n = fps_n;
diff --git a/libcesarplayer/gst-video-encoder.h b/libcesarplayer/gst-video-encoder.h
index 04b5420..5f308ae 100644
--- a/libcesarplayer/gst-video-encoder.h
+++ b/libcesarplayer/gst-video-encoder.h
@@ -76,8 +76,8 @@ EXPORT void gst_video_encoder_set_encoding_format              (GstVideoEncoder
                                                                 VideoEncoderType video_codec,
                                                                 AudioEncoderType audio_codec,
                                                                 VideoMuxerType muxer,
-                                                                guint video_bitrate,
-                                                                guint audio_bitrate,
+                                                                guint video_quality,
+                                                                guint audio_quality,
                                                                 guint height,
                                                                 guint width,
                                                                 guint fps_n,
diff --git a/libcesarplayer/video-utils.c b/libcesarplayer/video-utils.c
index 7a37aa5..51bf771 100644
--- a/libcesarplayer/video-utils.c
+++ b/libcesarplayer/video-utils.c
@@ -432,3 +432,145 @@ lgm_discover_uri (
 
   return ret;
 }
+
+GstElement * lgm_create_video_encoder (VideoEncoderType type, guint quality,
+    GQuark quark, GError ** err)
+{
+  GstElement * encoder = NULL;
+  gchar *name = NULL;
+
+  switch (type) {
+    case VIDEO_ENCODER_MPEG4:
+      encoder = gst_element_factory_make ("ffenc_mpeg4", "video-encoder");
+      g_object_set (encoder, "pass", 2,
+          "max-key-interval", -1,
+          "quantizer", (gfloat) quality * 30 / 100, NULL);
+      name = "FFmpeg mpeg4 video encoder";
+      break;
+
+    case VIDEO_ENCODER_XVID:
+      encoder = gst_element_factory_make ("xvidenc", "video-encoder");
+      g_object_set (encoder, "pass", 3,
+          "profile", 146, "max-key-interval", -1,
+          "quantizer", quality * 31 / 100, NULL);
+      name = "Xvid video encoder";
+      break;
+
+    case VIDEO_ENCODER_H264:
+      encoder = gst_element_factory_make ("x264enc", "video-encoder");
+      g_object_set (encoder, "key-int-max", 25, "pass", 5,
+          "speed-preset", 3,
+          "quantizer", quality * 50 / 100, NULL);
+      name = "X264 video encoder";
+      break;
+
+    case VIDEO_ENCODER_THEORA:
+      encoder = gst_element_factory_make ("theoraenc", "video-encoder");
+      g_object_set (encoder, "keyframe-auto", FALSE,
+          "keyframe-force", 25,
+          "quality", quality * 63 / 100, NULL);
+      name = "Theora video encoder";
+      break;
+
+    case VIDEO_ENCODER_VP8:
+    default:
+      encoder = gst_element_factory_make ("vp8enc", "video-encoder");
+      g_object_set (encoder, "speed", 2, "threads", 8,
+          "max-keyframe-distance", 25,
+          "quality", (gdouble) quality * 10 / 100, NULL);
+      name = "VP8 video encoder";
+      break;
+
+  }
+  if (!encoder) {
+    g_set_error (err,
+        quark,
+        GST_ERROR_PLUGIN_LOAD,
+        "Failed to create the %s element. "
+        "Please check your GStreamer installation.", name);
+    return NULL;
+  }
+
+  return encoder;
+}
+
+GstElement * lgm_create_audio_encoder (AudioEncoderType type, guint quality,
+    GQuark quark, GError ** err)
+{
+  GstElement *encoder = NULL;
+  gchar *name = NULL;
+
+  switch (type) {
+    case AUDIO_ENCODER_MP3:
+      encoder = gst_element_factory_make ("lamemp3enc", "audio-encoder");
+      g_object_set (encoder, "target", 0,
+          "quality", (gfloat) quality * 10 / 100, NULL);
+      name = "Mp3 audio encoder";
+      break;
+
+    case AUDIO_ENCODER_AAC:
+      encoder = gst_element_factory_make ("faac", "audio-encoder");
+      g_object_set (encoder, "bitrate", quality *  320000 / 100, NULL);
+      name = "AAC audio encoder";
+      break;
+
+    case AUDIO_ENCODER_VORBIS:
+    default:
+      encoder = gst_element_factory_make ("vorbisenc", "audio-encoder");
+      g_object_set (encoder, "quality", (gfloat) quality / 100, NULL);
+      name = "Vorbis audio encoder";
+      break;
+  }
+
+  if (!encoder) {
+    g_set_error (err,
+        quark,
+        GST_ERROR_PLUGIN_LOAD,
+        "Failed to create the %s element. "
+        "Please check your GStreamer installation.", name);
+    return NULL;
+  }
+
+  return encoder;
+}
+
+GstElement * lgm_create_muxer (VideoMuxerType type, GQuark quark, GError **err)
+{
+  GstElement *muxer = NULL;
+  gchar *name = NULL;
+
+  switch (type) {
+    case VIDEO_MUXER_OGG:
+      name = "OGG muxer";
+      muxer = gst_element_factory_make ("oggmux", "video-muxer");
+      break;
+    case VIDEO_MUXER_AVI:
+      name = "AVI muxer";
+      muxer = gst_element_factory_make ("avimux", "video-muxer");
+      break;
+    case VIDEO_MUXER_MATROSKA:
+      name = "Matroska muxer";
+      muxer = gst_element_factory_make ("matroskamux", "video-muxer");
+      break;
+    case VIDEO_MUXER_MP4:
+      name = "MP4 muxer";
+      muxer = gst_element_factory_make ("qtmux", "video-muxer");
+      break;
+    case VIDEO_MUXER_WEBM:
+    default:
+      name = "WebM muxer";
+      muxer = gst_element_factory_make ("webmmux", "video-muxer");
+      break;
+  }
+
+  if (!muxer) {
+    g_set_error (err,
+        quark,
+        GST_ERROR_PLUGIN_LOAD,
+        "Failed to create the %s element. "
+        "Please check your GStreamer installation.", name);
+    return muxer;
+  }
+
+  return muxer;
+}
diff --git a/libcesarplayer/video-utils.h b/libcesarplayer/video-utils.h
index 3825683..b3092fd 100644
--- a/libcesarplayer/video-utils.h
+++ b/libcesarplayer/video-utils.h
@@ -39,6 +39,7 @@
 #include <gdk/gdkquartz.h>
 #endif
 #include <gtk/gtk.h>
+#include "common.h"
 
 
 #ifdef WIN32
@@ -73,3 +74,9 @@ EXPORT GstDiscovererResult lgm_discover_uri (const gchar *uri, guint64 *duration
     guint *width, guint *height, guint *fps_n, guint *fps_d, guint *par_n,
     guint *par_d, gchar **container, gchar **video_codec, gchar **audio_codec,
     GError **err);
+EXPORT GstElement * lgm_create_video_encoder (VideoEncoderType type, guint quality,
+    GQuark quark, GError **err);
+EXPORT GstElement * lgm_create_audio_encoder (AudioEncoderType type, guint quality,
+    GQuark quark, GError **err);
+EXPORT GstElement * lgm_create_muxer (VideoMuxerType type,
+    GQuark quark, GError **err);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]