Newest 'x264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Flush delayed frames every a few input frames in x264

    4 avril 2014, par xpxp

    Hi I am new to x264 and know some basics. The encoding API routine used in x264 cli (x264.c) is summarized as:

    1. call x264_encoder_open and set up parameters.
    2. fetch a frame from input video and encode it with x264_encoder_encode.
    3. iterate 2. until input EOF or the given frame limit is reached.
    4. flush delayed frames.

    My problem is: other than flush x264 encoder only once at the end of encoding process, is it possible or not to flush the delayed frames within step 2? For example, I want to flush the encoder manually every 20 frames (or a GOP frames) fed into x264_encoder_encode and resume the normal process when all delayed frames are encoded. Thus as a result the video will have several flush procedures.

    Regards

  • Error compiling x264 on Mac OS X

    28 mars 2014, par progdo

    I'm trying to compile and install the x264 H.264/AVC encoder. I've got gcc installed. But I get the 'No working C compiler found' error when I run:

    ./configure --enable-shared --enable-static
    

    What can I do?

    The config log said:

    /bin/gcc conftest.c  -Wall -I. -I$(SRCPATH) -falign-loops=16 -mdynamic-no-pic -o conftest
    clang: error: unknown argument: '-falign-loops=16' [-Wunused-command-line-argument-hard-error-in-future]
    clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
    
  • Trouble with x264 compilation on Mac OS X

    27 mars 2014, par user3454318

    I've gcc installed. But when ./configure --enable-shared --enable-static

    it gives No working C compiler found. Please help.

  • x264 encoding with libav

    25 mars 2014, par user3453729

    I try to encode raw image data to x264 with libav:

    AVPacket vpkt = { 0 };
    av_init_packet(&vpkt);
    
    int got;
    int ret = avcodec_encode_video2(vcodec, &vpkt, frameyuv.get(), &got);
    
    if (!ret && got && vpkt.size) {
        if (vpkt.pts != AV_NOPTS_VALUE) {
            vpkt.pts = av_rescale_q(vpkt.pts, vcodec->time_base, videost->time_base);
        }
        if (vpkt.dts != AV_NOPTS_VALUE) {
            vpkt.dts = av_rescale_q(vpkt.dts, vcodec->time_base, videost->time_base);
        }
    
        vpkt.stream_index = videost->index;
    
        if(vcodec->coded_frame->key_frame) {
            vpkt.flags |= AV_PKT_FLAG_KEY;
        }
        /* -> will return -22 if max_b_frames > 0 */
        ret = av_interleaved_write_frame(oc, &vpkt);
    }
    

    Runs fine when vcodec->max_b_frames is set to 0, but on any other value av_interleaved_write_frame returns -22 (invalid argument).

    /* will fail */
    c->max_b_frames = 3;
    /* -> ok*/
    c->max_b_frames = 0;
    

    Why? Am i missing something?

    Codec options are

    AVDictionary *opts = NULL;
    av_dict_set(&opts, "vprofile", "baseline", 0);
    
    /* ... */
    c->codec_type = AVMEDIA_TYPE_VIDEO;
    c->bit_rate = 500 * 1000;
    c->width = VideoWidth;
    c->height = VideoHeight;
    c->time_base.den = fps;
    c->time_base.num = 1;
    c->pix_fmt = AV_PIX_FMT_YUV420P;
    

    Container format is mp4.

  • x264 : Using NAL size limitation ruines the stream

    25 mars 2014, par dtumaykin

    I'm using x264 to compress a video stream from a webcam with this settings:

    x264_param_default_preset(&param, "veryfast", "zerolatency");
    
    param.i_threads = 1;
    param.i_fps_den = 1;
    param.b_annexb = 1;
    
    param.i_keyint_max = 30;
    param.rc.i_rc_method = X264_RC_CRF;
    param.rc.f_rf_constant = 25;
    param.rc.f_rf_constant_max = 35;
    
    param.b_repeat_headers = 1;
    x264_param_apply_profile(&param, "baseline");
    
    param.i_slice_max_size = X264_NAL_MAX_SIZE;
    

    I would like to fit NAL into MTU size, but if I set a small max size, the stream is ruined - it blinks randomly between black and white, with some clues of original image in background. The bigger is the max_size, less probable is for the stream to be ruined. So my question is - can we have small NALUs and a correct video stream?

    UPD: I use FFmpeg as a decoder.