ffprobe返回mov,mp4,m4a,3gp,3g2,mj2

时间:2015-10-19 15:57:42

标签: ffmpeg ffprobe

我试图找到某种方式来理解某个文件是否使用了h.264编解码器并且它是否可以流式传输。

我使用的是ffprobe,有时我得到的输出如下:

{
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2036-02-06 06:28:16
    encoder         : HandBrake 0.10.2 2015060900
  Duration: 00:06:42.13, start: 0.000000, bitrate: 950 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 640x480 [SAR 1:1 DAR 4:3], 788 kb/s, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2036-02-06 06:28:16
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 155 kb/s (default)
    Metadata:
      creation_time   : 2036-02-06 06:28:16
      handler_name    : Stereo
    "format": {
        "filename": "file.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": "402.134000",
        "size": "47787790",
        "bit_rate": "950683",
        "probe_score": 100,
        "tags": {
            "major_brand": "mp42",
            "minor_version": "512",
            "compatible_brands": "isomiso2avc1mp41",
            "creation_time": "2036-02-06 06:28:16",
            "encoder": "HandBrake 0.10.2 2015060900"
        }
    }
}

现在,似乎该文件是可流式传输的,并且可以上线,但我期待这样的事情:

    "format_name": "h.264",

而不是

    "format_name": "mov,mp4,m4a,3gp,3g2,mj2",

在指定这个文件到底是什么方面似乎非常宽松。 我也使用MP4Box来查看视频是否可以流式传输,但此时我还不确定如何处理特定的h.264识别。

为了确保给定文件具有h.264编解码器,我该怎么办?

感谢

1 个答案:

答案 0 :(得分:2)

原来这是我的错误:)

这是正确的命令

/opt/ffmpeg/ffprobe file.mp4 -show_streams  -select_streams v  -print_format json

反过来给出:

{
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "Main",
            "codec_type": "video",
            "codec_time_base": "1/180000",
            "codec_tag_string": "avc1",
            "codec_tag": "0x31637661",
            "width": 640,
            "height": 480,
            "has_b_frames": 2,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "4:3",
            "pix_fmt": "yuv420p",
            "level": 40,
            "color_range": "tv",
            "color_space": "smpte170m",
            "color_transfer": "bt709",
            "color_primaries": "smpte170m",
            "chroma_location": "left",
            "refs": 4,
            "is_avc": "1",
            "nal_length_size": "4",
            "r_frame_rate": "30/1",
            "avg_frame_rate": "90465/3016",
            "time_base": "1/90000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 36192000,
            "duration": "402.133333",
            "bit_rate": "788651",
            "bits_per_raw_sample": "8",
            "nb_frames": "12062",
            "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
            },
            "tags": {
                "creation_time": "2036-02-06 06:28:16",
                "language": "und",
                "handler_name": "VideoHandler"
            }
        }
    ]
}