I want to play a video file (h264) with Asterisk version 14.7.6. It is running on a Raspberry Pi.

I'm assuming that the Playback application is my best choice for this. But when Asterisk tries to access the file, I get the following errors:

[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

Here's snippets of some of the relevant configuration files on my system:


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


[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

'core show codecs' in 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 scan on video file:

root@sipserver:~# mediainfo --fullscan MyVideo.h264
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

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                           : Main@L3.1
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                            : Main@L3.1
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

What I've tried:

  • Replacing the Playback parameter to use the full file path. For example: Playback(/root/MyVideo.h264)
  • Trying mp4 video format (changing both encoding and file names)
  • Placing the video file in my 'astdatadir' (/usr/share/asterisk/)
  • Placing the video file in my sounds directory (/var/lib/asterisk/sounds/en/)
  • Changing permissions of the video file to 777
  • Omitting the file extension in the Playback command. For example: Playback(MyVideo)
  • Downgrading Asterisk to 11.16.0 (down from 14.7.6)

Some articles I've read but haven't helped:

  • You seem to misunderstand the difference between a codec and a container format. .avi, .mkv, .mp4 etc are container formats, which can use one of many audio and video codecs. The container format h264 does not exist. Also just changing the extension of a file won't trick the system: this is not Windows, the filetype evaluation is done on a different level
    – Bruno9779
    May 29 '18 at 19:10
  • @Bruno9779 Thanks for your comment. The video file uses the h.264 codec. Sorry if my information provided was confusing. Perhaps it was better if I said "I tried using an arbitrary .mp4 file and that didn't work". That being said, what do you recommend for getting Asterisk to play this type of file (video file encoded with h.264)?
    – MD-7
    May 29 '18 at 19:23
  • In part it depends from the container format. You appear to have the right codecs installed, but what about the CF? Matroska video, eg, needs some extra packages to be installed. You should post more info about the REAL file you want to play.
    – Bruno9779
    May 29 '18 at 19:36
  • root@sipserver:~# file MyVideo.h264 MyVideo.h264: JVT NAL sequence, H.264 video, main @ L 31 Does this help?
    – MD-7
    May 29 '18 at 19:57
  • The video has no audio component, by the way
    – MD-7
    May 29 '18 at 20:01

You have forgotten one thing: asterisk is NOT video player, it is PBX.

It will play only raw file encoded by codec you currently using for video. It will not play other video format, it will NEVER try convert video to other format.

You have use Record app while in video session to get raw file.

Compare file format you get with what you trying to play.

Again. Video format or codec change is not something which asterisk will try to do. Use ffmepg or other lib/player.

  • Thank you for your answer. You have pushed me to check the file formats more closely and it does look like the Playback and Background Asterisk apps are requiring me to use a .h264 file for video and .ulaw file for audio. However, when I use an arbitrary .ulaw audio file, but encode my own .h264 file with ffmpeg, I get this error: format_h264.c:74 h264_read: Length 26468 is too long. In this case, the audio plays but the video is blank. Do you have any tips on encoding an RTSP stream with ffmpeg into a format compatible with Asterisk?
    – MD-7
    Jun 7 '18 at 19:41
  • A comment on the above - I also tried to encode to a .h263 format and used that file. Asterisk gave no errors, but the video was still black.
    – MD-7
    Jun 7 '18 at 19:43
  • No, Playback and Record app require you format be exactly same as format you use on device. Device should use ONE format only. Asterisk have no MCU capabilities, it just send stream. Again, record format from your phone and you will know what needed. Format(codec,resolution, bitrate, fps) is device-specific for video.
    – arheops
    Jun 8 '18 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.