Newest 'x264' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/x264

Les articles publiés sur le site

  • latency when streaming x264

    18 novembre 2013, par tobsen

    I would like to produce a zerolatency live video stream and play it in VLC player with as little latency as possible.

    This are the settings I currently use:

    x264_param_default_preset( &m_Params, "veryfast", "zerolatency" );
    
    m_Params.i_threads              =   2;
    m_Params.b_sliced_threads       =   true;
    m_Params.i_width                =   m_SourceWidth;
    m_Params.i_height               =   m_SourceHeight;
    
    m_Params.b_intra_refresh        =   1;
    
    m_Params.b_vfr_input            =   true;
    m_Params.i_timebase_num         =   1;
    m_Params.i_timebase_den         =   1000;
    
    m_Params.i_fps_num              =   1;
    m_Params.i_fps_den              =   60;
    
    m_Params.rc.i_vbv_max_bitrate   =   512;
    m_Params.rc.i_vbv_buffer_size   =   256;
    m_Params.rc.f_vbv_buffer_init   =   1.1f;
    
    m_Params.rc.i_rc_method         =   X264_RC_CRF;
    m_Params.rc.f_rf_constant       =   24;
    m_Params.rc.f_rf_constant_max   =   35;
    
    m_Params.b_annexb               =   0;
    m_Params.b_repeat_headers       =   0;
    m_Params.b_aud                  =   0;
    
    x264_param_apply_profile( &m_Params, "high" );
    

    Using those settings, I have the following issues:

    • VLC shows lots of missing frames (see screenshot, "verloren"). I am not sure if this is an issue.
    • If I set a value <200ms for the network stream delay in VLC, VLC renders a few frames and than stops to decode/render frames.
    • If I set a value >= 200ms for the network stream delay in VLC, everything looks good so far but the latency is, obviously, 200ms, which is too high.

    Question: Which settings (x264lib and VLC) should I use in order to encode and stream with as little latency as possible?

    enter image description here

  • FFmpeg X264 multithread decoding

    16 novembre 2013, par Xin He

    I want to do H264 multithread decoding using FFmpeg. First I use X264 to encode yuv420 to file.x264 ./x264 -o file.x264 --slices 4 --input-res 1280x720 --fps 25 file_560x420.yuv

    The slices count is 4.

    However, when I use FFmpeg to decode, ./ffmpeg -y -threads 4 -thread_type slice -i file.x264 final.yuv

    FFmpeg calls func"execute_decode_slices" four times, not in a multithread way. I also found that in *execute_decode_slices(h, context_count)*, the context_count is 1. FFmpeg call this 4 times.

    Could someone help to solve this problem?

    Thanks very much!

  • Compile x264 with Thread Support for Android Platform

    10 novembre 2013, par Stryker33

    I've been tryin' to compile x264 for Android with Thread Support...But with no success...

    I've managed to compile the same without thread support...The configure command is as follows :

    ./configure --prefix=$PREFIX \
    --enable-pic \
    --host=arm-linux \
    --disable-cli \
    --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
    --sysroot=$PLATFORM 
    

    where PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86 and PLATFORM=$NDK/platforms/android-14/arch-arm

    I've also tried with and without the option --enable-static and extra-ldflags="-lpthread", but when attempted make it ends with errors.

    Is there any way to accomplish the above said...?

  • x264 parameters configuration

    5 novembre 2013, par user1558688

    I need to configure x264 to reproduce the below parameters.

    The configuration was extracted using Elecard Stream Analyzer from the first keyframe received from a legacy SIP phone h264 encoder. It is mission critical to reproduce it in software to keep compatibility with other sip clients.

    All the information I have are the parameters below.

    Is it possible at least to get close to the original ?

    Thanks a lot.

    0x00000000 H264 Sequence Parameter Set  
        profile_idc = 66 (PROFILE_IDC_Baseline)  
        constraint_set0_flag = 1  
        constraint_set1_flag = 0  
        constraint_set2_flag = 0  
        constraint_set3_flag = 0  
        constraint_set4_flag = 0  
        constraint_set5_flag = 0  
        reserved_zero_2bits = 0  
        level_idc = 12  
        seq_parameter_set_id = 4  
        log2_max_frame_num_minus4 = 4  
        pic_order_cnt_type = 2  
        num_ref_frames = 1  
        gaps_in_frame_num_value_allowed_flag = 0  
        pic_width_in_mbs_minus1 = 19 (320)  
        pic_height_in_map_units_minus1 = 14 (240)  
        frame_mbs_only_flag = 1  
        direct_8x8_inference_flag = 1  
        frame_cropping_flag = 0  
        vui_parameters_present_flag = 0  
    
    0x0000000C H264 Picture Parameter Set  
        pic_parameter_set_id = 4  
        seq_parameter_set_id = 4  
        entropy_coding_mode_flag = 0  
        pic_order_present_flag = 0  
        num_slice_groups_minus1 = 0  
        num_ref_idx_L0_active_minus1 = 0  
        num_ref_idx_L1_active_minus1 = 0  
        weighted_pred_flag = 0  
        weighted_bipred_idc = 0  
        pic_init_qp_minus26 = 2  
        pic_init_qs_minus26 = 0  
        chroma_qp_index_offset = 0  
        deblocking_filter_control_present_flag = 1  
        constrained_intra_pred_flag = 0  
        redundant_pic_cnt_present_flag = 0  
    
    0x00000014 H264 I slice #1 { frame_num = 0 }  
        first_mb_in_slice = 0  
        slice_type = 2  
        pic_parameter_set_id = 4  
        frame_num = 0  
        idr_pic_id = 4  
        dec_ref_pic_marking():  
        if(IdrPicFlag)  
            no_output_of_prior_pics_flag = 0  
            long_term_reference_flag = 0  
    slice_qp_delta = 0  
    disable_deblocking_filter_idc = 0  
        slice_alpha_c0_offset_div2 = 0  
        slice_beta_offset_div2 = 0  
    
    0x00000591 H264 I slice #1 { frame_num = 0 }  
        first_mb_in_slice = 126  
        slice_type = 2  
        pic_parameter_set_id = 4  
        frame_num = 0  
        idr_pic_id = 4  
        dec_ref_pic_marking():  
            if(IdrPicFlag)  
                no_output_of_prior_pics_flag = 0  
                long_term_reference_flag = 0  
        slice_qp_delta = 0  
        disable_deblocking_filter_idc = 0  
        slice_alpha_c0_offset_div2 = 0  
        slice_beta_offset_div2 = 0  
    
    0x00000B34 H264 I slice #1 { frame_num = 0 }  
        first_mb_in_slice = 201  
        slice_type = 2  
        pic_parameter_set_id = 4  
        frame_num = 0  
        idr_pic_id = 4  
        dec_ref_pic_marking():  
            if(IdrPicFlag)  
                no_output_of_prior_pics_flag = 0  
                long_term_reference_flag = 0  
        slice_qp_delta = 0  
        disable_deblocking_filter_idc = 0  
        slice_alpha_c0_offset_div2 = 0  
        slice_beta_offset_div2 = 0  
    
  • How do you enable "veryfast" libx264 preset from code using libavcodec ?

    3 novembre 2013, par dicroce

    I'm using libx264 via ffmpeg (in a C++ program), and I need to know how to activate the "veryfast" preset. A grep in the x264 source tree yields:

    include/x264.h:static const char * const x264_preset_names[] = { "ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo", 0 };

    Which inclines me to believe that x264 itself supports this preset as opposed to just being implemented in ffmpeg as a collection of other settings. So, the question is: How do I get ffmpeg to activate the x264 "veryfast" preset?