Newest 'x264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Does x264 support multicore encoding on ARM ?

    26 septembre 2013, par Lev

    I'm trying to get x264 encoder to use multiple CPU cores.
    I'm changing i_threads value in the x264_param_t structure. I've tried to set it to different values from 1 to 6 and I don't see any change in performance.

    I'm using https://github.com/halfninja/android-ffmpeg-x264 project with these flags:
    ./configure --cross-prefix=arm-linux-androideabi- --enable-pic --host=arm-linux

    Is multithreaded encoding supported on ARM? Will it give me significant boost in performance on a 4 core CPU?

  • AVCodecContext settings for H264 (1080i)

    23 septembre 2013, par moose

    I'm trying to configure x264 for 1080i capturing. Most of these settings below are found in different examples. However, compiled together they don't work. ffmpeg API reports no error, but avcodec_encode_video() always returns zero.

    Some of the numbers are strange to me... for example, gop_size. Isn't 250 too high?

    Event you can't offer the final answer, I'm still interested in any kind of comment on this subject.

    pCodecContext->codec_type              = AVMEDIA_TYPE_VIDEO;
    pCodecContext->codec_id                = CODEC_ID_H264;
    
    pCodecContext->coder_type              = FF_CODER_TYPE_AC;
    pCodecContext->flags                  |= CODEC_FLAG_LOOP_FILTER | CODEC_FLAG_INTERLACED_ME | CODEC_FLAG_INTERLACED_DCT;
    pCodecContext->me_cmp                 |= 1;
    pCodecContext->partitions             |= X264_PART_I8X8 | X264_PART_I4X4 | X264_PART_P8X8 | X264_PART_B8X8;
    pCodecContext->me_method               = ME_UMH;
    pCodecContext->me_subpel_quality       = 8;
    pCodecContext->me_range                = 16;
    
    pCodecContext->bit_rate                = 10 * 1024 * 1024; // 10 Mbps??
    pCodecContext->width                   = 1920;
    pCodecContext->height                  = 1080;
    
    pCodecContext->time_base.num           = 1;    // 25 fps
    pCodecContext->time_base.den           = 25;   // 25 fps
    
    pCodecContext->gop_size                = 250; // 250
    pCodecContext->keyint_min              = 25;
    pCodecContext->scenechange_threshold   = 40;
    pCodecContext->i_quant_factor          = 0.71f;
    pCodecContext->b_frame_strategy        = 1;
    pCodecContext->qcompress               = 0.6f;
    pCodecContext->qmin                    = 10;
    pCodecContext->qmax                    = 51;
    pCodecContext->max_qdiff               = 4;
    pCodecContext->max_b_frames            = 3;
    pCodecContext->refs                    = 4;
    pCodecContext->directpred              = 3;
    pCodecContext->trellis                 = 1;
    pCodecContext->flags2                 |= CODEC_FLAG2_WPRED | CODEC_FLAG2_MIXED_REFS | CODEC_FLAG2_8X8DCT | CODEC_FLAG2_FASTPSKIP;  // wpred+mixed_refs+dct8x8+fastpskip
    pCodecContext->weighted_p_pred         = 2; // not implemented with interlaced ??
    pCodecContext->crf                     = 22;
    
    pCodecContext->pix_fmt                 = PIX_FMT_YUV420P;
    
    pCodecContext->thread_count            = 0;
    
  • x264 rate control modes

    19 septembre 2013, par xkfz007

    Recently I am reading the x264 source codes. Mostly, I concern the RC part. And I am confused about the parameters --bitrate and --vbv-maxrate. When bitrate is set, the CBR mode is used in frame level. If you want to start the MB level RC, the parameters bitrate, vbv-maxrate and vbv-bufsize should be set. But I don't know the relationship between bitrate and vbv-maxrate. What is the criterion of the real encoding result when bitrate and vbv-maxrate are both set? And what is the recommended value for bitrate? Equals to vbv-maxrate? Also what is the recommended value for vbv-bufsize? Half of vbv-maxrate? Please give me some advice.

  • H264 steganography : Step by step compression code/library

    16 septembre 2013, par user1960810

    I have an algorithm for steganography on h264 (AVC). But I am unable to find a library or equations for H264 compression. The steps are DCT-> Quantization-> Entropy encode**. Can anyone provide me the step by step compression code or equations for these steps? The intention is to manipulate the LSBs after the entropy encoding step. I am using EmguCV and C# for my project. I am also using FFMpeg. I have a very little knowledge on C and C++.

  • Linphone OSx msx264 encryption VGA takes 97% CPU, why ?

    11 septembre 2013, par Maxim Shoustin

    I have problem and today don't know how to fix it or even from where to start.

    I have Linphone application that uses msx264 plugin.

    All stuff I run on OSx and my ffmpeg version installed from port , I didn't using selfupdate for port

    bash-3.2# port installed ffmpeg-devel
    
    The following ports are currently installed:
     ffmpeg-devel @20130205_0+gpl2
     ffmpeg-devel @20130328_0 (active)
     ffmpeg-devel @20130328_0+gpl2
    

    So I compiled and build msx264, no errors.

    Now I try to send video over CIP resolution VGA (640x480) and get huge delay 8-9 seconds, even self-view I see in big delay.

    when I configure CIF (352x288), all seems fine.

    It's really strange that self-view camera has delay 4-5 sec.

    So from logs during the session I found that msx264 plugin takes 97% CPU

    On PC (windows 7) the same code runs fine, even HD I don't see any problems.

    What is the problem should be?

    warning: Video MSTicker: We are late of 32146 miliseconds.
    message: Filter MSRtpRecv is not scheduled; nothing to do.
    message: ===========================================================
    message:              AUDIO SESSION'S RTP STATISTICS                
    message: -----------------------------------------------------------
    message: sent                                          2344 packets
    message:                                             403168 bytes  
    message: received                                      2038 packets
    message:                                             350536 bytes  
    message: incoming delivered to the app               325080 bytes  
    message: lost                                             0 packets
    message: received too late                              123 packets
    message: bad formatted                                    0 packets
    message: discarded (queue overflow)                      17 packets
    message: ===========================================================
    message: ms_filter_unlink: MSAuRead:0x7fb5a34955b0,0-->MSResample:0x7fb5aa917820,0
    message: ms_filter_unlink: MSResample:0x7fb5aa917820,0-->MSSpeexEC:0x7fb5a34f6d20,1
    message: ms_filter_unlink: MSSpeexEC:0x7fb5a34f6d20,1-->MSVolume:0x7fb5a3493450,0
    message: ms_filter_unlink: MSVolume:0x7fb5a3493450,0-->MSTee:0x7fb5a3498e40,0
    message: ms_filter_unlink: MSTee:0x7fb5a3498e40,0-->MSUlawEnc:0x7fb5a3499410,0
    message: ms_filter_unlink: MSUlawEnc:0x7fb5a3499410,0-->MSRtpSend:0x7fb5aa910ba0,0
    message: ms_filter_unlink: MSRtpRecv:0x7fb5a3400170,0-->MSUlawDec:0x7fb5a34933c0,0
    message: ms_filter_unlink: MSUlawDec:0x7fb5a34933c0,0-->MSGenericPLC:0x7fb5aa91b040,0
    message: ms_filter_unlink: MSGenericPLC:0x7fb5aa91b040,0-->MSDtmfGen:0x7fb5a6585f00,0
    message: ms_filter_unlink: MSDtmfGen:0x7fb5a6585f00,0-->MSVolume:0x7fb5aa917790,0
    message: ms_filter_unlink: MSVolume:0x7fb5aa917790,0-->MSTee:0x7fb5aa914fc0,0
    message: ms_filter_unlink: MSTee:0x7fb5aa914fc0,0-->MSEqualizer:0x7fb5a3498f50,0
    message: ms_filter_unlink: MSEqualizer:0x7fb5a3498f50,0-->MSSpeexEC:0x7fb5a34f6d20,0
    message: ms_filter_unlink: MSSpeexEC:0x7fb5a34f6d20,0-->MSResample:0x7fb5aa9178b0,0
    message: ms_filter_unlink: MSResample:0x7fb5aa9178b0,0-->MSAuWrite:0x7fb5a3499380,0
    message: ms_filter_unlink: MSTee:0x7fb5a3498e40,1-->MSAudioMixer:0x7fb5aa914df0,0
    message: ms_filter_unlink: MSTee:0x7fb5aa914fc0,1-->MSAudioMixer:0x7fb5aa914df0,1
    message: ms_filter_unlink: MSAudioMixer:0x7fb5aa914df0,0-->MSFileRec:0x7fb5aa911020,0
    message: Audio MSTicker thread exiting
    message: ===========================================================
    message:                   FILTER USAGE STATISTICS                  
    message: Name                Count     Time/tick (ms)      CPU Usage
    message: -----------------------------------------------------------
    message: MSX264Enc           321       138.147             97.1677   
    message: MSResample          8076      0.0550274           0.97085   
    message: MSSpeexEC           4302      0.0873765           0.821276  
    message: MSH264Dec           291       0.880267            0.561463  
    message: MSRtpSend           6174      0.012353            0.166623  
    message: MSRtpRecv           6174      0.0115132           0.155295  
    message: MSOSXGLDisplay      375       0.0376117           0.0308912 
    message: MSAudioMixer        4695      0.00249638          0.0256072 
    message: MSV4m               1480      0.00740446          0.0239537 
    message: MSUlawEnc           4038      0.0019542           0.0172411 
    message: MSTee               6540      0.000698976         0.00998688
    message: MSAuRead            4695      0.00095017          0.0097466 
    message: MSUlawDec           1890      0.00205553          0.00849059
    message: MSVolume            5928      0.000633159         0.00820007
    message: MSFileRec           4695      0.000722743         0.00741371
    message: MSDtmfGen           4695      0.0005              0.00512887
    message: MSGenericPLC        4695      0.000429514         0.00440585
    message: MSAuWrite           4038      0.000364199         0.00321319
    message: MSEqualizer         1890      0.000250661         0.00103538
    message: MSSizeConv          322       0.00104334          0.000736128
    message: MSJpegWriter        290       0.000694158         0.00044124
    message: MSPixConv           322       0.000405573         0.000286151
    message: MSFilePlayer        0         0                   0         
    message: MSVoidSink          0         0                   0         
    message: ===========================================================
    warning: Video MSTicker: We are late of 32256 miliseconds.
    message: v4m video device closed.
    message: Filter MSRtpRecv is not scheduled; nothing to do.
    message: ===========================================================
    message:              VIDEO SESSION'S RTP STATISTICS                
    message: -----------------------------------------------------------
    message: sent                                          1311 packets
    message:                                            1517528 bytes  
    message: received                                      1783 packets
    message:                                            1049010 bytes  
    message: incoming delivered to the app               986868 bytes  
    message: lost                                             0 packets
    message: received too late                                0 packets
    message: bad formatted                                    0 packets
    message: discarded (queue overflow)                       0 packets
    message: ===========================================================
    

    In addition the application shows me delay status, from logs:

    message:: Dialog [0x7fb5a7634940]: now updated by transaction [0x7fb5aa9685d0].
    warning: Video MSTicker: We are late of 20415 miliseconds.
    warning: Video MSTicker: We are late of 20564 miliseconds.
    message:: A SPS is being sent.
    message:: A PPS is being sent.
    warning: Video MSTicker: We are late of 20609 miliseconds.
    warning: Video MSTicker: We are late of 20636 miliseconds.
    warning: Video MSTicker: We are late of 20694 miliseconds.
    warning: Video MSTicker: We are late of 20784 miliseconds.
    warning: Video MSTicker: We are late of 20894 miliseconds.
    warning: Video MSTicker: We are late of 21016 miliseconds.
    warning: echo canceller: we are accumulating too much reference signal, need to throw out 1216 samples
    message:: audio_stream_iterate(): local statistics available
    Local's current jitter buffer size:77.440002 ms
    message:: bandwidth usage: audio=[d=80.1,u=80.1] video=[d=305.3,u=441.8] kbit/sec
    message:: Thread processing load: audio=2.135499    video=1268.186768
    warning: Video MSTicker: We are late of 21134 miliseconds.
    warning: Video MSTicker: We are late of 21256 miliseconds.
    warning: Video MSTicker: We are late of 21382 miliseconds.
    warning: Video MSTicker: We are late of 21506 miliseconds.
    warning: Video MSTicker: We are late of 21638 miliseconds.
    warning: Video MSTicker: We are late of 21781 miliseconds.
    warning: Video MSTicker: We are late of 21921 miliseconds.
    message:: bandwidth usage: audio=[d=81.6,u=80.0] video=[d=271.9,u=185.5] kbit/sec
    message:: Thread processing load: audio=1.971647    video=1342.125000
    warning: Video MSTicker: We are late of 22068 miliseconds.
    message:: audio_stream_iterate(): remote statistics available
    remote's interarrival jitter=68
    remote's lost packets percentage since last report=0.390625
    round trip time=0.258850 seconds
    warning: Video MSTicker: We are late of 22216 miliseconds.
    

    Please, help me to find the problem.

    Thanks,

    this is a msx264 git repository: git clone git://git.linphone.org/msx264.git