三種方法
此去除B幀的方法只適用於採用 libx264 編碼器編碼的視頻
引用鏈接:
ffmpeg x264 選項指南
第一種
參數中加 -bf 0
ffmpeg -i test.mp4 -vcodec libx264 -bf 0 test-640x480.h264
第二種
參數中加 -x264opts "bframe=0"
ffmpeg -i test.mp4 -vcodec libx264 -x264opts "bframes=0" test-640x480.h264
第三種
參數中加 -profile:v baseline
ffmpeg -i test.mp4 -vcodec libx264 -profile:v baseline -pix_fmt yuv420p -s 640x480 -acodec aac test1.mp4
加這個參數時,請指定圖像格式,否則很容易報錯
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
x264 [error]: main profile doesn't support 4:4:4
[libx264 @ 0x8fa9640] Error setting profile main.
[libx264 @ 0x8fa9640] Possible profiles: baseline main high high10 high422 high444
查看是否含有B幀
轉換完成後,通過 ffprobe 可以查看視頻流中是否含有B幀
ffprobe -v quiet -show_frames -select_streams v test.mp4 | find "pict_type=B"