You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

mpegts.js加载avc1.640028隔行视频在Chrome无法播放的问题求助

mpegts.js加载avc1.640028隔行视频在Chrome无法播放的问题求助

我正在使用mpegts.js库处理直播流播放,目标是播放用户提供的.ts格式直播地址。

遇到的核心问题是:隔行扫描的视频在Chrome浏览器中会显示黑屏,但在Firefox中播放完全正常。

我对比了mpegts解析的PMT(节目映射表)数据,发现了工作与不工作场景的关键差异:

正常工作的流PMT日志

[TSDemuxer] > Parsed first PMT: {"pid_stream_type":{"256":27,"257":3,"258":6},"common_pids":{"h264":256,"mp3":257},"pes_private_data_pids":{"258":true},"timed_id3_pids":{},"synchronous_klv_pids":{},"asynchronous_klv_pids":{},"scte_35_pids":{},"smpte2038_pids":{},"program_number":1,"version_number":0,"pcr_pid":256}

黑屏的流PMT日志

[TSDemuxer] > Parsed first PMT: {"pid_stream_type":{"256":27,"257":3},"common_pids":{"h264":256,"mp3":257},"pes_private_data_pids":{},"timed_id3_pids":{},"synchronous_klv_pids":{},"asynchronous_klv_pids":{},"scte_35_pids":{},"smpte2038_pids":{},"program_number":1,"version_number":0,"pcr_pid":256}

两者唯一的差异是:正常工作的流多了"258":6这个字段。


补充排查信息

我用ffprobe分析了两个视频的参数,发现了另一个关键差异:

  • 正常工作的视频:field_order: progressive(逐行扫描)
  • 黑屏的视频:field_order: tt(隔行扫描)

以下是正常工作视频的完整ffprobe输出:

{
    "programs": [
        {
            "program_id": 1,
            "program_num": 1,
            "nb_streams": 2,
            "pmt_pid": 4096,
            "pcr_pid": 256,
            "tags": {
                "service_name": "Service01",
                "service_provider": "FFmpeg"
            },
            "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": "[27][0][0][0]",
                    "codec_tag": "0x001b",
                    "width": 1280,
                    "height": 720,
                    "coded_width": 1280,
                    "coded_height": 720,
                    "closed_captions": 0,
                    "film_grain": 0,
                    "has_b_frames": 2,
                    "sample_aspect_ratio": "1:1",
                    "display_aspect_ratio": "16:9",
                    "pix_fmt": "yuv420p",
                    "level": 31,
                    "color_range": "tv",
                    "color_space": "bt709",
                    "color_transfer": "bt709",
                    "color_primaries": "bt709",
                    "chroma_location": "left",
                    "field_order": "progressive",
                    "refs": 1,
                    "is_avc": "false",
                    "nal_length_size": "0",
                    "ts_id": "1",
                    "ts_packetsize": "188",
                    "id": "0x100",
                    "r_frame_rate": "25/1",
                    "avg_frame_rate": "25/1",
                    "time_base": "1/90000",
                    "start_pts": 133200,
                    "start_time": "1.480000",
                    "duration_ts": 2710800,
                    "duration": "30.120000",
                    "bits_per_raw_sample": "8",
                    "extradata_size": 51,
                    "disposition": {
                        "default": 0,
                        "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,
                        "non_diegetic": 0,
                        "captions": 0,
                        "descriptions": 0,
                        "metadata": 0,
                        "dependent": 0,
                        "still_image": 0,
                        "multilayer": 0
                    }
                },
                {
                    "index": 1,
                    "codec_name": "aac",
                    "codec_long_name": "AAC (Advanced Audio Coding)",
                    "profile": "LC",
                    "codec_type": "audio",
                    "codec_tag_string": "[15][0][0][0]",
                    "codec_tag": "0x000f",
                    "sample_fmt": "fltp",
                    "sample_rate": "48000",
                    "channels": 2,
                    "channel_layout": "stereo",
                    "bits_per_sample": 0,
                    "initial_padding": 0,
                    "ts_id": "1",
                    "ts_packetsize": "188",
                    "id": "0x101",
                    "r_frame_rate": "0/0",
                    "avg_frame_rate": "0/0",
                    "time_base": "1/90000",
                    "start_pts": 127200,
                    "start_time": "1.413333",
                    "duration_ts": 2693760,
                    "duration": "29.930667",
                    "bit_rate": "131241",
                    "disposition": {
                        "default": 0,
                        "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,
                        "non_diegetic": 0,
                        "captions": 0,
                        "descriptions": 0,
                        "metadata": 0,
                        "dependent": 0,
                        "still_image": 0,
                        "multilayer": 0
                    }
                }
            ]
        }
    ],
    "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": "[27][0][0][0]",
            "codec_tag": "0x001b",
            "width": 1280,
            "height": 720,
            "coded_width": 1280,
            "coded_height": 720,
            "closed_captions": 0,
            "film_grain": 0,
            "has_b_frames": 2,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "16:9",
            "pix_fmt": "yuv420p",
            "level": 31,
            "color_range": "tv",
            "color_space": "bt709",
            "color_transfer": "bt709",
            "color_primaries": "bt709",
            "chroma_location": "left",
            "field_order": "progressive",
            "refs": 1,
            "is_avc": "false",
            "nal_length_size": "0",
            "ts_id": "1",
            "ts_packetsize": "188",
            "id": "0x100",
            "r_frame_rate": "25/1",
            "avg_frame_rate": "25/1",
            "time_base": "1/90000",
            "start_pts": 133200,
            "start_time": "1.480000",
            "duration_ts": 2710800,
            "duration": "30.120000",
            "bits_per_raw_sample": "8",
            "extradata_size": 51,
            "disposition": {
                "default": 0,
                "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,
                "non_diegetic": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0,
                "multilayer": 0
            }
        }
    ]
}

我对编解码、重封装/解封装这类技术不太熟悉,现在完全不知道该从哪个方向入手排查这个问题。


备注:内容来源于stack exchange,提问作者ciaksoy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 11:43:05