• How to select audio, data, and/or video channel from a multi-channel MP4 file by using IMediaReaderActionNotify (ModuleMP4AudioChannelSelector)

    This module uses the IMediaReaderActionNotify listener interface to select audio channels from a multi-channel MP4 file. This module looks for the query parameter audioindex as part of the stream name to select audio channels from the MP4 file.

    For example, to play the first audio track, use the following stream name:
    Code:
    Server: rtmp://[wowza-ip-address]/vod
    Stream: mp4:sample.mp4?audioindex=0
    To play the second audio track, use the following stream name:
    Code:
    Server: rtmp://[wowza-ip-address]/vod
    Stream: mp4:sample.mp4?audioindex=1
    To play the second audio track with a HTTP streaming URL, use the following code:
    Code:
    http://[wowza-ip-address]:1935/vod/mp4:sample.mp4/playlist.m3u8?audioindex=1

    To play the second audio track with an RTSP streaming URL, use the following code:
    Code:
    rtsp://[wowza-ip-address]:1935/vod/mp4:sample.mp4?audioindex=1
    A compiled version of this module is included in the Wowza Module Collection.

    Configuration



    To enable this module, add the following module definition to your application. See Configuring Modules in the Quick Start Guide for details.

    Name
    Description
    Fully Qualified Class Name
    ModuleMP4AudioChannelSelector Selects audio channels from an MP4. com.wowza.wms.plugin.collection.module.ModuleMP4AudioChannelSelector

    Wowza server software and all components, including modules, source code, and other related items offered on this page, are copyrighted 20062014 by Wowza Media Systems, LLC, all rights reserved, and are licensed pursuant to the Wowza Media Software End User License Agreement.
    Updated: For Wowza Streaming Engine 4.0 on 02262014.
    Comments 74 Comments
    1. qstream -
      Is this also applicable for rtsp vod?
    1. rrlanham -
      Yes, it works for rtsp vod, updated recently for that.

      Richard
    1. qstream -
      Hi Richard,

      I've done some test on this module, it works to stream by using :

      Server: rtmp://[wowza-ip-address]/vod
      Stream: mp4:mytest.mp4?audioIndex=2

      but it didn't work for rtsp client using URL, it didn't take the query string into account :

      rtsp://[wowza-ip-address]:1935/vod/mytest.mp4?audioIndex=2

      is my test link wrong or does the Wowza server didn't support this?

      I'm using Wowza 2.2.3 developer version.

      Thanks in advance,

      qstream
    1. rrlanham -
      Please post the file with two audio tracks on a web server and send a link to download to support@wowzamedia.com

      Include a link to this thread.

      Richard
    1. qstream -
      Hi Richard,

      I've found the problem, I didn't copy the "public void onRTPSessionCreate(RTPSession rtpSession)" method.

      Thanks,

      qstream
    1. tomryan -
      Any chance we could get a ModuleMP4VideoChannelSelector module? It would be nice to be able to switch between video tracks.
    1. rrlanham -
      It is here:

      http://www.wowzamedia.com/forums/con...tify-interface

      And it is included in the Wowza pre-built Module Collection:

      http://www.wowzamedia.com/forums/con...ule-Collection

      Richard
    1. Kamlro -
      Hi,

      We tried to make it work with 2 audio tracks but it did not.

      We had to change the configuration info to :

      <Module>
      <Name>ModuleMP4AudioChannelSelector</Name>
      <Description>ModuleMP4AudioChannelSelector</Description>
      <Class>com.wowza.wms.plugin.collection.module.ModuleMP4AudioChannelSelector</Class>
      </Module>

      (in the class, change 'test' to 'collection').

      It now works perfectly.

      Do you know if there is a way to select a subtitle track (or not) thru a similar mechanism ?

      Thanks and have a nice day,
      Kamlro
    1. charlie -
      We do not support subtitles at this time.

      Charlie
    1. Navarre -
      does it work for live rtsp?
    1. rrlanham -
      This doesn't work for live. You can do it in a mpegts stream like this:
      Code:
      udp://0.0.0.0:10000&audiopid=0x101
      But I'm not sure if that will work with RTSP stream

      Richard
    1. T_L_D_T_L_D -
      could anyone run the audio selection module "ModuleMP4AudioChannelSelector" on wowza 3.0 ?

      It gives the error below when a file having 2 audio tracks is requested with audioIndex parameter?


      WARN server comment v_multip.m4v MediaReaderH264.open[2]: java.lang.NullPointerE
      xception

      INFO rtsp describe 1351379522 -
      INFO stream unpublish - -
      INFO stream destroy - -
      INFO rtsp disconnect 1351379522 -
      INFO application app-stop _definst_ vod/_definst_
    1. rrlanham -
      Are you sure that channel exists?

      Richard
    1. T_L_D_T_L_D -
      Quote Originally Posted by rrlanham View Post
      Are you sure that channel exists?

      Richard
      this is the url ; rtsp://127.0.0.1/vod/v_multip.m4v?audioIndex=1

      below is the specs. of the video file.

      General
      Complete name : C:\Program Files (x86)\Wowza Media Systems\Wowza Media Server 3.0.0\content\v_multip.m4v
      Format : MPEG-4
      Format profile : Base Media / Version 2
      Codec ID : mp42
      File size : 6.46 MiB
      Duration : 4mn 36s
      Overall bit rate : 196 Kbps
      Encoded date : UTC 2011-10-04 23:32:38
      Tagged date : UTC 2011-10-04 23:33:32
      Writing application : HandBrake 0.9.5 2011010300

      Video
      ID : 1
      Format : AVC
      Format/Info : Advanced Video Codec
      Format profile : High@L3.0
      Format settings, CABAC : Yes
      Format settings, ReFrames : 4 frames
      Codec ID : avc1
      Codec ID/Info : Advanced Video Coding
      Width : 720 pixels
      Height : 576 pixels
      Display aspect ratio : 16:9
      Frame rate : 23.976 fps
      Standard : PAL
      Color space : YUV
      Chroma subsampling : 4:2:0
      Bit depth : 8 bits
      Scan type : Progressive
      Stream size : 0.00 Byte (0%)
      Encoded date : UTC 2011-10-04 23:32:38
      Tagged date : UTC 2011-10-04 23:32:38
      Material_Duration : 0
      Material_FrameCount : 0
      Color primaries : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
      Transfer characteristics : BT.709-5, BT.1361
      Matrix coefficients : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M

      Audio #1
      ID : 2
      Format : AAC
      Format/Info : Advanced Audio Codec
      Format profile : LC
      Codec ID : 40
      Duration : 4mn 36s
      Bit rate mode : Variable
      Bit rate : 96.0 Kbps
      Maximum bit rate : 151 Kbps
      Channel(s) : 2 channels
      Channel positions : Front: L R
      Sampling rate : 48.0 KHz
      Compression mode : Lossy
      Stream size : 3.17 MiB (49%)
      Language : English
      Encoded date : UTC 2011-10-04 23:32:38
      Tagged date : UTC 2011-10-04 23:33:31
      Material_Duration : 276651
      Material_StreamSize : 3319560

      Audio #2
      ID : 3
      Format : AAC
      Format/Info : Advanced Audio Codec
      Format profile : LC
      Codec ID : 40
      Duration : 4mn 36s
      Bit rate mode : Variable
      Bit rate : 96.0 Kbps
      Maximum bit rate : 149 Kbps
      Channel(s) : 2 channels
      Channel positions : Front: L R
      Sampling rate : 48.0 KHz
      Compression mode : Lossy
      Stream size : 3.17 MiB (49%)
      Language : Turkish
      Encoded date : UTC 2011-10-04 23:32:38
      Tagged date : UTC 2011-10-04 23:33:31
      Material_Duration : 276651
      Material_StreamSize : 3321356

      is the something wrong?
    1. randall -
      Hi,

      It looks like the file is MPEG4 Part 2, but the module uses "mediaReaderH264.getTrackAudioTrackId(i);". Since MPEG4 Part 2 is not H.264, this probably won't work. You have to use h.264.
    1. T_L_D_T_L_D -
      Quote Originally Posted by randall View Post
      Hi,

      It looks like the file is MPEG4 Part 2, but the module uses "mediaReaderH264.getTrackAudioTrackId(i);". Since MPEG4 Part 2 is not H.264, this probably won't work. You have to use h.264.
      the file is showed as H264 in GSPOT. I will encode again.
    1. randall -
      Ok, maybe you are encoding in H.264 in a mp42 container. Try putting it in a quicktime container. Take a look at the Wowza sample.mp4 in mediainfo for a reference.
    1. T_L_D_T_L_D -
      Quote Originally Posted by randall View Post
      Ok, maybe you are encoding in H.264 in a mp42 container. Try putting it in a quicktime container. Take a look at the Wowza sample.mp4 in mediainfo for a reference.
      does the file must be quicktime container? I use handbrake to encode files, it does not give output for quicktime container.

      I have rencoded files (still in mpeg-4 container). Now I don't get the error message but I can't do audio selection. The first audio track is always player.
    1. rrlanham -
      Yes, quicktime container (.mp4, .mov, etc) is required. Specs page is here:
      http://www.wowza.com/specs.html

      We have encoding suggestions here:
      http://www.wowza.com/forums/content....ideo-on-Demand

      Richard
    1. T_L_D_T_L_D -
      Quote Originally Posted by rrlanham View Post
      Yes, quicktime container (.mp4, .mov, etc) is required. Specs page is here:
      http://www.wowza.com/specs.html

      We have encoding suggestions here:
      http://www.wowza.com/forums/content....ideo-on-Demand

      Richard
      this is new video file, but audio selection does not work. The video is always played with audio track # 1.

      General
      Complete name : C:\Program Files (x86)\Wowza Media Systems\Wowza Media Server 3.0.0\content\trackadd.mov
      Format : MPEG-4
      Format profile : QuickTime
      Codec ID : qt
      File size : 174 MiB
      Duration : 27mn 3s
      Overall bit rate : 898 Kbps
      Writing application : Lavf51.17.0
      Comment : QuickTime 6.0 or greater

      Video
      ID : 1
      Format : AVC
      Format/Info : Advanced Video Codec
      Format profile : Main@L3.1
      Format settings, CABAC : No
      Format settings, ReFrames : 2 frames
      Format settings, GOP : M=1, N=33
      Codec ID : avc1
      Codec ID/Info : Advanced Video Coding
      Duration : 27mn 3s
      Bit rate mode : Constant
      Bit rate : 800 Kbps
      Width : 720 pixels
      Height : 406 pixels
      Display aspect ratio : 16:9
      Frame rate mode : Constant
      Frame rate : 23.976 fps
      Standard : PAL
      Color space : YUV
      Chroma subsampling : 4:2:0
      Bit depth : 8 bits
      Scan type : Progressive
      Bits/(Pixel*Frame) : 0.114
      Stream size : 153 MiB (88%)
      Language : English

      Audio #1
      ID : 2
      Format : AAC
      Format/Info : Advanced Audio Codec
      Format profile : LC
      Codec ID : 40
      Duration : 27mn 3s
      Bit rate mode : Variable
      Bit rate : 93.4 Kbps
      Channel(s) : 2 channels
      Channel positions : Front: L R
      Sampling rate : 48.0 KHz
      Compression mode : Lossy
      Stream size : 18.1 MiB (10%)
      Language : English

      Audio #2
      ID : 3
      Format : AAC
      Format/Info : Advanced Audio Codec
      Format profile : LC
      Codec ID : 40
      Duration : 4mn 2s
      Bit rate mode : Variable
      Bit rate : 63.6 Kbps
      Channel(s) : 2 channels
      Channel positions : Front: L R
      Sampling rate : 44.1 KHz
      Compression mode : Lossy
      Stream size : 1.84 MiB (1%)
      Language : English