cook:ffprobe&ffplay

cook:ffprobe&ffplay

Content #

  1. 查看多媒体数据包信息

    ffprobe -show_packets input.flv
    
  2. 查看媒体数据包的具体数据

    ffprobe -show_data -show_packets input.flv
    
  3. 用json或flat格式查看流信息

    ffprobe -of json -show_packets input.flv
    ffprobe -of flat -show_packets input.flv
    
  4. 使用show_streams过滤帧信息音频(a),视频(v),字幕(s)

    ffprobe -show_frames -select_streams v -of xml input.mp4
    
  5. 强制从第30秒开始,播放10秒

    ffplay -ss 30 -t 10 input.mp4
    
  6. 指定视频流编号为4,音频流编号为5

    ffplay -vst 4 -ast 5 input.ts
    
  7. 展现音频数据的音频波形

    ffplay -showmode 1 input.mp3
    
  8. 显示宏块信息

    ffplay -debug vis_mb_type -ss 20 -t 10 -autoexit input.mp4
    
  9. 查看B帧预测与P帧预测信息

    ffplay -vismv pf input.mp4 #vismv可能会过时
    ffplay -flags2 +export_mvs -ss 40 input.mp4 -vs codecview=mv=pf+bf+bb #滤镜
    
  10. 查询视频文件的duration

    ffprobe -v quiet -show_format input.mp4 | grep duration
    
  11. 查看视频文件的分辨率

    ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 input.mp4
    

    -v error: 设置输出日志级别为错误,以减少输出信息,只显示必要的信息。 -select_streams v:0: 选择第一个视频流。 -show_entries stream=width,height: 显示视频流的宽度和高度信息。 -of csv=s=x:p=0: 以逗号分隔的值(CSV)的格式输出,使用"x"作为分隔符,只输出第一个流的信息。

show_entries(ffprobe)

P帧与B帧