星號播放找不到影片文件

星號播放找不到影片文件

我想用 Asterisk 版本 14.7.6 播放影片檔 (h264)。它在 Raspberry Pi 上運行。

我假設播放應用程式是我的最佳選擇。但是當 Asterisk 嘗試存取該文件時,我收到以下錯誤:

[May 29 18:19:41] WARNING[1306][C-00000001]: file.c:774 ast_openstream_full: File MyVideo.h264 does not exist in any format
[May 29 18:19:41] WARNING[1306][C-00000001]: file.c:1247 ast_streamfile: Unable to open MyVideo.h264 (format (h264|ulaw)): No such file or directory
[May 29 18:19:41] WARNING[1306][C-00000001]: app_playback.c:494 playback_exec: Playback failed on SIP/7041-00000000 for MyVideo.h264

以下是我的系統上一些相關設定檔的片段:

/etc/asterisk/extensions.conf:

...
exten => 111,1,Answer()
exten => 111,n,Playback(MyVideo.h264)
exten => 111,n,Hangup()

/etc/asterisk/asterisk.conf:

[directories](!) ; remove the (!) to enable this
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astdbdir => /var/lib/asterisk
astkeydir => /var/lib/asterisk
astdatadir => /usr/share/asterisk
astagidir => /usr/share/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk
...

Asterisk CLI 中的「核心顯示編解碼器」:

sipserver*CLI> core show codecs
Disclaimer: this command is for informational purposes only.
        It does not indicate anything about your configuration.
      ID TYPE  NAME         FORMAT           DESCRIPTION
------------------------------------------------------------------------------------------------
      30 image png          png              (PNG Image)
       5 audio g726         g726             (G.726 RFC3551)
       3 audio alaw         alaw             (G.711 a-law)
       1 audio g723         g723             (G.723.1)
      19 audio speex        speex            (SpeeX)
      20 audio speex        speex16          (SpeeX 16khz)
      21 audio speex        speex32          (SpeeX 32khz)
      23 audio g722         g722             (G722)
      24 audio siren7       siren7           (ITU G.722.1 (Siren7, licensed from Polycom))
      31 video h261         h261             (H.261 video)
      32 video h263         h263             (H.263 video)
       7 audio adpcm        adpcm            (Dialogic ADPCM)
      41 audio silk         silk8            (SILK Codec (8 KHz))
      42 audio silk         silk12           (SILK Codec (12 KHz))
      43 audio silk         silk16           (SILK Codec (16 KHz))
      44 audio silk         silk24           (SILK Codec (24 KHz))
      27 audio g719         g719             (ITU G.719)
      33 video h263p        h263p            (H.263+ video)
      34 video h264         h264             (H.264 video)
      18 audio g729         g729             (G.729A)
       8 audio slin         slin             (16 bit Signed Linear PCM)
       9 audio slin         slin12           (16 bit Signed Linear PCM (12kHz))
      10 audio slin         slin16           (16 bit Signed Linear PCM (16kHz))
      11 audio slin         slin24           (16 bit Signed Linear PCM (24kHz))
      12 audio slin         slin32           (16 bit Signed Linear PCM (32kHz))
      13 audio slin         slin44           (16 bit Signed Linear PCM (44kHz))
      14 audio slin         slin48           (16 bit Signed Linear PCM (48kHz))
      15 audio slin         slin96           (16 bit Signed Linear PCM (96kHz))
      16 audio slin         slin192          (16 bit Signed Linear PCM (192kHz))
       2 audio ulaw         ulaw             (G.711 u-law)
      17 audio lpc10        lpc10            (LPC10)
      26 audio testlaw      testlaw          (G.711 test-law)
      40 audio none         none             (<Null> codec)
      37 video vp9          vp9              (VP9 video)
      36 video vp8          vp8              (VP8 video)
       4 audio gsm          gsm              (GSM)
      35 video mpeg4        mpeg4            (MPEG4 video)
      22 audio ilbc         ilbc             (iLBC)
      38 text  red          red              (T.140 Realtime Text with redundancy)
      39 text  t140         t140             (Passthrough T.140 Realtime Text)
      28 audio opus         opus             (Opus Codec)
      29 image jpeg         jpeg             (JPEG image)
       6 audio g726aal2     g726aal2         (G.726 AAL2)
      25 audio siren14      siren14          (ITU G.722.1 Annex C, (Siren14, licensed from Polycom))

mediainfo 掃描影片檔:

root@sipserver:~# mediainfo --fullscan MyVideo.h264
General
Count                                    : 322
Count of stream of this kind             : 1
Kind of stream                           : General
Kind of stream                           : General
Stream identifier                        : 0
Count of video streams                   : 1
Video_Format_List                        : AVC
Video_Format_WithHint_List               : AVC
Codecs Video                             : AVC
Complete name                            : MyVideo.h264
File name                                : MyVideo
File extension                           : h264
Format                                   : AVC
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format/Url                               : http://developers.videolan.org/x264.html
Format/Extensions usually used           : avc h264
Commercial name                          : AVC
Internet media type                      : video/H264
Codec                                    : AVC
Codec                                    : AVC
Codec/Info                               : Advanced Video Codec
Codec/Url                                : http://developers.videolan.org/x264.html
Codec/Extensions usually used            : avc h264
File size                                : 4976111
File size                                : 4.75 MiB
File size                                : 5 MiB
File size                                : 4.7 MiB
File size                                : 4.75 MiB
File size                                : 4.746 MiB
Overall bit rate mode                    : VBR
Overall bit rate mode                    : Variable
File last modification date              : UTC 2018-05-29 17:55:07
File last modification date (local)      : 2018-05-29 17:55:07

Video
Count                                    : 334
Count of stream of this kind             : 1
Kind of stream                           : Video
Kind of stream                           : Video
Stream identifier                        : 0
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format/Url                               : http://developers.videolan.org/x264.html
Commercial name                          : AVC
Format profile                           : [email protected]
Format settings                          : CABAC / 1 Ref Frames
Format settings, CABAC                   : Yes
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 1
Format settings, ReFrames                : 1 frame
Format settings, GOP                     : M=1, N=80
Internet media type                      : video/H264
Codec                                    : AVC
Codec                                    : AVC
Codec/Family                             : AVC
Codec/Info                               : Advanced Video Codec
Codec/Url                                : http://developers.videolan.org/x264.html
Codec profile                            : [email protected]
Codec settings                           : CABAC / 1 Ref Frames
Codec settings, CABAC                    : Yes
Codec_Settings_RefFrames                 : 1
Bit rate mode                            : VBR
Bit rate mode                            : Variable
Maximum bit rate                         : 1801984
Maximum bit rate                         : 1 802 kb/s
Width                                    : 800
Width                                    : 800 pixels
Height                                   : 480
Height                                   : 480 pixels
Sampled_Width                            : 800
Sampled_Height                           : 480
Pixel aspect ratio                       : 1.000
Display aspect ratio                     : 1.667
Display aspect ratio                     : 5:3
Resolution                               : 8
Resolution                               : 8 bits
Colorimetry                              : 4:2:0
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Chroma subsampling                       : 4:2:0
Bit depth                                : 8
Bit depth                                : 8 bits
Scan type                                : Progressive
Scan type                                : Progressive
Interlacement                            : PPF
Interlacement                            : Progressive
Buffer size                              : 2027200
Color range                              : Limited
colour_description_present               : Yes

我嘗試過的:

  • 替換 Playback 參數以使用完整檔案路徑。例如:Playback(/root/MyVideo.h264)
  • 嘗試mp4影片格式(更改編碼和檔案名稱)
  • 將視訊檔案放在我的“astdatadir”(/usr/share/asterisk/)中
  • 將影片檔案放在我的聲音目錄中(/var/lib/asterisk/sounds/en/)
  • 將視訊檔案的權限更改為777
  • 在播放命令中省略檔案副檔名。例如:Playback(MyVideo)
  • 將 Asterisk 降級至 11.16.0(從 14.7.6 降級)

我讀過但沒有幫助的一些文章:

答案1

您忘記了一件事:asterisk 不是視訊播放器,而是 PBX。

只會播放生的由您目前用於影片的編解碼器編碼的檔案。它不會播放其他視訊格式,它會絕不嘗試將影片轉換為其他格式。

你有用記錄應用程式在視訊會話中獲取原始檔案。

將您獲得的文件格式與您嘗試播放的文件格式進行比較。

再次。影片格式或編解碼器變更不是 asterisk 會嘗試做的事情。使用 ffmepg 或其他庫/播放器。

相關內容