laravel - 将 ffmpeg 命令输出存储到 aws s3
问题描述
我在下面运行的命令在本地文件系统中运行良好。
命令:
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);
推荐阅读
- android - 如何通过蓝牙/wifi 使用两个连接的设备捕获图像
- shopify - 如果文章包含特定标签,则从博客主页中排除文章?
- r - purrr:使用 map 迭代命名列表(使用函数工厂)
- javascript - 正则表达式仅在其他字符不存在时匹配结束字符
- html - 我似乎无法使文本居中
- javascript - ReactNative 与 Mobx - Flatlist 无限请求项目
- php - Laravel Eloquent:是否 $pay->sum('amount'); 对数据库执行另一个查询?
- javascript - 不能两次更改元素的类型?
- twitter-bootstrap - 为什么这些引导 col 元素没有在移动设备中堆叠
- c# - 每次呈现页面时单击 GridView 行