FFmpeg常用命令

FFmpeg 常用命令

ffprobe -show_frames video1.mp4   		// frame
ffprobe -show_packets  video1.mp4		// packet
ffprobe -v quiet -show_frames -select_streams v test.h264 | grep "pict_type=B" // 看是否有B帧
ffprobe -v quiet -show_frames -select_streams v test.h264 | grep "pict_type=I" // 看是否有I帧
ffprobe -v quiet -show_frames -select_streams v test_new.mp4 | grep "pict_type=I" | wc -l // wc -l 可以统计出 pict_type=I的个数
ffmpeg -i test.mp4 -an -vcodec copy -bf 0 test.h264 // -bf 0去掉B帧,前提是原视频就没有B帧   // -vcodec copy 表示不在重新编码

使用ffmpeg编码时,如何设置恒定码率,并控制好关键帧I帧间隔

-keyint_min 60 -g 60 -sc_threshold 0 // 其中-keyint_min为最小关键帧间隔, 使用-g命令,设置GOP长度, -sc_threshold这个命令会根据视频的运动场景,自动为你添加额外的I帧
例如:
ffmpeg -i test.mp4 -vcodec libx264 -bf 0 -keyint_min 25 -g 25 -sc_threshold 0 test_new.mp4 -y // 得到I帧间隔,GOP均为25帧的视频
posted @ 2022-11-05 22:46  xujin_wuhan  阅读(355)  评论(0)    收藏  举报