1. 程式人生 > 其它 >特殊視訊構造總結

特殊視訊構造總結

  由於最近在測試畫中畫的功能,需要構造一批特殊的視訊和圖片進行異常場景的測試,現總結如下: 1.檢視視訊基本資訊 首先將被測視訊放在指定目錄(/Users/ceshi/Downloads/a.mp4),然後開啟終端輸入如下命令:
cd /Users/ceshi/Downloads/
mediainfo a.mp4
ffprobe -v quiet -print_format json -show_format -show_streams -show_error -show_chapters a.mp4
  輸出結果如下:

{
    "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_tag_string":"avc1",
            "codec_tag":"0x31637661",
            "width":720,
            "height":1280,
            "coded_width":720,
            "coded_height":1280,
            "closed_captions":0,
            "film_grain":0,
            "has_b_frames":2,
            "sample_aspect_ratio":"1:1",
            "display_aspect_ratio":"9:16",
            "pix_fmt":"yuv420p",
            "level":32,
            "color_range":"tv",
            "color_space":"bt709",
            "color_transfer":"bt709",
            "color_primaries":"bt709",
            "chroma_location":"left",
            "field_order":"progressive",
            "refs":1,
            "is_avc":"true",
            "nal_length_size":"4",
            "id":"0x1",
            "r_frame_rate":"60/1",
            "avg_frame_rate":"3940/83",
            "time_base":"1/15360",
            "start_pts":0,
            "start_time":"0.000000",
            "duration_ts":318720,
            "duration":"20.750000",
            "bit_rate":"1790467",
            "bits_per_raw_sample":"8",
            "nb_frames":"985",
            "extradata_size":49,
            "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,
                "captions":0,
                "descriptions":0,
                "metadata":0,
                "dependent":0,
                "still_image":0
            },
            "tags":{
                "language":"und",
                "handler_name":"VideoHandler",
                "vendor_id":"[0][0][0][0]"
            }
        },
        {
            "index":1,
            "codec_name":"aac",
            "codec_long_name":"AAC (Advanced Audio Coding)",
            "profile":"LC",
            "codec_type":"audio",
            "codec_tag_string":"mp4a",
            "codec_tag":"0x6134706d",
            "sample_fmt":"fltp",
            "sample_rate":"44100",
            "channels":2,
            "channel_layout":"stereo",
            "bits_per_sample":0,
            "id":"0x2",
            "r_frame_rate":"0/0",
            "avg_frame_rate":"0/0",
            "time_base":"1/44100",
            "start_pts":0,
            "start_time":"0.000000",
            "duration_ts":917456,
            "duration":"20.803991",
            "bit_rate":"128009",
            "nb_frames":"898",
            "extradata_size":2,
            "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,
                "captions":0,
                "descriptions":0,
                "metadata":0,
                "dependent":0,
                "still_image":0
            },
            "tags":{
                "language":"und",
                "handler_name":"SoundHandler",
                "vendor_id":"[0][0][0][0]"
            }
        }
    ],
    "chapters":[

    ],
    "format":{
        "filename":"a.mp4",
        "nb_streams":2,
        "nb_programs":0,
        "format_name":"mov,mp4,m4a,3gp,3g2,mj2",
        "format_long_name":"QuickTime / MOV",
        "start_time":