Results 1 to 5 of 5

Thread: MS Smoothstream 2 audio language ?

  1. #1

    Default MS Smoothstream 2 audio language ?

    We need 2 audio ( different languages ) support for smoothstream VOD, but i could not find anything about it on WOWZA.

    how can we do it? please help.

    regards
    Radoslav

  2. #2
    Join Date
    Dec 2007
    Posts
    22,013

    Default

    The following example will work for Flash:
    http://www.wowza.com/forums/content....tify-interface

    Here is an update that should work with iOS, Smooth and SanJose streams too. I haven't tested it yet, or updated the collection with this change

    package com.wowza.wms.plugin.test.module;
    
    import java.util.*;
    import com.wowza.util.*;
    import com.wowza.wms.httpstreamer.model.IHTTPStreamerSession;
    import com.wowza.wms.module.*;
    import com.wowza.wms.amf.*;
    import com.wowza.wms.application.*;
    import com.wowza.wms.request.*;
    import com.wowza.wms.stream.*;
    import com.wowza.wms.mediareader.h264.*;
    import com.wowza.wms.client.*;
    import com.wowza.wms.mediareader.h264.atom.*;
    
    public class ModuleMP4AudioChannelSelector extends ModuleBase
    {
                    public static final String PROPERTY_audioindex = "audioindex";
                    public static final String PROPERTY_VIDEOINDEX = "videoindex";
                    public static final String PROPERTY_DATAINDEX = "dataindex";
                    public static final String[] PROPERTY_INDEXES = {PROPERTY_audioindex, PROPERTY_VIDEOINDEX, PROPERTY_DATAINDEX};
                    
                    class MediaReaderListener implements IMediaReaderActionNotify
                    {
                                    public void onMediaReaderCreate(IMediaReader mediaReader)
                                    {
                                                    getLogger().info("ModuleMediaReaderNotify#MediaReaderListener.onMediaReaderCreate");
                                    }
    
                                    public void onMediaReaderInit(IMediaReader mediaReader, IMediaStream stream)
                                    {
                                                    getLogger().info("ModuleMediaReaderNotify#MediaReaderListener.onMediaReaderInit: "+stream.getName());
                                    }
    
                                    public void onMediaReaderOpen(IMediaReader mediaReader, IMediaStream stream)
                                    {
                                                    getLogger().info("ModuleMediaReaderNotify#MediaReaderListener.onMediaReaderOpen: "+stream.getName());
                                                    
                                                    while(true)
                                                    {
                                                                    IClient client = stream.getClient();
                                                                    if (client == null)
                                                                                    break;
                                                                    
                                                                    int audioindex = -1;
                                                                    int videoIndex = -1;
                                                                    int dataIndex = -1;
    
                                                                    Integer audioindexObj = (Integer)client.getProperties().getProperty(PROPERTY_audioindex);                                                 
                                                                    Integer videoIndexObj = (Integer)client.getProperties().getProperty(PROPERTY_VIDEOINDEX);
                                                                    Integer dataIndexObj = (Integer)client.getProperties().getProperty(PROPERTY_DATAINDEX);
                                                                    
                                                                    if (audioindexObj != null)
                                                                                    audioindex = audioindexObj.intValue();
                                                                    if (videoIndexObj != null)
                                                                                    videoIndex = videoIndexObj.intValue();
                                                                    if (dataIndexObj != null)
                                                                                    dataIndex = dataIndexObj.intValue();
    
                                                                    if (mediaReader instanceof MediaReaderH264)
                                                                    {
                                                                                    MediaReaderH264 mediaReaderH264 = (MediaReaderH264)mediaReader;
    
                                                                                    int audioTrackCount = mediaReaderH264.getTrackCountAudio();
                                                                                    for(int i=0;i<audioTrackCount;i++)
                                                                                    {
                                                                                                    String langStr = mediaReaderH264.getTrackLanguageAudio(i);
                                                                                                    long trackId = mediaReaderH264.getTrackAudioTrackId(i);
                                                                                                    QTAtomtrak trackAtom = mediaReaderH264.getTrackAudioAtom(i);
                                                                                                    getLogger().info("  audio["+i+"]: trackId:"+trackId+" lang:"+langStr+" more:"+trackAtom.getTkhdAtom().toString());
                                                                                    }
                                                                                    
                                                                                    int videoTrackCount = mediaReaderH264.getTrackCountVideo();
                                                                                    for(int i=0;i<videoTrackCount;i++)
                                                                                    {
                                                                                                    long trackId = mediaReaderH264.getTrackVideoTrackId(i);
                                                                                                    long trackWidth = mediaReaderH264.getTrackVideoWidth(i);
                                                                                                    long trackHeight = mediaReaderH264.getTrackVideoHeight(i);
                                                                                                    QTAtomtrak trackAtom = mediaReaderH264.getTrackVideoAtom(i);
                                                                                                    getLogger().info("  video["+i+"]: trackId:"+trackId+" width:"+trackWidth+" height:"+trackHeight+" more:"+trackAtom.getTkhdAtom().toString());
                                                                                    }
                                                                                    
                                                                                    int dataTrackCount = mediaReaderH264.getTrackCountData();
                                                                                    for(int i=0;i<dataTrackCount;i++)
                                                                                    {
                                                                                                    String langStr = mediaReaderH264.getTrackLanguageData(i);
                                                                                                    long trackId = mediaReaderH264.getTrackDataTrackId(i);
                                                                                                    QTAtomtrak trackAtom = mediaReaderH264.getTrackDataAtom(i);
                                                                                                    getLogger().info("  data["+i+"]: trackId:"+trackId+" lang:"+langStr+" more:"+trackAtom.getTkhdAtom().toString());
                                                                                    }
    
                                                                                    if (audioindex >= 0)
                                                                                    {
                                                                                                    getLogger().info("  setTrackIndexAudio: "+audioindex);
                                                                                                    mediaReaderH264.setTrackIndexAudio(audioindex);
                                                                                    }
                                                                                    if (videoIndex >= 0)
                                                                                    {
                                                                                                    getLogger().info("  setTrackIndexVideo: "+videoIndex);
                                                                                                    mediaReaderH264.setTrackIndexVideo(videoIndex);
                                                                                    }
                                                                                    if (dataIndex >= 0)
                                                                                    {
                                                                                                    getLogger().info("  setTrackIndexData: "+dataIndex);
                                                                                                    mediaReaderH264.setTrackIndexData(dataIndex);
                                                                                    }
                                                                    }
                                                                    
                                                                    break;
                                                    }
                                    }
    
                                    public void onMediaReaderExtractMetaData(IMediaReader mediaReader, IMediaStream stream)
                                    {
                                                    getLogger().info("ModuleMediaReaderNotify#MediaReaderListener.onMediaReaderExtractMetaData: "+stream.getName());
                                    }
    
                                    public void onMediaReaderClose(IMediaReader mediaReader, IMediaStream stream)
                                    {
                                                    getLogger().info("ModuleMediaReaderNotify#MediaReaderListener.onMediaReaderClose: "+stream.getName());
                                    }
                    }
                    
                    public void onAppStart(IApplicationInstance appInstance)
                    {
                                    appInstance.addMediaReaderListener(new MediaReaderListener());
                    }
                    
                    public void play(IClient client, RequestFunction function, AMFDataList params)
                    {
                                    String streamName = params.getString(PARAM1);
                                    
                                    getLogger().info("ModuleMediaReaderNotify.play: "+streamName);
    
                                    if (streamName != null)
                                    {
                                                    int qindex = streamName.indexOf("?");
                                                    if (qindex >= 0)
                                                    {
                                                                    String queryStr = streamName.substring(qindex+1);
                                                                    Map<String, String> queryParams = HTTPUtils.splitQueryStr(queryStr);
                                                                    
                                                                    for(int i=0;i<PROPERTY_INDEXES.length;i++)
                                                                    {
                                                                                    String indexStr = PROPERTY_INDEXES[i];
                                                                                    if (queryParams.containsKey(indexStr))
                                                                                    {
                                                                                                    int index = -1;
                                                                                                    try
                                                                                                    {
                                                                                                                    index = Integer.parseInt(queryParams.get(indexStr));
                                                                                                    }
                                                                                                    catch(Exception e)
                                                                                                    {
                                                                                                    }
                                                                                                    if (index >= 0)
                                                                                                    {
                                                                                                                    client.getProperties().setProperty(indexStr, new Integer(index));
                                                                                                                    getLogger().info("  "+indexStr+": "+index);
                                                                                                    }
                                                                                    }
                                                                    }
                                                    }
                                    }
                                    
                                    invokePrevious(client, function, params);
                    }
    
                    public void onHTTPSessionCreate(IHTTPStreamerSession httpSession)
                    {
                    	String streamName = httpSession.getStreamName();
                        
                        getLogger().info("ModuleMediaReaderNotify httpSession: "+streamName);
    
                        if (streamName != null)
                        {
                                        int qindex = streamName.indexOf("?");
                                        if (qindex >= 0)
                                        {
                                                        String queryStr = streamName.substring(qindex+1);
                                                        Map<String, String> queryParams = HTTPUtils.splitQueryStr(queryStr);
                                                        
                                                        for(int i=0;i<PROPERTY_INDEXES.length;i++)
                                                        {
                                                                        String indexStr = PROPERTY_INDEXES[i];
                                                                        if (queryParams.containsKey(indexStr))
                                                                        {
                                                                                        int index = -1;
                                                                                        try
                                                                                        {
                                                                                                        index = Integer.parseInt(queryParams.get(indexStr));
                                                                                        }
                                                                                        catch(Exception e)
                                                                                        {
                                                                                        }
                                                                                        if (index >= 0)
                                                                                        {
                                                                                                        httpSession.getProperties().setProperty(indexStr, new Integer(index));
                                                                                                        getLogger().info("  "+indexStr+": "+index);
                                                                                        }
                                                                        }
                                                        }
                                        }
                        }
                    }
    }

  3. #3

    Default

    Hi,

    thanks for the update and the code.
    I was looking something like this actullay : http://wwitv.com/tv_channels/38.htm
    which you can change on air. is this possible with wowza ?

    i will talk with my colligues if we can use this method instead.

    Thanks

  4. #4

    Default

    manifest looks like this with multi-audio smoothstream : http://vaticanradio01-smooth-live.ad....isml/Manifest

  5. #5
    Join Date
    Dec 2007
    Posts
    22,013

    Default

    I don't think Wowza supports that at present.

    Richard

Similar Threads

  1. live stream with multiple audio language
    By wifisolution in forum Live Streaming and Encoder Discussion
    Replies: 4
    Last Post: 12-09-2015, 03:08 PM
  2. Silverlight smoothstream Screen is wider than Cupertino or sanjose
    By Hassan in forum Media Players and Devices Discussion
    Replies: 5
    Last Post: 12-07-2011, 02:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •