Log in

View Full Version : x264 Settings for real time streaming


KAnthony
17th March 2015, 20:19
I'm writing an application to stream 1080p video encoded using x264 and live555.

Here are my current settings.

if (x264_param_default_preset(&m_pParam, "ultrafast", "zerolatency") != 0){
return false;
}
m_pParam.i_fps_num = 24;
m_pParam.i_fps_den = 1;
m_pParam.i_width = m_iWidthOut;
m_pParam.i_height = m_iHeightOut;
m_pParam.b_sliced_threads = 1;

// One keyframe per X frames:
m_pParam.i_keyint_max = 90;
m_pParam.i_threads = 1;

//Rate control:
m_pParam.rc.i_rc_method = X264_RC_CRF;
m_pParam.rc.f_rf_constant = 28;

//For streaming:
m_pParam.b_repeat_headers = 1;
m_pParam.b_annexb = 1;
m_pParam.b_intra_refresh = 1;

if (x264_param_apply_profile(&m_pParam, "main") != 0) {
return false;
}

Any help tuning my settings would be wonderful.

Right now i'm getting horrible encoder performance, a lot of missing frame information, VLC shows green frames.

fredrum
19th March 2015, 02:45
I managed to get a basic setup working by stealing from this code here,
https://github.com/oau/streamer

Works well enough for me on the local network but I am getting serious issues when I introduce small packet loss. (see my post further down)
I'm a total amateur though. :)

Cheers

EDIT: There's also bunch of source code you can peek at in various open source vnc applications, gaminganywhere and others. (Haven't tested these though)

huhn
19th March 2015, 11:40
m_pParam.i_fps_num = 24;
m_pParam.i_fps_den = 1;

most content is not 24hz it is 24000/1001