Trying for High Quality Multimedia playback

Hoping anyone else who has looked at this can offer his/her opinion.

For years, I’ve noticed that video wasn’t rendered as crisply in VLC as Windows Media Player, but only now because I have some low quality audio that can’t be heard using VLC and Amarok I’m now looking at how to improve multi-media playback.

My first consideration and guess was the rendering engine but some Internet babble suggests that the** codecs** are likely the issue. I now believe that both the rendering engine and codecs are related to each other in solving this issue. I also understand that VLC uses the FFMPEG backend rendering engine exclusively with a commonly available codecs pack and I understand that the other major rendering engine is gstreamer.

I believe that the main multimedia player using gstreamer is Banshee, so I’ve installed it and am testing. I’ve noticed a decided improvement playing MP3. As expected, playing a proprietary format (h.264 and WMV) requires installing codecs which can’t be packaged with the player. Trying to play h.264, to my surprise Banshee installed a shim to use FFMPEG codecs, so I’m guessing that won’t likely result in quality improvement over VLC. Playing WMV installed another codec plugin I didn’t recognize so will test.

But, I’ve also run into a possible show-stopper playing video in Banshee, I can’t find a way to scale (re-size) ! Researching a bit, it looks like a plugin has been written for video scaling but I can’t find any way to find appropriate source or package(videoscale). If it’s already part of the base plugins, it should already exist in the openSUSE default install but not exposed either by GUI or CLI(in the sparse documentation I’ve found).

In any case, I noticed that there are Fluendo codecs available in the openSUSE repos, I’ve installed the packages but I can’t find a way to configure Banshee to use specific codecs… Both in the GUI or from a CLI.

If anyone else has an opinion both on how to play multi-media with better quality or know how to address the Banshee issues I’ve desribed, TIA.

TS

So, multimedia, from a codec standpoint, is most likely controlled by the media programs we get from the Packman repository though we do get them from the basic installed files as well. Just how one might get a better codec would be a question I would pose to RedDwarf I think. I have a script (MMCHECK)](http://forums.opensuse.org/forums/blogs/jdmcdaniel3/mmcheck-version-2-35-check-your-multimedia-16-steps-bash-script-file-36/) intended to help get the basic multimedia setup installed and there are Articles (multi-media-restricted-format-installation-guide)](http://forums.opensuse.org/content/107-re-multi-media-restricted-format-installation-guide.html) on how best to do so. There are guides on how best to configure your sound setup (Pulseaudio Basics for openSUSE with pavucontrol).](http://forums.opensuse.org/blogs/oldcpu/pulseaudio-basics-opensuse-pavucontrol-96/) There is help in testing your audio setup (S.T.A.R.T.). But beyond these examples, you got to think that Audio quality is determined, for playback, by your sound card chip set. Same goes for video, based on the GPU chipset you use and the drivers that can be installed, either open source or proprietary. I have had good luck using nVIDIA for video playback and loading their driver and with Creative audio and the openSUSE drivers included in the kernel. Further, I have had terrible audio playback with some Realtek audio chipsets and less than satisfying video from some Intel graphic chipsets. Of course, everyone seems to have a stinker or two in their closet it would seem, but you have got to consider the hardware in any audio/video quality comparison.

Thank You,

H.264 decoding is bit-exact by specification, so forget about the decoder (but you can use ffdshow in Windows to compare if you think the decoder is buggy). After that you can have some extra filters, the color-space conversion and the resizing. That’s it.
You shouldn’t have any extra filters and the resizing is not there if you compare the output without going to full screen or resizing the window. If the difference is only in full screen your problem is with resizing, otherwise with the color-space conversion.

If you want to test raw gstreamer use gst-launch.

Make them output the raw samples to a file so we can compare. You can do that with both VLC and gst-launch.

Why don’t you try? By the way, the only (free) H.264 decoder in Linux is ffmpeg. Unless you paid for the Fluendo decoder you are always going to use ffmpeg/libav.

Again, the only (free) WMV decoder in Linux is ffmpeg.

Use gst-launch to specify exactly what decoders do you want to use.

Raw samples so we can see what the problems are would be the first step.

An update and response to my original post on this topic,

Thx Red Dwarf for the excellent information.

I was actually posting about two separate issues, audio only (MP3) and video thinking they might be related if the problem was simply a matter of codecs. I now believe as Red Dwarf opined that the problem at least for video is not likely a codec issue, it’s more accurately a problem of the interpolation methods used when viewing the video not at its compiled resolution.

As for the MP3 issue, it’s really hard to quantitively analyze an issue that likely is more of a subjective issue. It could be my imagination, or it could be something specific to something few can discern, but I would swear that the problem audio file was slightly clearer using the gstream codecs in Banshee.

Regardless exactly where the fault might be, I doubt that there are many options for an end user to explore for improvement… so for example I don’t see any alternatives to how video is now viewed at non-default resolution. I don’t know if there are many runtime options for MP3 playback beyond the usual mixer controls that can enhance various frequencies.

In any case, this is the first time in many years that I felt I really needed to explore “a better solution” than what was already available by default.

As for Fluendo, I’ve found documentation that some codecs were given to the public domain early on, but later development has all centered on proprietary. I suspect that the Fluendo codecs available in openSUSE are the “free” codecs.

Thx,
TS

For the MP3 you can use gst-launch to check with the different mp3 decoders (mad, ffmpeg or fluendo).
To check video scaling algorithm MPlayer probably is the easiest way. You can use different video outputs (gl, different xv adaptors, etc.) to try to make the graphic card use different filters (the graphic card can have its own options) or use software filters (-sws). And check about filters (-vf).

If you are willing to explore the ladspa libraries and do a little configuration with your .asoundrc file you can achieve music and sound playback that rivals the effects processing on an xfi in Windows. I have a 5.1 surround system with playback that handles bass-redirection to the subwoofer, as well as sending reverb effects to the rear speakers. You can set up different environments for listening to music, watching movies, etc., all tailored to your preferences. You won’t get fancy graphical effects editors but I find these to be largely unnecessary, since once the effects are set I generally don’t change them.

If there are no secrets to be seen, what are the chances you might show us your .asoundrc entries? You can post it here in a code # block and the advanced message editor or use SUSE Paste and give us a link. It would be appreciated.

Thank You,

To preface all this, this approach assumes that PulseAudio has been deactivated. Pulse does work with certain ladspa plugins, but I don’t think it works with reverb (or any plugin that has two-channels-in and two-channels-out). I might be wrong, and if I am I am always happy to learn…

OK, here goes. Here is my .asoundrc file:


pcm.music {
  type plug
  slave.pcm ladspa
  slave.channels 8
  slave.format float
  ttable {
    0.0 1
    1.1 1
    2.2 1
    3.3 1
    4.4 1
    5.5 1
    0.5 0.5
    1.5 0.5
    0.6 1
    1.6 0.20
    0.7 0.20
    1.7 1
    } 
  hint {
    show on
    description "Music"
    }
  }


pcm.ladspa {
  type ladspa
  slave.pcm plug:remix
  channels 8
  path "/usr/lib64/ladspa"
  plugins {
    
    0 {
      id 1098
      policy duplicate                                                                      
      input.bindings.0 "Input";                                                             
      output.bindings.0 "Output";                                                           
      }                                                                                     
                                                                                            
    1 {                                                                                     
      id 2142                                                                               
      policy none                                                                           
      input.bindings.0 "Input Left";                                                        
      input.bindings.1 "Input Right";                                                       
      output.bindings.0 "Output Left";                                                      
      output.bindings.1 "Output Right";                                                     
      input {                                                                               
        controls [2500 0 -25 1 1 1 1 10]                                                    
        }                                                                                   
      }                                                                                     
                                                                                            
    2 {                                                                                     
      id 2142                                                                               
      policy none                                                                           
      input.bindings.6 "Input Left";                                                        
      input.bindings.7 "Input Right";                                                       
      output.bindings.6 "Output Left";
      output.bindings.7 "Output Right";
      input {
        controls [3000 -70 -14 1 1 1 1 10]
        }
      }

    }
  }

pcm.remix {
  type route
  slave.pcm surround51
  slave.channels 8
  ttable {
    0.0 1
    1.1 1
    2.2 1
    3.3 1
    4.4 1
    5.5 1
    6.2 1
    7.3 1
    }
  }


pcm.video {
  type plug
  slave.pcm surround51
  slave.channels 6
  ttable {
    0.0 1
    1.1 1
    2.2 1
    3.3 1
    4.4 1
    5.5 1
    0.5 0.50
    1.5 0.50
    }
  hint {
    show on
    description "Video"
    }
  }

pcm.skype {
  type plug
  slave.pcm surround50
  slave.channels 5
  ttable {
    0.0 1
    1.1 1
    2.2 1
    3.3 1
    0.4 0.5
    1.4 0.5
    }
  hint {
    show on
    description "Skype"
    }
  }


pcm.vmware {
  type route
  slave.pcm surround51
  slave.channels 6
  ttable {
    0.0 1
    1.1 1
    4.2 1
    3.5 1
    2.4 1
    5.3 1
    }
  }

pcm.!default {
  type upmix
  slave.pcm surround51
  channels 6
  }


pcm.headphones
{
  type plug
  slave.pcm b2bs
  slave.channels 2
  ttable
  {
    0.0 1
    1.1 1
    2.0 1
    3.1 1
    4.0 0.5
    4.1 0.5
    5.0 1
    5.1 1
  }
  hint
  {
    show on
    description "Headphones"
  }
}

pcm.b2bs
{
  type ladspa
  slave.pcm plug:front
  channels 2
  path "/usr/lib64/ladspa"
  plugins
  {
   0
    {
      id 4221
      policy none
      input.bindings.0 "Input left";
      input.bindings.1 "Input right";
      output.bindings.0 "Output left";
      output.bindings.1 "Output right";
      input
      {
        controls  300 4.5]
      }
    }   
  }
}

Much of this can be made clear by reading the help file “/usr/share/doc/packages/alsa/alsa-lib/asoundrc.txt”.

Each module has a name (e.g., “music”) which can be specified by playback programs that allow you to do so (most do). Some programs such as Amarok use the module that is placed at the top of the list for “Music” in the phonon control panel. I have never been able to find out how or why certain programs do this. To play file “foo.mp3” with mplayer, for instance, you would invoke

mplayer -ao alsa:device=music -channels 6 foo.mp3

The module “music” is defined as a type “plug”, one purpose of which is to enable output in floating point format which seems to be all that a ladspa plugin will accept. The “ttable section” contains the way that input channels are routed to output channels. You will see that I defined eight channels instead of six which would correspond to my physical setup (5.1). This will become clearer when I look at the ladspa section. At any rate, what is going on here is to route all 6 input channels to their corresponding output channels at full volume, and then to mix Left Front into the subwoofer at 0.5 volume and Right Front into the subwoofer at 0.5 volume. The next four lines mix the front channels into the “dummy” channels 6 and 7 for use by the ladspa plugin.

The block

  hint {
    show on
    description "Music"
    }

causes the module to show in the list of Outputs in the phonon configuration panel with the name “Music”.

Now on to ladspa. You will need to install the package “ladspa” which contains the plugin for reverb as well as numerous other plugins for signal processing. The context for the ladspa module differs slightly from other alsa pcm’s (“channels 8” rather than “slave.channels 8” for instance). In addition you need to put in the ladspa path explicitly ( 32-bit systems will use “/usr/lib/ladspa” ).

The section which is labeled “plugins” lists, obviously, all the plugins for effects that will be used. It operates as a chain, each plugin passing on its output to the next according to its number, not necessarily its position in the chain.
The first plugin in any ladspa chain needs to be

    0 {
      id 1098
      policy duplicate                                                                      
      input.bindings.0 "Input";                                                             
      output.bindings.0 "Output";                                                           
      }                                                                    

This is the so-called “identity” plugin and basically gets the entire sound input into the ladspa section. Since it is ladspa which will be outputting to the next section, everything needs to be in there, even if unaltered by subsequent plugins.

The next section is where the reverb actually takes place. The plugin

     1 {                                                                                     
      id 2142                                                                               
      policy none                                                                           
      input.bindings.0 "Input Left";                                                        
      input.bindings.1 "Input Right";                                                       
      output.bindings.0 "Output Left";                                                      
      output.bindings.1 "Output Right";                                                     
      input {                                                                               
        controls [2500 0 -25 1 1 1 1 10]                                                    
        }                                                                                   
      } 

takes the inputs from the Left Front and Right Front channels, adds a slight amount of reverb and then copies it back to the outputs for the left and right front channels. The section “controls” determines how this happens.

To see how the plugin for reverb (2142) works, first export your ladspa path:

export LADSPA_PATH=/usr/lib64/ladspa

and then issue

analyseplugin tap_reverb

What you should get is the following:

steve@linux-fm1d:~> analyseplugin tap_reverb                                                
                                                                                            
Plugin Name: "TAP Reverberator"                                                             
Plugin Label: "tap_reverb"                                                                  
Plugin Unique ID: 2142                                                                      
Maker: "Tom Szilagyi"                                                                       
Copyright: "GPL"                                                                            
Must Run Real-Time: No                                                                      
Has activate() Function: Yes                                                                
Has deactivate() Function: No                                                               
Has run_adding() Function: Yes                                                              
Environment: Normal                                                                         
Ports:  "Decay [ms]" input, control, 0 to 10000, default 2500                               
        "Dry Level [dB]" input, control, -70 to 10, default 0                               
        "Wet Level [dB]" input, control, -70 to 10, default 0                               
        "Comb Filters" input, control, toggled, default 1                                   
        "Allpass Filters" input, control, toggled, default 1                                
        "Bandpass Filter" input, control, toggled, default 1                                
        "Enhanced Stereo" input, control, toggled, default 1                                
        "Reverb Type" input, control, 0 to 42.1, default 0, integer                         
        "Input Left" input, audio                                                           
        "Output Left" output, audio
        "Input Right" input, audio
        "Output Right" output, audio

The numbers after the effect types are what go into the “controls” bracket of the plugin.

 controls [2500 0 -25 1 1 1 1 10] 

Thus, for the front channel reverb, I have it set to the default decay (2500), dry level of 0 (“dry level” refers to the original unprocessed signal, “0” meaning unchanged volume), wet level (amount of reverb) of -25 (for a subtle effect in the front channels), and then some filter settings, and then “Reverb Type” (basically room size) set to 10.

The rear channels are where the dummy channels are used. I decided that for a stereo source I did not want any of the front channel signal coming from the rear channels, but only reverb effects. I also had to make so that for real 5.1 sources the rear channel signals would go unchanged into the rear channels. I thus took channels 6 and 7 (containing copies of the original front left and front right channels) and made pure reverb channels from them.

    2 {                                                                                     
      id 2142                                                                               
      policy none                                                                           
      input.bindings.6 "Input Left";                                                        
      input.bindings.7 "Input Right";                                                       
      output.bindings.6 "Output Left";
      output.bindings.7 "Output Right";
      input {
        controls [3000 -70 -14 1 1 1 1 10]
        }
      }

Thus, using the same plugin (id 2142 which is the reverb plugin) I set it to a somewhat higher decay and then set the “dry level” to -70, for which there is NO original front signal being output. Thus the only thing coming from channels 6 and 7 is pure reverb.

Ladspa is thus finished and passes its output to the module “remix”. Why it needs this context (“slave.pcm plug:remix” instead of just “slave.pcm remix”) I don’t know but after much trial and error it seems to be the only context that works. Anyway the module remix does the final mixing. It copies each of the original input channels to its appropriate output channel (along with the redirected bass from the first module “music”) and then adds channels 6 and 7, containing only the reverb processed signal from the front speakers, into the rear speakers. The whole thing is then sent to “surround51” which is the default alsa 5.1 device.

All the numerical values have been adjusted for my room size and my listening preference. You will probably arrive at something different.

There are various other modules in the .asoundrc file. I did one for video sources to get true 5.1 bass-redirected output but with no other processing (who wants reverb in a movie soundtrack?) The module “vmware” corrects that fact the channels from Windows are routed incorrectly for Linux, and redirects them accordingly. There is a special “Headphones” module which uses another ladspa plugin for HRTF output.

Any module whose name starts with “!” becomes the default module. I thus put in a module (pcm.!default) which uses the “upmix” output supplied by alsa. You can read about this in “/usr/share/doc/packages/alsa-plugins/upmix.txt”. With this flash playback will be upmixed in a standard 2.0->5.1 manner.

So to sum up, it works for me. If it doesn’t for you, make sure you have ladspa installed, and remember that any syntax error in .asoundrc will grind the whole thing to a halt.

**evetsnameloc **thanks so much for your very extensive post. I have made a copy and will take time this weekend to analyze the information.

Thank You,