mtripg6666tdr / Discord-SimpleMusicBot

🤖データベース不要のDiscord向けの音楽ボット / Music Bot for Discord with no database needed.
https://web.usamyon.moe/Discord-SimpleMusicBot/
GNU General Public License v3.0
60 stars 22 forks source link

`frame` コマンドで画像が取得できない #187

Closed Khsmty closed 2 years ago

Khsmty commented 2 years ago

バグを説明してください frame コマンドを使用すると、0B のファイルが返ってくる。

再現手段 曲の再生中に frame コマンドを実行した。

Screenshots Screenshot_20220228_030944

環境 クライアント: Android 版 Ver.113.8 ホスト: OCI (Oracle Linux 8)

その他 特になし

mtripg6666tdr commented 2 years ago

issueありがとうございます。 こちらのバグに関して、もしよろしければ再生していた音楽のURL等を教えて頂きたいです。

Khsmty commented 2 years ago

全ての音楽で発生するようですね...

mtripg6666tdr commented 2 years ago

replでのホストでは発生しない現象なんですよね、、、 ffmpeg-staticがインストールされているか確認していただけますか? ffmpeg-staticがインストール出来なければ自分でffmpegをインストールすることになります。 基本的には0バイトの画像が送信されるということは、ffmpegが何らかのエラーを吐いてるのかなあとは思います。

Khsmty commented 2 years ago

ffmpeg-static はインストール済みでした

image

mtripg6666tdr commented 2 years ago

ffmpegのバージョンや構成を確認したいので、package.jsonがあるディレクトリで

node -e "require('child_process').exec(require('ffmpeg-static')+' -h', console.log)"

していただけますか?

Khsmty commented 2 years ago

以下のように出力されました。

[opc@instance MusicBot]$ node -e "require('child_process').exec(require('ffmpeg-static')+' -h', console.log)"
null Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Getting help:
    -h      -- print basic options
    -h long -- print more options
    -h full -- print all options (including all format and codec specific options, very long)
    -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol
    See man ffmpeg for detailed description of the options.

Print help / information / capabilities:
-L                  show license
-h topic            show help
-? topic            show help
-help topic         show help
--help topic        show help
-version            show version
-buildconf          show build configuration
-formats            show available formats
-muxers             show available muxers
-demuxers           show available demuxers
-devices            show available devices
-codecs             show available codecs
-decoders           show available decoders
-encoders           show available encoders
-bsfs               show available bit stream filters
-protocols          show available protocols
-filters            show available filters
-pix_fmts           show available pixel formats
-layouts            show standard channel layouts
-sample_fmts        show available audio sample formats
-colors             show available color names
-sources device     list sources of the input device
-sinks device       list sinks of the output device
-hwaccels           show available HW acceleration methods

Global options (affect whole program instead of just one file):
-loglevel loglevel  set logging level
-v loglevel         set logging level
-report             generate a report
-max_alloc bytes    set maximum size of a single allocated block
-y                  overwrite output files
-n                  never overwrite output files
-ignore_unknown     Ignore unknown stream types
-filter_threads     number of non-complex filter threads
-filter_complex_threads  number of threads for -filter_complex
-stats              print progress report during encoding
-max_error_rate maximum error rate  ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an 
error instead of success.
-bits_per_raw_sample number  set the number of bits per raw sample
-vol volume         change audio volume (256=normal)

Per-file main options:
-f fmt              force format
-c codec            codec name
-codec codec        codec name
-pre preset         preset name
-map_metadata outfile[,metadata]:infile[,metadata]  set metadata information of outfile from infile
-t duration         record or transcode "duration" seconds of audio/video
-to time_stop       record or transcode stop time
-fs limit_size      set the limit file size in bytes
-ss time_off        set the start time offset
-sseof time_off     set the start time offset relative to EOF
-seek_timestamp     enable/disable seeking by timestamp with -ss
-timestamp time     set the recording timestamp ('now' to set the current time)
-metadata string=string  add metadata
-program title=string:st=number...  add program with specified streams
-target type        specify target file type ("vcd", "svcd", "dvd", "dv" or "dv50" with optional prefixes "pal-", "ntsc-" or "
film-")
-apad               audio pad
-frames number      set the number of frames to output
-filter filter_graph  set stream filtergraph
-filter_script filename  read stream filtergraph description from a file
-reinit_filter      reinit filtergraph on input parameter changes
-discard            discard
-disposition        disposition

Video options:
-vframes number     set the number of video frames to output
-r rate             set frame rate (Hz value, fraction or abbreviation)
-fpsmax rate        set max frame rate (Hz value, fraction or abbreviation)
-s size             set frame size (WxH or abbreviation)
-aspect aspect      set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
-bits_per_raw_sample number  set the number of bits per raw sample
-vn                 disable video
-vcodec codec       force video codec ('copy' to copy stream)
-timecode hh:mm:ss[:;.]ff  set initial TimeCode value.
-pass n             select the pass number (1 to 3)
-vf filter_graph    set video filters
-ab bitrate         audio bitrate (please use -b:a)
-b bitrate          video bitrate (please use -b:v)
-dn                 disable data

Audio options:
-aframes number     set the number of audio frames to output
-aq quality         set audio quality (codec-specific)
-ar rate            set audio sampling rate (in Hz)
-ac channels        set number of audio channels
-an                 disable audio
-acodec codec       force audio codec ('copy' to copy stream)
-vol volume         change audio volume (256=normal)
-af filter_graph    set audio filters

Subtitle options:
-s size             set frame size (WxH or abbreviation)
-sn                 disable subtitle
-scodec codec       force subtitle codec ('copy' to copy stream)
-stag fourcc/tag    force subtitle tag/fourcc
-fix_sub_duration   fix subtitles duration
-canvas_size size   set canvas size (WxH or abbreviation)
-spre preset        set the subtitle options to the indicated preset

 ffmpeg version 4.4.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disab
le-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enab
le-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-lib
opencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorb
is --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-l
ibx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzimg
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
mtripg6666tdr commented 2 years ago

image2pipeフォーマットのpngコーデックを使用してるので、それぞれ確認していただきたいです ffmpegの実行ファイルは、node_modules/ffmpeg-static/にあります。 image2pipeが使えるか確認するには、

ffmpeg -loglevel 1 -formats | grep -e image2pipe

pngが使えるか確認するには、

ffmpeg -loglevel 1 -codecs | grep -e png

それぞれ確認をお願いします。

Khsmty commented 2 years ago

以下のようになりました。

$ ffmpeg -loglevel 1 -formats | grep -e image2pipe
null  DE image2pipe      piped image2 sequence
$ ffmpeg -loglevel 1 -codecs | grep -e png
null  DEV..S apng                 APNG (Animated Portable Network Graphics) image
 DEV..S png                  PNG (Portable Network Graphics) image
mtripg6666tdr commented 2 years ago

ぜんぶ環境はそろってるみたいですね、、、、 まったく理由が分からないです、、 ちなみにframeコマンドの処理はこちらです https://github.com/mtripg6666tdr/Discord-SimpleMusicBot/blob/master/src/Commands/frame.ts

mtripg6666tdr commented 2 years ago

あ、そういえば、プロキシを使用していませんか?

Khsmty commented 2 years ago

使用してないですね、、

config.json は "proxy": "", になっています

mtripg6666tdr commented 2 years ago

調査のためのブランチを作成しました https://github.com/mtripg6666tdr/Discord-SimpleMusicBot/tree/issue/187 お手数ですがissue/187ブランチをチェックアウトしていただいて、その構成で現象を再現していただくと、package.jsonとおなじディレクトリにframeRetrive.logが生成されていると思います。 そちらのログファイルとコンソールに表示されているログの内容を、(IPアドレス等の個人情報が含まれている可能性がありますので、)DiscordのDMにお送りいただけますでしょうか。 (変更点はこちら)

mtripg6666tdr commented 2 years ago

再現できないため閉じます 新しい情報があれば再度開いてくださいますようお願いします