wechaty / wechaty-puppet-padplus

DEPRECATED: One puppet based on iPad protocal for Wechaty
https://wechaty.js.org/docs/puppet-services/
313 stars 64 forks source link

when i use `Filebox.fromUrl()` , will log Cannot find `ffmpeg` #326

Closed KAWATAAAAAA closed 1 year ago

KAWATAAAAAA commented 1 year ago

1. Versions

2. Describe the bug

我确认我本地安装了ffmpeg,并且ffmpeg正常工作

ffmpeg -version

image

3. To Reproduce

  1. 发送视频消息

  2. 使用room.say(Filebox.fromUrl(xxxx))

  3. 在大概n秒后控制台报错,出现 Cannot find 'ffmpeg'

4. Expected behavior

依赖正常调起 系统全局环境的ffmpeg

5. Actual behavior

cannot find ffmpeg

6. Full Output Logs

Show Logs ```shell 16:28:45 VERB PuppetRoomMixin roomPayloadDirty(38989743377@chatroom) 16:28:45 VERB PuppetCacheMixin __dirtyPayloadAwait(Room<3>, 38989743377@chatroom) 16:28:45 VERB PuppetCacheMixin dirtyPayload(Room<3>, 38989743377@chatroom) 16:28:45 SILL Room find({"id":"38989743377@chatroom"}) 16:28:45 SILL Room ready() 16:28:45 VERB PuppetCacheMixin onDirty(Room<3>, 38989743377@chatroom) 16:28:45 SILL Room ready() 16:28:45 VERB PuppetRoomMixin roomPayload(38989743377@chatroom) 16:28:45 SILL PuppetRoomMixin roomPayloadCache(38989743377@chatroom) cache MISS 16:28:45 SILL PuppetPadplus roomRawPayload(38989743377@chatroom) 16:28:45 VERB PuppetRoomMemberMixin roomMemberPayloadDirty(38989743377@chatroom) 16:28:45 VERB PuppetCacheMixin __dirtyPayloadAwait(RoomMember<4>, 38989743377@chatroom) 16:28:45 VERB PuppetCacheMixin dirtyPayload(RoomMember<4>, 38989743377@chatroom) 16:28:45 SILL Room find({"id":"38989743377@chatroom"}) 16:28:45 SILL Room ready() 16:28:45 VERB PuppetCacheMixin onDirty(RoomMember<4>, 38989743377@chatroom) 16:28:45 SILL Room ready() 16:28:45 SILL PuppetPadplus roomRawPayloadParser() 16:28:45 SILL PuppetRoomMixin roomPayload(38989743377@chatroom) cache SET 16:28:45 SILL PuppetPadplus roomMemberList(38989743377@chatroom) 16:28:45 SILL Room ready() 16:28:45 VERB PuppetRoomMixin roomPayload(38989743377@chatroom) 16:28:45 SILL PuppetPadplus roomMemberList(38989743377@chatroom) 16:28:45 SILL Contact find({"id":"sugarorz"}) 16:28:45 SILL PuppetLoginMixin get currentUserId() 16:28:45 SILL Contact ready() @ Puppet(./remember-me/puppet_padplus_803f4f5edcc8f6a7) with id="sugarorz" 16:28:45 SILL Contact ready() isReady() true 16:28:45 SILL Contact find({"id":"q1195862472"}) 16:28:45 SILL PuppetLoginMixin get currentUserId() 16:28:45 SILL Contact ready() @ Puppet(./remember-me/puppet_padplus_803f4f5edcc8f6a7) with id="q1195862472" 16:28:45 SILL Contact ready() isReady() true 16:28:45 SILL Contact find({"id":"wxid_t5yc8g6a63rz22"}) 16:28:45 SILL PuppetLoginMixin get currentUserId() 16:28:45 SILL Contact ready() @ Puppet(./remember-me/puppet_padplus_803f4f5edcc8f6a7) with id="wxid_t5yc8g6a63rz22" 16:28:45 SILL Contact ready() isReady() true 16:28:45 SILL Contact find({"id":"sugarorz"}) 16:28:45 SILL PuppetLoginMixin get currentUserId() 16:28:45 SILL Contact ready() @ Puppet(./remember-me/puppet_padplus_803f4f5edcc8f6a7) with id="sugarorz" 16:28:45 SILL Contact ready() isReady() true 16:28:45 SILL Contact find({"id":"q1195862472"}) 16:28:45 SILL PuppetLoginMixin get currentUserId() 16:28:45 SILL Contact ready() @ Puppet(./remember-me/puppet_padplus_803f4f5edcc8f6a7) with id="q1195862472" 16:28:45 SILL Contact ready() isReady() true 16:28:45 SILL Contact find({"id":"wxid_t5yc8g6a63rz22"}) 16:28:45 SILL PuppetLoginMixin get currentUserId() 16:28:45 SILL Contact ready() @ Puppet(./remember-me/puppet_padplus_803f4f5edcc8f6a7) with id="wxid_t5yc8g6a63rz22" 16:28:45 SILL Contact ready() isReady() true 16:28:45 VERB Room say(FileBox#Url<1105161435.mp4>, ) 16:28:45 SILL PuppetPadplus messageSendFile(38989743377@chatroom) [2023-03-27T16:28:45.169+08:00] [INFO] [68028] [] [wuyuweideMacBook-Pro.local] [172.21.144.49] [wechaty-robot] [] [] [] [] [2193ms , requestInfo:{"method":"POST","url":"/robot/test","host":"127.0.0.1:3000"}] ## '' 16:28:46 SILL GRPC_GATEWAY keepHeartbeat() 16:28:46 SILL GRPC_GATEWAY GRPC Request ApiType: HEARTBEAT 16:28:46 SILL GRPC_GATEWAY throttleQueue emit heartbeat. 16:28:46 VERB Watchdog feed({"data":"96a673ae-13f3-40ec-9d9f-22e0b9aa28f0"}) 16:28:46 VERB Watchdog timerLeft() = 29870 16:28:46 VERB Watchdog stopTimer() 16:28:46 VERB Watchdog startTimer() 16:29:00 SILL PuppetPadplus file url : https://front-xps-cdn.xsyx.xyz/custom/day360/2022/03/11/1105161435.mp4 16:29:00 SILL PuppetPadplus fileType video/mp4 16:29:00 SILL PuppetLoginMixin get currentUserId() 16:29:00 SILL PadplusManager sendVideo(wxid_00j4zrd47usu12, 38989743377@chatroom, https://front-xps-cdn.xsyx.xyz/custom/day360/2022/03/11/1105161435.mp4) 16:29:00 ERR Config ########################### 16:29:00 ERR Config Wechaty unhandledRejection: Error: Cannot find ffmpeg at /Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/processor.js:136:22 at FfmpegCommand.proto._getFfmpegPath (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/capabilities.js:90:14) at FfmpegCommand.proto._spawnFfmpeg (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/processor.js:132:10) at FfmpegCommand.proto.availableFormats.proto.getAvailableFormats (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/capabilities.js:517:10) at /Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/capabilities.js:568:14 at nextTask (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/async/dist/async.js:5789:13) at Object.waterfall (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/async/dist/async.js:5800:9) at Object.awaitable [as waterfall] (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/async/dist/async.js:211:32) at FfmpegCommand.proto._checkCapabilities (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/capabilities.js:565:11) at /Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/processor.js:298:14 [object Promise] 16:29:00 ERR Config ########################### 16:29:00 ERR Config process.on(unhandledRejection) promise.catch(Cannot find ffmpeg) Config Error: Cannot find ffmpeg at /Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/processor.js:136:22 at FfmpegCommand.proto._getFfmpegPath (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/capabilities.js:90:14) at FfmpegCommand.proto._spawnFfmpeg (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/processor.js:132:10) at FfmpegCommand.proto.availableFormats.proto.getAvailableFormats (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/capabilities.js:517:10) at /Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/capabilities.js:568:14 at nextTask (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/async/dist/async.js:5789:13) at Object.waterfall (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/async/dist/async.js:5800:9) at Object.awaitable [as waterfall] (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/async/dist/async.js:211:32) at FfmpegCommand.proto._checkCapabilities (/Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/capabilities.js:565:11) at /Users/wuyuwei/MyWork/wechaty-robot/node_modules/fluent-ffmpeg/lib/processor.js:298:14 (node:68028) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 3) ```

7. Additional context

await to.say(FileBox.fromUrl(message.content));
su-chang commented 1 year ago

可以执行以下命令看看输出结果

 whereis ffmpeg # OUTPUT: ffmpeg: /usr/local/bin/ffmpeg /usr/local/share/man/man1/ffmpeg.1
su-chang commented 1 year ago

针对这个问题,我们通过调整代码,尝试自动获取ffmpeg的安装路径,看看是否可以解决。

需要更新版本 @juzi/wechaty-puppet-padplus@1.2.7

KAWATAAAAAA commented 1 year ago
whereis ffmpeg
image
KAWATAAAAAA commented 1 year ago

针对这个问题,我们通过调整代码,尝试自动获取ffmpeg的安装路径,看看是否可以解决。

需要更新版本 @juzi/wechaty-puppet-padplus@1.2.7

仍然不能解决这个问题,等待了几分钟say方法依然没有返回最终结果,这个promise 得不到 resolve 或者 reject , 详细日志:


10:04:11 SILL Room find({"id":"38855146613@chatroom"})
10:04:11 SILL Room ready()
10:04:11 SILL PuppetLoginMixin get currentUserId()
10:04:11 SILL PuppetPadplus roomMemberList(38855146613@chatroom)
areyousure true
10:04:11 VERB Room say(FileBox#Url<1105161435.mp4>, )
10:04:11 SILL PuppetPadplus messageSendFile(38855146613@chatroom)
10:04:23 SILL PuppetPadplus file url : https://front-xps-cdn.xsyx.xyz/custom/day360/2022/03/11/1105161435.mp4
10:04:23 SILL PuppetPadplus fileType video/mp4
10:04:23 SILL PuppetLoginMixin get currentUserId()
10:04:23 SILL PadplusManager sendVideo(wxid_00j4zrd47usu12, 38855146613@chatroom, https://front-xps-cdn.xsyx.xyz/custom/day360/2022/03/11/1105161435.mp4)
10:04:23 INFO videoPreProcess ffmpegPath: /Users/wuyuwei/MyWork/wechaty-robot/node_modules/@ffmpeg-installer/darwin-x64/ffmpeg 
10:04:26 VERB PadplusMessage uploadFile
10:04:26 SILL RequestClient request()
10:04:26 SILL DedupeApi dedupe() no need to dedupe api UPLOAD_FILE.
10:04:26 SILL GRPC_GATEWAY GRPC Request ApiType: UPLOAD_FILE
10:04:41 SILL GRPC_GATEWAY keepHeartbeat()
10:04:41 SILL GRPC_GATEWAY GRPC Request ApiType: HEARTBEAT
10:04:41 SILL GRPC_GATEWAY throttleQueue emit heartbeat.
10:04:41 VERB Watchdog <Puppet> feed({"data":"3be4b1c8-7852-4803-81e5-f7fa2f0c558f"})
10:04:41 VERB Watchdog <Puppet> timerLeft() = 15813
10:04:41 VERB Watchdog <Puppet> stopTimer()
10:04:41 VERB Watchdog <Puppet> startTimer()
10:04:41 SILL PadplusManager setContactAndRoomData()
10:04:41 SILL PadplusManager setContactAndRoomData() found contact, room, friend data no change.
10:05:00 ERR GRPC_GATEWAY ApiType: UPLOAD_FILE request timeout, traceId: 24e6b875-9312-4a64-8296-56c3194ec6fd
10:05:00 ERR can not get response from grpc server 
10:05:00 VERB PadplusMessage sendMessage()
10:05:00 SILL RequestClient request()
10:05:00 SILL DedupeApi dedupe() no need to dedupe api SEND_MESSAGE.
10:05:00 SILL GRPC_GATEWAY GRPC Request ApiType: SEND_MESSAGE
10:05:11 SILL GRPC_GATEWAY keepHeartbeat()
10:05:11 SILL GRPC_GATEWAY GRPC Request ApiType: HEARTBEAT
10:05:11 SILL GRPC_GATEWAY throttleQueue emit heartbeat.
10:05:11 VERB Watchdog <Puppet> feed({"data":"13215f3d-1db8-489b-8882-f4f0c6c7a7ee"})
10:05:11 VERB Watchdog <Puppet> timerLeft() = 29887
10:05:11 VERB Watchdog <Puppet> stopTimer()
10:05:11 VERB Watchdog <Puppet> startTimer()
10:05:11 SILL PadplusManager setContactAndRoomData()
10:05:12 SILL PadplusManager setContactAndRoomData() found contact, room, friend data no change.
10:05:41 SILL GRPC_GATEWAY keepHeartbeat()
10:05:41 SILL GRPC_GATEWAY GRPC Request ApiType: HEARTBEAT
10:05:41 SILL GRPC_GATEWAY throttleQueue emit heartbeat.
10:05:41 VERB Watchdog <Puppet> feed({"data":"b22896c4-f45f-411a-ba59-6bc6da1cb030"})
10:05:41 VERB Watchdog <Puppet> timerLeft() = 29933
10:05:41 VERB Watchdog <Puppet> stopTimer()
10:05:41 VERB Watchdog <Puppet> startTimer()
10:05:41 SILL PadplusManager setContactAndRoomData()
10:05:42 SILL PadplusManager setContactAndRoomData() found contact, room, friend data no change.
10:06:11 SILL GRPC_GATEWAY keepHeartbeat()
10:06:11 SILL GRPC_GATEWAY GRPC Request ApiType: HEARTBEAT
10:06:11 SILL GRPC_GATEWAY throttleQueue emit heartbeat.
10:06:11 VERB Watchdog <Puppet> feed({"data":"6d6f4369-4950-4f44-95a9-46b2463a6514"})
10:06:11 VERB Watchdog <Puppet> timerLeft() = 29957
10:06:11 VERB Watchdog <Puppet> stopTimer()
10:06:11 VERB Watchdog <Puppet> startTimer()
10:06:11 SILL PadplusManager setContactAndRoomData()
10:06:12 SILL PadplusManager setContactAndRoomData() found contact, room, friend data no change.
10:06:41 SILL GRPC_GATEWAY keepHeartbeat()
10:06:41 SILL GRPC_GATEWAY GRPC Request ApiType: HEARTBEAT
10:06:41 SILL GRPC_GATEWAY throttleQueue emit heartbeat.
10:06:41 VERB Watchdog <Puppet> feed({"data":"72c8109b-5b9c-45c1-81e2-f02a2b3aed2a"})
10:06:41 VERB Watchdog <Puppet> timerLeft() = 29953
10:06:41 VERB Watchdog <Puppet> stopTimer()
10:06:41 VERB Watchdog <Puppet> startTimer()
10:06:41 SILL PadplusManager setContactAndRoomData()
10:06:43 SILL PadplusManager setContactAndRoomData() found contact, room, friend data no change.
10:07:11 SILL GRPC_GATEWAY keepHeartbeat()
10:07:11 SILL GRPC_GATEWAY GRPC Request ApiType: HEARTBEAT
10:07:11 SILL GRPC_GATEWAY throttleQueue emit heartbeat.
10:07:11 VERB Watchdog <Puppet> feed({"data":"518307f7-bc4b-4ee2-8f73-3cf590be5928"})
10:07:11 VERB Watchdog <Puppet> timerLeft() = 29960
10:07:11 VERB Watchdog <Puppet> stopTimer()
10:07:11 VERB Watchdog <Puppet> startTimer()
10:07:11 SILL PadplusManager setContactAndRoomData()
10:07:12 SILL PadplusManager setContactAndRoomData() found contact, room, friend data no change.
^[[1;2B^[[1;2B10:07:41 SILL GRPC_GATEWAY keepHeartbeat()
10:07:41 SILL GRPC_GATEWAY GRPC Request ApiType: HEARTBEAT
10:07:41 SILL GRPC_GATEWAY throttleQueue emit heartbeat.
10:07:41 VERB Watchdog <Puppet> feed({"data":"6cf11434-59e0-435d-a926-0d5d1fdd146f"})
10:07:41 VERB Watchdog <Puppet> timerLeft() = 29934
10:07:41 VERB Watchdog <Puppet> stopTimer()
10:07:41 VERB Watchdog <Puppet> startTimer()
10:07:41 SILL PadplusManager setContactAndRoomData()
10:07:42 SILL PadplusManager setContactAndRoomData() found contact, room, friend data no change.
10:08:00 ERR GRPC_GATEWAY ApiType: SEND_MESSAGE request timeout, traceId: fcdd3ad2-1a1f-4083-a748-e41a4dd1dd4a
发送消息失败
KAWATAAAAAA commented 1 year ago
image

这看起来是 ffmpeg 起了作用,已经成功的在我项目根目录生成了视频首帧poster了,但消息却未成功发送

su-chang commented 1 year ago

@KAWATAAAAAA 好的,那看样子这个问题应该是解决了,至于现在无法发送的问题,刚才查日志确认应该是上传缩率图所用的对象存储服务的key配置的有问题,晚点我处理下即可彻底解决该问题。

su-chang commented 1 year ago

@KAWATAAAAAA 已处理,可以再试下发送视频。

KAWATAAAAAA commented 1 year ago

@KAWATAAAAAA 已处理,可以再试下发送视频。

已验证,可以发送,谢谢