ffmpeg常用语法

ffmpeg/ffprobe查看音频视频文件信息并输出为json格式

ffprobe -i 输入视频路径 -v quiet -print_format json -show_format -show_streams

如:

$ ffprobe -i tt.mp4 -v quiet -print_format json -show_format -show_streams
{
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "High",
            "codec_type": "video", // 视频
            "codec_time_base": "1/20",
            "codec_tag_string": "avc1",
            "codec_tag": "0x31637661",
            "width": 640,
            "height": 240,
            "coded_width": 640,
            "coded_height": 240,
            "closed_captions": 0,
            "has_b_frames": 2,
            "pix_fmt": "yuv420p",
            "level": 31,
            "chroma_location": "left",
            "refs": 1,
            "is_avc": "true",
            "nal_length_size": "4",
            "r_frame_rate": "10/1",
            "avg_frame_rate": "10/1",
            "time_base": "1/10240",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 2192384,
            "duration": "214.100000", // 时长
            "bit_rate": "214395",
            "bits_per_raw_sample": "8",
            "nb_frames": "2141",
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            },
            "tags": {
                "language": "und",
                "handler_name": "VideoHandler"
            }
        },
        {
            "index": 1,
            "codec_name": "aac",
            "codec_long_name": "AAC (Advanced Audio Coding)",
            "profile": "LC",
            "codec_type": "audio", // 音频
            "codec_time_base": "1/16000",
            "codec_tag_string": "mp4a",
            "codec_tag": "0x6134706d",
            "sample_fmt": "fltp",
            "sample_rate": "16000", // 采样率
            "channels": 2,// 双轨
            "channel_layout": "stereo",
            "bits_per_sample": 0,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/16000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 3436544,
            "duration": "214.784000",
            "bit_rate": "48392",
            "max_bit_rate": "48392",
            "nb_frames": "3357",
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            },
            "tags": {
                "language": "und",
                "handler_name": "SoundHandler"
            }
        }
    ],
    "format": {
        "filename": "tt.mp4",
        "nb_streams": 2,
        "nb_programs": 0,
        "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
        "format_long_name": "QuickTime / MOV",
        "start_time": "0.000000", // 开始时间
        "duration": "214.848000", // 时长 单位秒
        "size": "7114680", // 文件大小
        "bit_rate": "264919",
        "probe_score": 100,
        "tags": {
            "major_brand": "isom",
            "minor_version": "512",
            "compatible_brands": "isomiso2avc1mp41",
            "encoder": "Lavf57.58.101"
        }
    }
}

如果本篇文章对您有所帮助,请支持作者喝杯咖啡哦
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值