Transcoding allows you to convert one type of file to another. Ampache supports on the fly transcoding of all file types based on user, IP address or available bandwidth.
You will need to enable and configure transcoding in the config file before it will work.
;###################################################### ; These are commands used to transcode non-streaming ; formats to the target file type for streaming. ; This can be useful in re-encoding file types that don't stream ; very well, or if your player doesn't support some file types. ; This is also the string used when 'downsampling' is selected ; REQUIRED variables ; transcode_TYPE = true/false ## True to force transcode regardless of prefs ; transcode_TYPE_target = TARGET_FILE_TYPE ; transcode_cmd_TYPE = TRANSCODE_COMMAND ; %FILE% = filename ; %OFFSET% = offset ; %SAMPLE% = sample rate ; %EOF% = end of file in min.sec ; List of filetypes to transcode transcode_m4a = true transcode_m4a_target = mp3
; These are the commands that will be run to transcode the file transcode_cmd_m4a = "faad -f 2 -w %FILE% | lame -r -b %SAMPLE% -S - -"
Above is the default configuration for m4a files. You can add additional files types, following the above pattern. Once you have configured the behavior in your config file the behavior is defined by the per user setting Transcoding.
You can also force transcoding based on the IP address of the user streaming. This allows you to automatically downsample and transcode music if the user is off of your local network. To enable this you first need to define a Local Network ACL and then enable downsample_remote in the ampache.cfg.php
; Downsample Remote ; If this is set to true and access control is on any users who are not ; coming from a defined 'network' ACL will be automatically downsampled ; regardless of their preferences. ; DEFAULT: false ;downsample_remote = "false"
The below example config would cause anyone whos IP is not 10.x.x.x to have their streams transcoded according to the transcode rules in the config file
Config Variables
downsample_remote = "true" access_control = "true"
ACL Interface Access for Clients
| User | Type | Start | End | Key | Level | ||||||
| All | Interface | 0.0.0.0 | 255.255.255.255 | All |
This first ACL will let us continue to login after we've enabled the Access Control in the config file, next we need to allow streaming from our clients.
ACL Streaming Access for Clients
| User | Type | Start | End | Key | Level | ||||||
| All | Streaming | 0.0.0.0 | 255.255.255.255 | All |
Last we'll need to define what is our local network so that Ampache knows when it needs to transcode
ACL Local Network Deinfition
| User | Type | Start | End | Key | Level | ||||||
| All | Network | 10.0.0.0 | 10.255.255.255 | All |
This will make is so that a client connecting from 192.168.0.32 would be considered Non-Local and would be forced to use any configured transcoding. A client coming from 10.0.32.12 would be considered local and would not be transcoded. You can have as many network ACL definitions as you want