Opened 13 years ago

Closed 12 years ago

#157 closed defect (fixed)

Specifying KEYINT (-g) has no effect

Reported by: Reado Owned by:
Priority: normal Component: avcodec
Version: git-oldabi Keywords: keyint libx264
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description

Using the latest "oldabi" version of FFMPEG, here's my command:

ffmpeg -i 00384.MTS -acodec libfaac -ab 128k -ac 2 -ar 44100 -vcodec libx264 -preset fast -vf yadif=1,scale=854:480 -b 2000k -qmin 22 -qmax 27 -aspect 16:9 -threads 0 -g 25 -f mp4 -t 30 -y fast.mp4

However the response from libx264 is:

[libx264 @ 0xac390e0] 264 - core 115 r1947 b5a8ad7 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=abr mbtree=1 bitrate=2000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00

Notice keyint=250 when it should be keyint=25. This means I can't force a keyframe every second. Playing back the video, I can only seek every 3 seconds, not every second.

Workaround: In the libx264 project under common/common.c, change "param->i_keyint_max" from 250 to 25, recompile libx264 and re-run the encoder. The result is there's a keyframe every second as expected and now I can seek to any position in the video.

Change History (3)

comment:1 by Baptiste Coudurier, 13 years ago

Some parameters are still overriden by the -preset option.
If you want to enhance them, it would be great.

You can have a look at the commit concerning "weightp" and mimic what it does for "g", "qmin", "qmax"

comment:2 by Michael Niedermayer, 13 years ago

Priority: criticalnormal

oldabi has been updated and supports -x264opts, which support all x264 options.
This makes this bug "normal" and no longer "critical"

comment:3 by Stefano Sabatini, 12 years ago

Analyzed by developer: set
Component: undeterminedavcodec
Keywords: libx264 added
Resolution: fixed
Status: newclosed

Should be fixed since commit:

commit bb73cda2f6667aa2c1b805a31a10ce9d59c3293d
Author: Anton Khirnov <anton@khirnov.net>
Date:   Thu Sep 1 12:59:29 2011 +0200

    libx264: fix setting some options.
    
    Specifically: gop_size, max_b_frames, scenechange_threshold, qmin, qmax,
    max_qdiff, qblur, qcompress and refs.
    
    Change their default values to -1 and only use them if the user
    explicitly set them. Otherwise x264 defaults are used.
    
    Move setting those options after x264_param_default_preset(), so they
    don't get overwritten by it.
Note: See TracTickets for help on using tickets.