Tune the Wowza encoder GraphQL API for performance

The Wowza™ encoder GraphQL API enables you to manage your Wowza hardware encoders and broadcasts directly via the API. GraphQL APIs are structured so that the operations mirror the responses. We recommend using the GraphiQL app, an interactive, browser-based IDE for exploring and using GraphQL APIs.

This article describes the encoding settings we recommend for best performance based on your desired output.

Note: These recommendations were produced based on testing with Wowza ClearCaster version 1.0.5.17.

Tune performance for 1080p streams


1080p30 single-bitrate

The following example query has the recommended audio and video encoding settings for a single-bitrate source stream at 1080p and 30 frames per second (fps).

mutation createBroadcastOutput {
  createBroadcastOutput(
    broadcastId: "yourBroadcastId", 
    input: {
        streamName: "myStream_1080p30", 
        encodingConfiguration: {name: "1080p", 
            encodingConfigurationVideo: {
                codec: "H.264", 
                implementation: "x264", 
                gpuid: -1, 
                frameSizeFitMode: "stretch", 
                frameSizeWidth: 1920, 
                frameSizeHeight: 1080, 
                profile: "main", 
                bitrate: 8000000, 
                bitrateMin: 2000000,
                autoAdjustBitrate: true,
                keyFrameIntervalFollowSource: true, 
                keyFrameInterval: 30}, 
            encodingConfigurationAudio: {
                codec: "aac", 
                bitrate: 96000, 
                resampleEnable: false, 
                resampleSampleRate: 48000, 
                resampleChannels: 2, 
                resampleChannelMaskSource: 0, 
                resampleChannelMaskDestination: 0}}}) 
    {
    id
    streamName
    encodingConfiguration {
      name
      encodingConfigurationVideo {
    id
        codec
        implementation
        bitrate
      }
      encodingConfigurationAudio {
    id
        codec
        bitrate
      }
    }
  }
}

Then, use the returned encodingConfigurationVideoId to configure the following transcoder parameters with the recommended values.

mutation setEncodingConfigurationVideoTranscoderParameterPreset {
  setEncodingConfigurationVideoTranscoderParameter(
    encodingConfigurationVideoId: "yourEncodingConfigurationVideoId", input: {
		name: "x264.preset",
		value: "4",
		type: "Long"
		}) 
	{
	id
        codec
        implementation
        bitrate
		parameters {
			name
			value
			type
		}
	}
}

mutation setEncodingConfigurationVideoTranscoderParameterPreset {
  setEncodingConfigurationVideoTranscoderParameter(
    encodingConfigurationVideoId: "yourEncodingConfigurationVideoId", input: {
		name: "x264.bframes",
		value: "1",
		type: "Long"
		}) 
	{
	id
        codec
        implementation
        bitrate
		parameters {
			name
			value
			type
		}
	}
}

mutation setEncodingConfigurationVideoTranscoderParameterPreset {
  setEncodingConfigurationVideoTranscoderParameter(
    encodingConfigurationVideoId: "yourEncodingConfigurationVideoId", input: {
		name: "x264.ref",
		value: "1",
		type: "Long"
		}) 
	{
	id
        codec
        implementation
        bitrate
		parameters {
			name
			value
			type
		}
	}
}

1080p60 single-bitrate

The following example query has the recommended audio and video encoding settings for a single-bitrate source stream at 1080p and 60 fps.

mutation createBroadcastOutput {
  createBroadcastOutput(
    broadcastId: "yourBroadcastId", 
    input: {
        streamName: "myStream_1080p60", 
        encodingConfiguration: {name: "1080p", 
            encodingConfigurationVideo: {
                codec: "H.264", 
                implementation: "x264", 
                gpuid: -1, 
                frameSizeFitMode: "stretch", 
                frameSizeWidth: 1920, 
                frameSizeHeight: 1080, 
                profile: "main", 
                bitrate: 14000000, 
                bitrateMin: 2000000,
                autoAdjustBitrate: true,
                keyFrameIntervalFollowSource: true, 
                keyFrameInterval: 60}, 
            encodingConfigurationAudio: {
                codec: "aac", 
                bitrate: 96000, 
                resampleEnable: false, 
                resampleSampleRate: 48000, 
                resampleChannels: 2, 
                resampleChannelMaskSource: 0, 
                resampleChannelMaskDestination: 0}}}) 
    {
    id
    streamName
    encodingConfiguration {
      name
      encodingConfigurationVideo {
    id
        codec
        implementation
        bitrate
      }
      encodingConfigurationAudio {
    id
        codec
        bitrate
      }
    }
  }
}

Then, use the returned encodingConfigurationVideoId to configure the following transcoder parameters with the recommended values.

mutation setEncodingConfigurationVideoTranscoderParameterPreset {
  setEncodingConfigurationVideoTranscoderParameter(
    encodingConfigurationVideoId: "yourEncodingConfigurationVideoId", input: {
		name: "x264.preset",
		value: "3",
		type: "Long"
		}) 
	{
	id
        codec
        implementation
        bitrate
		parameters {
			name
			value
			type
		}
	}
}

mutation setEncodingConfigurationVideoTranscoderParameterPreset {
  setEncodingConfigurationVideoTranscoderParameter(
    encodingConfigurationVideoId: "yourEncodingConfigurationVideoId", input: {
		name: "x264.bframes",
		value: "1",
		type: "Long"
		}) 
	{
	id
        codec
        implementation
        bitrate
		parameters {
			name
			value
			type
		}
	}
}

mutation setEncodingConfigurationVideoTranscoderParameterPreset {
  setEncodingConfigurationVideoTranscoderParameter(
    encodingConfigurationVideoId: "yourEncodingConfigurationVideoId", input: {
		name: "x264.ref",
		value: "1",
		type: "Long"
		}) 
	{
	id
        codec
        implementation
        bitrate
		parameters {
			name
			value
			type
		}
	}
}

1080p30 multi-bitrate

The following example query has the recommended audio and video encoding settings for a multi-bitrate source stream at 1080p and 30 fps with, for example, 720p, 540p, and 360p renditions.

mutation createBroadcastOutput {
  createBroadcastOutput(
    broadcastId: "yourBroadcastId", 
    input: {
        streamName: "myStream_1080p", 
        encodingConfiguration: {name: "1080p", 
            encodingConfigurationVideo: {
                codec: "H.264", 
                implementation: "QuickSync", 
                gpuid: -1, 
                frameSizeFitMode: "stretch", 
                frameSizeWidth: 1920, 
                frameSizeHeight: 1080, 
                profile: "main", 
                bitrate: 8000000, 
                bitrateMin: 2000000,
                autoAdjustBitrate: true,
                keyFrameIntervalFollowSource: true, 
                keyFrameInterval: 30}, 
            encodingConfigurationAudio: {
                codec: "aac", 
                bitrate: 96000, 
                resampleEnable: false, 
                resampleSampleRate: 48000, 
                resampleChannels: 2, 
                resampleChannelMaskSource: 0, 
                resampleChannelMaskDestination: 0}}}) 
    {
    id
    streamName
    encodingConfiguration {
      name
      encodingConfigurationVideo {
    id
        codec
        implementation
        bitrate
      }
      encodingConfigurationAudio {
    id
        codec
        bitrate
      }
    }
  }
}

mutation createBroadcastOutput {
  createBroadcastOutput(
    broadcastId: "yourBroadcastId", 
    input: {
        streamName: "myStream_720p", 
        encodingConfiguration: {name: "720p", 
            encodingConfigurationVideo: {
                codec: "H.264", 
                implementation: "QuickSync", 
                gpuid: -1, 
                frameSizeFitMode: "stretch", 
                frameSizeWidth: 1280, 
                frameSizeHeight: 720, 
                profile: "main", 
                bitrate: 3600000, 
                bitrateMin: 900000,
                autoAdjustBitrate: true,
                keyFrameIntervalFollowSource: true, 
                keyFrameInterval: 30}, 
            encodingConfigurationAudio: {
                codec: "aac", 
                bitrate: 96000, 
                resampleEnable: false, 
                resampleSampleRate: 48000, 
                resampleChannels: 2, 
                resampleChannelMaskSource: 0, 
                resampleChannelMaskDestination: 0}}}) 
    {
    id
    streamName
    encodingConfiguration {
      name
      encodingConfigurationVideo {
    id
        codec
        implementation
        bitrate
      }
      encodingConfigurationAudio {
    id
        codec
        bitrate
      }
    }
  }
}

mutation createBroadcastOutput {
  createBroadcastOutput(
    broadcastId: "yourBroadcastId", 
    input: {
        streamName: "myStream_540p", 
        encodingConfiguration: {name: "540p", 
            encodingConfigurationVideo: {
                codec: "H.264", 
                implementation: "x264", 
                gpuid: -1, 
                frameSizeFitMode: "stretch", 
                frameSizeWidth: 960, 
                frameSizeHeight: 540, 
                profile: "main", 
                bitrate: 2000000, 
                bitrateMin: 500000,
                autoAdjustBitrate: true,
                keyFrameIntervalFollowSource: true, 
                keyFrameInterval: 30}, 
            encodingConfigurationAudio: {
                codec: "aac", 
                bitrate: 96000, 
                resampleEnable: false, 
                resampleSampleRate: 48000, 
                resampleChannels: 2, 
                resampleChannelMaskSource: 0, 
                resampleChannelMaskDestination: 0}}}) 
    {
    id
    streamName
    encodingConfiguration {
      name
      encodingConfigurationVideo {
    id
        codec
        implementation
        bitrate
      }
      encodingConfigurationAudio {
    id
        codec
        bitrate
      }
    }
  }
}

mutation createBroadcastOutput {
  createBroadcastOutput(
    broadcastId: "yourBroadcastId", 
    input: {
        streamName: "myStream_360p", 
        encodingConfiguration: {name: "360p", 
            encodingConfigurationVideo: {
                codec: "H.264", 
                implementation: "x264", 
                gpuid: -1, 
                frameSizeFitMode: "stretch", 
                frameSizeWidth: 640, 
                frameSizeHeight: 360, 
                profile: "main", 
                bitrate: 960000, 
                bitrateMin: 240000,
                autoAdjustBitrate: true,
                keyFrameIntervalFollowSource: true, 
                keyFrameInterval: 30}, 
            encodingConfigurationAudio: {
                codec: "aac", 
                bitrate: 96000, 
                resampleEnable: false, 
                resampleSampleRate: 48000, 
                resampleChannels: 2, 
                resampleChannelMaskSource: 0, 
                resampleChannelMaskDestination: 0}}}) 
    {
    id
    streamName
    encodingConfiguration {
      name
      encodingConfigurationVideo {
    id
        codec
        implementation
        bitrate
      }
      encodingConfigurationAudio {
    id
        codec
        bitrate
      }
    }
  }
}

Then, use the encodingConfigurationVideoId returned for each broadcast output to configure the transcoder parameters that correspond to the specified implementation value for the broadcast output.

  • 1080p and 720p
    mutation setEncodingConfigurationVideoTranscoderParameterPreset {
      setEncodingConfigurationVideoTranscoderParameter(
        encodingConfigurationVideoId: "yourEncodingConfigurationVideoId", input: {
    		name: "quicksync.TargetUsage",
    		value: "1",
    		type: "Long"
    		}) 
    	{
    	id
            codec
            implementation
            bitrate
    		parameters {
    			name
    			value
    			type
    		}
    	}
    }
  • 540p and 360p
    mutation setEncodingConfigurationVideoTranscoderParameterPreset {
      setEncodingConfigurationVideoTranscoderParameter(
        encodingConfigurationVideoId: "yourEncodingConfigurationVideoId", input: {
    		name: "x264.preset",
    		value: "4",
    		type: "Long"
    		}) 
    	{
    	id
            codec
            implementation
            bitrate
    		parameters {
    			name
    			value
    			type
    		}
    	}
    }
    
    mutation setEncodingConfigurationVideoTranscoderParameterPreset {
      setEncodingConfigurationVideoTranscoderParameter(
        encodingConfigurationVideoId: "yourEncodingConfigurationVideoId", input: {
    		name: "x264.bframes",
    		value: "0",
    		type: "Long"
    		}) 
    	{
    	id
            codec
            implementation
            bitrate
    		parameters {
    			name
    			value
    			type
    		}
    	}
    }
    
    mutation setEncodingConfigurationVideoTranscoderParameterPreset {
      setEncodingConfigurationVideoTranscoderParameter(
        encodingConfigurationVideoId: "yourEncodingConfigurationVideoId", input: {
    		name: "x264.ref",
    		value: "1",
    		type: "Long"
    		}) 
    	{
    	id
            codec
            implementation
            bitrate
    		parameters {
    			name
    			value
    			type
    		}
    	}
    }

Tune performance for 4K streams


4K 30 fps single-bitrate stream

The following example query has the recommended audio and video encoding settings for a single-bitrate source stream at 4K and 30 fps.

mutation createBroadcastOutput {
  createBroadcastOutput(
    broadcastId: "yourBroadcastId", 
    input: {
		streamName: "myStream_2160p", 
		encodingConfiguration: {name: "2160p", 
			encodingConfigurationVideo: {
				codec: "H.264", 
				implementation: "QuickSync", 
				gpuid: -1, 
				frameSizeFitMode: "stretch", 
				frameSizeWidth: 3840, 
				frameSizeHeight: 2160, 
				profile: "main", 
				bitrate: 30000000, 
				bitrateMin: 7500000,
				autoAdjustBitrate: true,
				keyFrameIntervalFollowSource: true, 
				keyFrameInterval: 30}, 
			encodingConfigurationAudio: {
				codec: "aac", 
				bitrate: 96000, 
				resampleEnable: false, 
				resampleSampleRate: 48000, 
				resampleChannels: 2, 
				resampleChannelMaskSource: 0, 
				resampleChannelMaskDestination: 0}}}) 
	{
    id
    streamName
    encodingConfiguration {
      name
      encodingConfigurationVideo {
	id
        codec
        implementation
        bitrate
      }
      encodingConfigurationAudio {
	id
        codec
        bitrate
      }
    }
  }
}

Then, use the returned encodingConfigurationVideoId to configure the following transcoder parameter.

mutation setEncodingConfigurationVideoTranscoderParameterPreset {
  setEncodingConfigurationVideoTranscoderParameter(
    encodingConfigurationVideoId: "yourEncodingConfigurationVideoId", input: {
		name: "quicksync.TargetUsage",
		value: "1",
		type: "Long"
		}) 
	{
	id
        codec
        implementation
        bitrate
		parameters {
			name
			value
			type
		}
	}
}

More resources