【问题标题】:How to dynamically cut short an mp3 file in php [duplicate]如何在php中动态缩短mp3文件[重复]
【发布时间】:2012-04-11 18:21:09
【问题描述】:

可能重复:
Automatically trimming a mp3 in PHP

我目前正在通过 php 提供 mp3 文件,就像这个问题中描述的方法一样:Can I serve MP3 files with PHP?

$track = "sometrack.mp3";

if(file_exists($track)) {
    header("Content-Transfer-Encoding: binary"); 
    header("Content-Type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3");
    header('Content-length: ' . filesize($track));
    header('Content-Disposition: filename="sometrack.mp3"');
    header('X-Pad: avoid browser bug');
    header('Cache-Control: no-cache');
    print file_get_contents($track);
} else {
    echo "no file";
}

我怎样才能提供剪切的 mp3。就像我想取出文件中的前 XX 秒并直接从 XX 秒提供它,这样用户只能从 XX 秒而不是从 00 秒获取它

【问题讨论】:

  • 您需要一个可以剪切 mp3 文件的程序吗? - mp3splt.sourceforge.net/mp3splt_page/home.php
  • @hakre 是的。我需要动态剪切 mp3 中的 XX 部分。我需要为此编写一个程序,所以想知道如何做。
  • 你可以输出部分字节大小的文件,但是如果你想检测mp3上的时间线,你必须使用一个库来操作mp3
  • 可以使用 PHP mp3 库。

标签: php file-io mp3 file-get-contents


【解决方案1】:

您可以安装mp3splt 来创建一个简短的版本。使用 shell_exec() 执行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-04
    • 1970-01-01
    • 1970-01-01
    • 2012-04-11
    • 1970-01-01
    • 1970-01-01
    • 2011-09-22
    相关资源
    最近更新 更多