Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to change macroblock's size in H.264 ?

    12 juin 2021, par Euphoria Yang

    I am using ffmpeg api to implement this paper(Passthrough+: Real-time Stereoscopic View Synthesis for Mobile Mixed Reality). In this paper, they use 8x8 macroblock to calculate motion vectors. However, most of macroblocks are encoded in 16x16 pixels by ffmpeg. How to force macroblock size to be 8x8 using ffmpeg api(or can be done by modifying libavcodec/libx264.c)?

  • x264 / libx264 : Can only one I/P frame to be used as reference for B-frames ?

    29 mai 2021, par Maria

    As you know ref parameter can set the number of previous frames each P-frame can use as references.

    I need the same thing for B-Frames, but ref=1 does not work for B-Frames.

    I mean an I/P frame to be used as reference for B-frames only.

    is it possible with a command line? , or by change the following function in the source code ?

    static inline int reference_update( x264_t *h )
    {
    if( !h->fdec->b_kept_as_ref )
    {
        if( h->i_thread_frames > 1 )
        {
            x264_frame_push_unused( h, h->fdec );
            h->fdec = x264_frame_pop_unused( h, 1 );
            if( !h->fdec )
                return -1;
        }
        return 0;
    }
    
    /* apply mmco from previous frame. */
    for( int i = 0; i < h->sh.i_mmco_command_count; i++ )
        for( int j = 0; h->frames.reference[j]; j++ )
            if( h->frames.reference[j]->i_poc == h->sh.mmco[i].i_poc )
                x264_frame_push_unused( h, x264_frame_shift( &h->frames.reference[j] ) );
    
    /* move frame in the buffer */
    x264_frame_push( h->frames.reference, h->fdec );
    if( h->frames.reference[h->sps->i_num_ref_frames] )
        x264_frame_push_unused( h, x264_frame_shift( h->frames.reference ) );
    h->fdec = x264_frame_pop_unused( h, 1 );
    if( !h->fdec )
        return -1;
    return 0;
    }
    
  • Extract Motion Vectors From x264 source code

    27 mai 2021, par Essam Aly

    If you are familiar with the x264 source code, where in the code I can extract the MV (motion vectors) of each frame? Can you point please to a line of code I can intercept and save the MVs to disk? Thank you.

  • Ubuntu ffmpeg can't use libx264

    27 mai 2021, par user1315621

    Command

    ffprobe rtsp://localhost/myvideo -codec:v libx264 -show_frames -of csv
    

    Output

    Failed to set value 'libx264' for option 'codec:v': Option not found
    

    But libx264 seems to be installed - sudo apt install libx264-dev:

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    libx264-dev is already the newest version (2:0.152.2854+gite9a5903-2).
    
  • how to put SPS/PPS before each keyframe while encode h264 with ffmpeg ?

    18 mai 2021, par woder

    I see there is an flag can put pps and sps before each keyframe

    // x264.h
    int b_repeat_headers;       /* put SPS/PPS before each keyframe */
    

    but I don't know how to enable it while encode with ffmpeg; I search ffmpeg codec library wrapper file libx264.c that I only find b_repeat_headers will be set to 0 if codec context flag AV_CODEC_FLAG_GLOBAL_HEADER is set

        if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)
            x4->params.b_repeat_headers = 0;
    

    but I don't find where to set b_repeat_headers to 1, how can I make it?