Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
7th April 2016, 09:51 | #1 | Link |
Registered User
Join Date: Sep 2015
Posts: 1
|
Artefacts when changing bitrate on the fly with x264
I am implementing an interactive video streaming software. The client side user can navigate a 3D scene and the server generates images, encodes them using the x264 library, and streams them back to the client. This works great and I get very low latency with the zerolatency tuning.
However, I need to adjust the bitrate on the fly to compensate for the available bandwidth changing over time and I am using x264_encoder_reconfig() to do that. This works, but sometimes when the bitrate is changed I get nasty artifacts in the video stream. This lasts only for a single frame and then it is OK again, but looks really ugly. It looks like a few horizontal strips are from different times if there is movement when this happens, and even without movement the frame will have really bad quality even if the bitrate is high. This is the code that does the actual reconfiguration: Code:
// Check if the bitrate has changed on-the-fly since last frame if(m_dynamic_bitrate_change) { m_dynamic_bitrate_change = false; x264_param_t x264_params; x264_encoder_parameters(m_encoder, &x264_params); x264_params.rc.i_bitrate = m_bitrate / 1000; x264_params.rc.i_vbv_max_bitrate = x264_params.rc.i_bitrate; x264_params.rc.i_vbv_buffer_size = (int)floor(x264_params.rc.i_vbv_max_bitrate/ (((float)m_rate_den)/m_rate_num)); x264_params.rc.i_rc_method = X264_RC_ABR; int error = x264_encoder_reconfig(m_encoder, &x264_params); } x264_encoder_encode(m_encoder, &nals, &n_nal, m_yuv_frame, &out_pic); |
Tags |
x264 |
Thread Tools | Search this Thread |
Display Modes | |
|
|