Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在PHP中使用ff mpeg剪裁mp3歌曲_Php_Ffmpeg - Fatal编程技术网

如何在PHP中使用ff mpeg剪裁mp3歌曲

如何在PHP中使用ff mpeg剪裁mp3歌曲,php,ffmpeg,Php,Ffmpeg,我需要在PHP中使用ff mpeg来修剪mp3歌曲 I tried some code :- $fpath = 'D:\xampp-portable\htdocs\songs\ffmpeg\bin\ffmpeg.exe'; $song_path = 'D:/xampp-portable/htdocs/songs/uploads/mp3/test10.mp3'; $sample_song_path = 'D:/xampp-portable/

我需要在PHP中使用ff mpeg来修剪mp3歌曲

    I tried some code :- 
        $fpath = 'D:\xampp-portable\htdocs\songs\ffmpeg\bin\ffmpeg.exe';
        $song_path = 'D:/xampp-portable/htdocs/songs/uploads/mp3/test10.mp3';
        $sample_song_path = 'D:/xampp-portable/htdocs/songs/uploads/mp3/sample/test10.mp3';
        exec("$fpath -ss 10 -i '".$song_path."' -t 6 '".$sample_song_path."' 2>&1",$out_put);
        var_dump($out_put);
这里我得到了如下的错误信息

I got output as :- 

Array
(
    [0] => FFmpeg version git-N-28582-g2a0d4d4, Copyright (c) 2000-2011 the FFmpeg developers
    [1] =>   built on Mar 23 2011 14:50:54 with gcc 4.5.2
    [2] =>   configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-memalign-hack --arch=i686 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --extra-libs='-lrtmp -lssl -lcrypto -lws2_32 -lgdi32 -lwinmm -lz -lx264 -lpthreadGC2' --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib --extra-cflags=-I/home/kyle/software/ffmpeg/external-libs/32-bit/include --extra-ldflags=-L/home/kyle/software/ffmpeg/external-libs/32-bit/lib --pkg-config=pkg-config
    [3] =>   libavutil    50. 40. 0 / 50. 40. 0
    [4] =>   libavcodec   52.114. 0 / 52.114. 0
    [5] =>   libavformat  52.103. 0 / 52.103. 0
    [6] =>   libavdevice  52.  3. 0 / 52.  3. 0
    [7] =>   libavfilter   1. 76. 0 /  1. 76. 0
    [8] =>   libswscale    0. 12. 0 /  0. 12. 0
    [9] => 'D:/xampp-portable/htdocs/melodic_svn/uploads/mp3/test10.mp3': Invalid data found when processing input
)

我怎样才能解决这个问题。请帮帮我。

在一种情况下,您使用的是斜杠,而在另一种情况下使用的是反斜杠(
$fpath
$song\u path


首先,确保通过
exec
执行的整个命令正确无误
Echo
it并将其粘贴到终端中以检查其是否工作。开始调试以缩小可能出现的问题。

是的,这是用于修剪乐曲的命令,exec($fpath-ss10-i’。$song\u path。“-t6’。$sample\u song\u path。“'2>&1”,$out\u put);