Newest 'x264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Building ffmpeg for ubuntu No working C compiler found

    27 janvier 2014, par Whoami

    I am building ffmpeg on ubuntu. I could able to build yasm-1.2.0, and next i tried building x264. x264 requires minumum of yasm-1.2.0, Hence i tried the below command to build x264.

    ./configure --prefix= --bindir= --extracflgs= --extra-ldflags= 
    

    I got the below error:

    No working C compiler found.
    

    Not sure what error i commited. Could someone kindly tell me what do i have to do?

  • Sending metadata per frame with libavcodec

    24 janvier 2014, par user3058248

    I'm trying to send some metadata with every frame that I encode. I've tried this:

    Encoder side:

    AVDictionary *myMeta = NULL;
    int ret = av_dict_set(&myMeta, "temp_data", "test", 0);
    if (ans < 0)
    {
        cout << "Error: " << ret << endl;
    }
    av_frame_set_metadata(frameToEncode, myMeta);
    

    Decoder side:

    AVDictionaryEntry *e;
    AVDictionary *dict = NULL;
    dict = av_frame_get_metadata(decodedFrame);
    if (dict != NULL)
    {
        if (e = av_dict_get(dict, "temp_data", NULL, AV_DICT_IGNORE_SUFFIX)) {
            cout << e->value << endl;
        }
    }
    

    I'm using x264 to encode. After I decode the data, the metadata member of decodedFrame is NULL.

    Any ideas?

    Thanks.

  • RGB to x264 : Strange color render

    16 janvier 2014, par Maypeur

    i'm trying to make a video from an OpenGl context.

    I'm Using glReadPixel, to be sure RGB buffer data is Ok i save it into a bmp file, wich i can read correctly.

    My .h264 video is encoded but there are some artefact and i don't understand why. I tried a lot of different parameters for the x264_param_t but anything better !

    Bitmap saved (OpenGL real data) : Bitmap from OpenGl (1mo)

    Raw h264 with error : Raw h264 video (1mo)

    OpenGl ReadPixel :

    int nSize = ClientHeight * ClientWidth * 3;
    GLubyte *inBuff = new GLubyte[nSize];
    glReadBuffer(GL_FRONT);
    glReadPixels(0, 0, ldwidth, ldheight, GL_BGR, GL_UNSIGNED_BYTE, inBuff);
    

    The params define :

    x264_param_default(&mX264_param_t);
    x264_param_default_preset(&mX264_param_t, "placebo", "film");
    
    mX264_param_t.i_csp = X264_CSP_BGR;
    mX264_param_t.i_threads = 6;
    mX264_param_t.i_width = mWidth;
    mX264_param_t.i_height = mHeight;
    
    mX264_param_t.i_fps_num = mFps;
    mX264_param_t.i_fps_den = 1;
    
    // Intra refres:
    mX264_param_t.i_keyint_max = mFps;
    mX264_param_t.b_intra_refresh = 1;
    
    //Rate control:
    mX264_param_t.rc.i_rc_method = X264_RC_CRF;
    mX264_param_t.rc.f_rf_constant = 25;
    mX264_param_t.rc.f_rf_constant_max = 35;
    
    int bps = 5000;
    mX264_param_t.rc.i_bitrate = bps;
    mX264_param_t.rc.i_vbv_max_bitrate = bps;
    mX264_param_t.i_bframe = 2;
    mX264_param_t.i_keyint_min = mFps / 4;
    //For streaming:
    mX264_param_t.b_repeat_headers = 1;
    mX264_param_t.b_annexb = 1;
    mX264_param_t.i_log_level = X264_LOG_DEBUG;
    x264_param_apply_profile(&mX264_param_t, "baseline");
    
    mpEncoder = x264_encoder_open(&mX264_param_t);
    x264_encoder_parameters(mpEncoder, &mX264_param_t);
    
    
    
    mpPictureOut = new x264_picture_t();
    mpPictureIn = new x264_picture_t();
    
    x264_picture_alloc(mpPictureIn, X264_CSP_BGR | X264_CSP_VFLIP, mWidth, mHeight);
    

    Then the encoding loop :

    mpPictureIn->img.i_csp = X264_CSP_BGR;
    
    mpPictureIn->img.i_plane = 1;
    mpPictureIn->img.i_stride[0] = 3 * mWidth;
    mpPictureIn->img.plane[0] = rgbframe;
    
    mpPictureIn->i_pts = mFrameCount;
    mpPictureIn->i_type = X264_TYPE_AUTO;
    
    mpPictureOut->i_pts = mFrameCount;
    
    int i_nals;
    x264_nal_t* nals;
    int frame_size = x264_encoder_encode(mpEncoder, &nals, &i_nals, mpPictureIn, mpPictureOut);
    
    if(frame_size > 0)
    {
    mpFileOut->write_frame(nals[0].p_payload, frame_size, mpPictureOut);
    mFrameCount++;
    }
    

    The write frame :

    int TVideoFileWriter::write_frame(uint8_t *p_nalu, int i_size, x264_picture_t *p_picture)
    {
    if(fwrite(p_nalu, i_size, 1, mFileHandle))
        return i_size;
    return -1;
    }
    
  • x264 configure linking and building problems

    16 janvier 2014, par Pie

    I am trying to build x264 from source on Ubuntu 32bit in order to convert a sequence of jpg or png images into mp4 video: x264 site, sample images

    The downloaded binaries is able to convert the sequence into an mkv video (or few other formats) when I run this command:

    ./x264dist ~/Dev/x264emp/img/FLYOVER%4d.JPG -o abc.mkv
    

    x264dist is the renamed name of the binary I download from the site.

    However, when I grab the source and compile with simple configure:

    $ ./configure --enable-shared --enable-static --enable-pic

    platform:      X86
    system:        LINUX
    cli:           yes
    libx264:       internal
    shared:        yes
    static:        yes
    asm:           yes
    interlaced:    yes
    avs:           avxsynth
    lavf:          no
    ffms:          no
    mp4:           no
    gpl:           yes
    thread:        posix
    opencl:        yes
    filters:       crop select_every 
    debug:         no
    gprof:         no
    strip:         no
    PIC:           yes
    bit depth:     8
    chroma format: all
    

    then $ make. Then I use the binaries to run the exactly same command as above but there is this error:

    ./x264 ~/Dev/x264emp/img/FLYOVER%4d.JPG -o abc.mkv
    raw [error]: raw input requires a resolution.
    x264 [error]: could not open input file `/home/tmd/Dev/x264emp/img/FLYOVER%4d.JPG' via any method!
    

    It seems like it can't read any input at all. But at least I am still able to run --help on that binaries.

    Then I realized that the downloaded binaries is 3.5Mb while my custom compilation results in 1.5Mb binaries.

    So I just want to know what are the build configurations used by the official build, and/or is there any dependency I am missing that leads to this problem.

    The reason I am trying to build myself because I want to port the x264 lib into Javascript using Emscripten. There has been a solution using FFmpeg but it seems like I don't need the whole video processing library but only a simple H264 codec. So I need to solve the configure/compile/linking problem to port it rightly.

    Possibly similar How to configure X264 build before running make on OS X

  • Check the Validity of x264 Nal Units

    15 janvier 2014, par bhawesh

    I am working with x264 encoder api where for every encoded picture i get a number of nal unit. is there any way i can check whether nals are valid or not in my VS2010 Debugger. Currently i can see the following information::

    i_ref_idc        -858993460
    i_type           -858993460
    b_long_startcode -858993460
    i_first_mb       -858993460
    i_last_mb        -858993460
    i_payload        27
    p_payload        0x06b94d68
    i_padding        -858993460
    

    i m not sure whether these negative values are representing that nals are invalid or it is missing information.
    Basically how can i check that the nals i got from x264_encoder_encode() is a valid nal unit?
    NOTE :: i m using these nals to stream live using LIVE555.