2015-10-19 271 views
1

我試圖找到某種方法來了解給定文件是否使用h.264編解碼器,並且它是流式傳輸。ffprobe返回mov,mp4,m4a,3gp,3g2,mj2

我使用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", 

這似乎在指定什麼H的條件非常寬鬆這個文件是。 我也在使用MP4Box爲了看視頻是否流式傳輸,但在這一點上我不知道如何處理特定的h.264識別。

我應該怎麼做才能確保給定的文件具有h.264編解碼器?

感謝

回答

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" 
      } 
     } 
    ] 
} 
相關問題