php - 使用 getID3 读取ios自录的wav的音频文件,读不到时长?
伊谢尔伦
伊谢尔伦 2017-05-16 13:04:06
0
1
605

我在网上下载的wav的文件,可以读到信息。正确的是这样:
php端我是使用的getID3 处理看音频信息!

array:15 [
  "GETID3_VERSION" => "1.9.14-201703261440"
  "filesize" => 18627884
  "filepath" => "C:/Windows"
  "filename" => "php20E6.tmp"
  "filenamepath" => "C:/Windows/php20E6.tmp"
  "avdataoffset" => 44
  "avdataend" => 18627884
  "fileformat" => "wav"
  "audio" => array:12 [
    "dataformat" => "wav"
    "bitrate_mode" => "cbr"
    "wformattag" => 1
    "streams" => array:1 [
      0 => array:10 [
        "codec" => "Pulse Code Modulation (PCM)"
        "channels" => 2
        "sample_rate" => 44100
        "bitrate" => 1411200
        "bits_per_sample" => 16
        "wformattag" => 1
        "bitrate_mode" => "cbr"
        "lossless" => true
        "dataformat" => "wav"
        "compression_ratio" => 1
      ]
    ]
    "codec" => "Pulse Code Modulation (PCM)"
    "channels" => 2
    "sample_rate" => 44100
    "bitrate" => 1411200
    "bits_per_sample" => 16
    "lossless" => true
    "channelmode" => "stereo"
    "compression_ratio" => 1
  ]
  "encoding" => "UTF-8"
  "mime_type" => "audio/x-wav"
  "riff" => array:5 [
    "raw" => array:1 [
      "fmt " => array:6 [
        "wFormatTag" => 1
        "nChannels" => 2
        "nSamplesPerSec" => 44100
        "nAvgBytesPerSec" => 176400
        "nBlockAlign" => 4
        "wBitsPerSample" => 16
      ]
    ]
    "audio" => array:1 [
      0 => array:5 [
        "codec" => "Pulse Code Modulation (PCM)"
        "channels" => 2
        "sample_rate" => 44100
        "bitrate" => 1411200
        "bits_per_sample" => 16
      ]
    ]
    "header_size" => 18627876
    "WAVE" => array:2 [
      "fmt " => array:1 [
        0 => array:3 [
          "offset" => 12
          "size" => 16
          "data" => b"\x01\x00\x02\x00D¬\x00\x00\x10±\x02\x00\x04\x00\x10\x00"
        ]
      ]
      "data" => array:1 [
        0 => array:2 [
          "offset" => 36
          "size" => 18627840
        ]
      ]
    ]
    "encoding" => "ISO-8859-1"
  ]
  "playtime_seconds" => 105.6
  "bitrate" => 1411200
  "playtime_string" => "1:46"
]

读取ios自录的音频的时候,就出现了 下列问题,我读取不到音频的时长。

array:7 [
  "GETID3_VERSION" => "1.9.14-201703261440"
  "filesize" => 115223
  "filepath" => "C:/Windows"
  "filename" => "phpAA25.tmp"
  "filenamepath" => "C:/Windows/phpAA25.tmp"
  "encoding" => "UTF-8"
  "error" => array:1 [
    0 => "unable to determine file format"
  ]
]

谁遇到过这种问题啊,求指导啊!

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

Antworte allen(1)
黄舟

iOS这个设备我不太清楚,如果getID3解决不了这个问题

建议使用 FFMPEG 的来读取,前提是服务端安装ffmpeg

$ffprobe = FFMpeg\FFProbe::create();
print_r ($ffprobe ->format('/path/to/wav')->all());
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!