[FFmpeg-trac] #10372(avcodec:new): Keyframes are not inserted as specified by -force_key_frames in libaom-av1 encoder
FFmpeg
trac at avcodec.org
Thu May 18 14:58:05 EEST 2023
#10372: Keyframes are not inserted as specified by -force_key_frames in libaom-av1
encoder
---------------------------------+--------------------------------------
Reporter: nicol | Type: defect
Status: new | Priority: normal
Component: avcodec | Version: git-master
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
---------------------------------+--------------------------------------
Summary of the bug: When a keyframe location with no -force_key_frames
specified is specified again with -force_key_frames, the keyframe is
shifted back one frame and the keyframe is inserted consecutively with the
original keyframe.
How to reproduce:
{{{
Check the keyframe location without -force_key_frames.
ffmpeg -f lavfi -i mptestsrc=r=30:d=5:t=all -c:v libaom-av1 -crf 31 -b:v 0
-g 60 -cpu-used 8 mptestsrc.mp4 -y
ffprobe -v error -i mptestsrc.mp4 -select_streams v:0 -show_entries
packet=flags -of flat | grep -e K - | sed -e "s/[^0-9]//g" | awk -F ','
'NR==1,NR==ENS {print $1}'
0
60
120
Check keyframe locations by specifying -force_key_frames.
ffmpeg -f lavfi -i mptestsrc=r=30:d=5:t=all -c:v libaom-av1 -crf 31 -b:v 0
-g 60 -cpu-used 8 -force_key_frames expr:eq(n,60)+eq(n,120) mptestsrc3.mp4
-y
ffprobe -v error -i mptestsrc3.mp4 -select_streams v:0 -show_entries
packet=flags -of flat | grep -e K - | sed -e "s/[^0-9]//g" | awk -F ','
'NR==1,NR==ENS {print $1}'
0
60
61
120
121
The desired behavior is the same as libsvtav1 encoder.
ffmpeg -f lavfi -i mptestsrc=r=30:d=5:t=all -c:v libsvtav1 -crf 31 -b:v 0
-g 60 -preset 8 -svtav1-params enable-force-key-frames=1 -force_key_frames
expr:eq(n,60)+eq(n,120) mptestsrc4.mp4 -y
ffprobe -v error -i mptestsrc4.mp4 -select_streams v:0 -show_entries
packet=flags -of flat | grep -e K - | sed -e "s/[^0-9]//g" | awk -F ','
'NR==1,NR==ENS {print $1}'
0
60
120
ffmpeg version btbn ffmpeg-N-110645-gd4c48ee7f3-win64-gpl
built on ... Auto-Build 2023-05-17 12:49
}}}
Patches should be submitted to the ffmpeg-devel mailing list and not this
bug tracker.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/10372>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list