I am trying to change a video's keyframe interval to be 1 following this link and using the command
ffmpeg -i myvideo.mp4 -vcodec libx264 -x264-params keyint=30:no-scenecut -acodec copy out.mp4
as indicated in the first answer. I wrote keyint=30
as my video's fps
is 30
, so 1*30=30
. However, only the first frame's keyframe is 1
, and all the rest remain 0
(as before the above command), as shown by the command ffprobe -select_streams v:0 -show_frames out.mp4
:
...
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=0
pkt_pts_time=0.000000
pkt_dts=0
pkt_dts_time=0.000000
best_effort_timestamp=0
best_effort_timestamp_time=0.000000
pkt_duration=512
pkt_duration_time=0.033333
pkt_pos=48
pkt_size=18693
width=560
height=320
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=512
pkt_pts_time=0.033333
pkt_dts=512
pkt_dts_time=0.033333
best_effort_timestamp=512
best_effort_timestamp_time=0.033333
pkt_duration=512
pkt_duration_time=0.033333
pkt_pos=21764
pkt_size=199
width=560
height=320
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=B
coded_picture_number=3
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
[/FRAME]
...
Any ideas?
Finally, I achieved what I wanted with the command :
ffmpeg -i myvideo.mp4 -qscale 0 -g 1 outputFile.mp4