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.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th April 2016, 09:51   #1  |  Link
Johehan
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);
Does anyone know if this is the correct way or if there is anything else I need to do to properly change the bitrate on-the-fly? Or does anyone have any idea what I could test to fix this problem?
Johehan is offline   Reply With Quote
Reply

Tags
x264

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:52.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.