我在下面运行的命令在本地文件系统中运行良好。
命令:
exec('ffmpeg -i '.config('medialibrary.s3.domain').'/listing_video/intro.mp4'.' -vf "drawtext=fontfile=' . storage_path('assets/video/FutuMd.ttf') . ': text=' . $request->get('intro_text') . ': x=300: y=450: fontsize=65: fontcolor=white: enable=\'between(t,2,5)\'" introfinal.mp4');
但我必须将文件直接存储到s3,所以我将存储文件的命令更改为s3,但文件大小为0B。
exec('ffmpeg -i '.config('medialibrary.s3.domain').'/listing_video/intro.mp4'.' -vf "drawtext=fontfile=' . storage_path('assets/video/FutuMd.ttf') . ': text=' . $request->get('intro_text') . ': x=300: y=450: fontsize=65: fontcolor=white: enable=\'between(t,2,5)\'" '.Storage::put('introfinal.mp4', '').'');
提前致谢!
最佳答案
这个例子并不完美,但会为您指明正确的方向:
exec('ffmpeg -i '.config('medialibrary.s3.domain').'/listing_video/intro.mp4'.' -vf "drawtext=fontfile=' . storage_path('assets/video/FutuMd.ttf') . ': text=' . $request->get('intro_text') . ': x=300: y=450: fontsize=65: fontcolor=white: enable=\'between(t,2,5)\'" introfinal.mp4');
$contents = file_get_contents('introfinal.mp4');
$success = Storage::put('introfinal.mp4', $contents);
关于laravel - 将 ffmpeg 命令输出存储到 aws s3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50406491/