sheng-tool
    Preparing search index...

    Function detectVideoFileFormat

    • 按常见视频容器的 magic bytes 推断视频格式。

      Parameters

      • bytes: ByteSource

        待检查的字节序列,可以是 Uint8Array、Buffer 或普通数字数组。

      Returns "mp4" | "webm" | null

      识别到的视频格式;无法识别时返回 null。

      0.2.0

      detectVideoFileFormat(new Uint8Array([0x1a, 0x45, 0xdf, 0xa3]))   // 'webm'
      detectVideoFileFormat(new Uint8Array([71, 73, 70, 56, 57, 97])) // null