2017-09-27 113 views
0

我試圖更改視頻的關鍵幀間隔爲1以下this link並且使用命令無法更改視頻關鍵幀間隔使用的ffmpeg

ffmpeg -i myvideo.mp4 -vcodec libx264 -x264-params keyint=30:no-scenecut -acodec copy out.mp4 

在第一個答案表示爲1。我寫了keyint=30作爲我的視頻的fps30,所以1*30=30。然而,僅在第一幀的關鍵幀是1,和所有其餘的保持0(如上述命令之前),如圖所示由命令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] 
... 

任何想法?

+0

你的指令是正確的:它輸出I - 幀中的每個第二個或30幀。如果你只需要一個I-幀輸出,那麼你需要將'keyint'設置爲1而不是30. – aergistal

+0

@aergistal謝謝你的回答。我嘗試過,但只有第一幀有'keyframe = 1' ... – Marievi

回答

0

最後,我實現我想要用命令:

ffmpeg -i myvideo.mp4 -qscale 0 -g 1 outputFile.mp4