# mixing live audio + vod to ONE stream...?

**URL:** <https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [June 12, 2013, 4:42pm UTC](https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607 "2013-06-12T16:42:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![javier\_enciso](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@javier\_enciso](https://community.wowza.com/u/javier_enciso)\
**Post date:** [June 12, 2013, 4:42pm UTC](https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607/1 "2013-06-12T16:42:42Z")

</div>

Hi everyone,

I’ve searching around this forum, and although I’ve found similar questions, I haven’t found exactly this question so I post it here:

Transmitting audio live from an auction, and have previously uploaded a lots of videos of each product to be sold.

Now I’m transmitting one audio stream and let the client app (flash in a browser) listen to the audio, while selecting the video he want’s to watch.

Want to change this and mix the live audio with the correct product video, so the client only recieve ONE audio/video stream.

I think it’s clear that wowza can’t do this directly (or?), but is there any other way with ffmpeg or similar?

I’ve found similar examples, but don’t know if it’s possible to mix a LIVE stream with VOD videos…

thank you in advance for any hint!

/best

/javier

similar post:

_[Wowza multiple Live audio with video streaming.](http://community.wowza.com/t/-/35752)_

_with this soolution:_

_ffmpeg -itsoffset -5 -i “rtmp://127.0.0.1/live/StreamA.sdp live=1” -i “rtmp://127.0.0.1/live/StreamB.sdp live=1” -vcodec copy -acodec copy -shortest -f flv -map 0:0 -map 1:0 rtmp://127.0.0.1/live/StreamC.sdp_

_The result of this is a new stream, StreamC which has thevideoof StreamA + theAudioof StreamB. the itsoffset is a parameter you can play with to give your translator some delay._

---

<div class="post-metadata">

**Author:** ![javier\_enciso](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@javier\_enciso](https://community.wowza.com/u/javier_enciso)\
**Post date:** [June 13, 2013, 1:50pm UTC](https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607/2 "2013-06-13T13:50:23Z")

</div>

I’m replying myself, as this could be usefull for someone…

If anyone has something to add, please do.

I’ve successfully mixed one audio stream (live) and one video stream (vod) into one stream (live) with ffmpeg:

The idea is to take a live audio stream, and creating a live stream from VOD through a playlist that is modified from the clientside…

These two is converted to ONE live audio/video stream, that is delivered to the clients.

1. added support for ModuleStreamControl to wowza (installing WowzaServerAddOnCollection…)

2. installed ffmpeg on the server

3. created wowza application “livemix” and added:

streamcontroller

ModuleStreamControl

com.wowza.wms.plugin.collection.module.ModuleStreamControl

1. creating a stream dynamically from this example: [https://www.wowza.com/downloads/forums/collection/client/StreamClassControl.zip](https://www.wowza.com/downloads/forums/collection/client/StreamClassControl.zip)

as explained in this article: “How to dynamically control Stream class streams” [https://www.wowza.com/docs/how-to-control-stream-class-streams-dynamically-modulestreamcontrol](https://www.wowza.com/docs/how-to-control-stream-class-streams-dynamically-modulestreamcontrol)

resulting stream: rtmp://[server]:1935/livemix/video

in my case I add a mp4 located on the wowza server

1. audio: from a client transmitting with Flash Media Live Encoder audio only (mp3)

resulting stream: rtmp//[server]:1935/livemix/audio

1. on the server started:

ffmpeg -i “rtmp://127.0.0.1/livemix/video” -i “rtmp://127.0.0.1/livemix/audio” -vcodec copy -acodec copy -shortest -f flv -map 0:0 -map 1:1 rtmp://127.0.0.1/livemix/mix

resulting stream: rtmp://[server]:1935/livemix/mix

this is the final stream that clients should connect to!

Things to investigate:

- mp4 video + mp3 video resulting rtmp stream works in a flash player

- what about html5 video tag?

- ios devices?

- android?

…to be continued!

best

/j

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [June 13, 2013, 7:19pm UTC](https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607/3 "2013-06-13T19:19:33Z")

</div>

Javier,

You might also manage this in the RTMP client. You can have multiple NetStreams on one NetConnection, or multiple NetConnections. It might be be better to have multiple NetConnections, and have them connected before ready to start a NetStream.

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [June 13, 2013, 7:52pm UTC](https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607/4 "2013-06-13T19:52:52Z")

</div>

Take a look at the Wowza FlashRTMPPlayer examples, in the examples folder that ships with Wowza.

And you might be able to do this with off-the-shelf player like JW Player or Flowplayer. They have a javascript API that could help coordinate playback.

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [June 14, 2013, 2:43pm UTC](https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607/5 "2013-06-14T14:43:04Z")

</div>

We fallback on recommending RTSP for Android because of the fragmented feature/version support.

Richard

---

<div class="post-metadata">

**Author:** ![Raymon\_van\_der\_M](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@Raymon\_van\_der\_M](https://community.wowza.com/u/Raymon_van_der_M)\
**Post date:** [July 31, 2013, 6:15pm UTC](https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607/6 "2013-07-31T18:15:15Z")

</div>

I just found this thread because i`m having the same issue. Its possible for me to combine the two stream using the following command line

```auto
avconv -i "rtsp://stream01.xxxx.nl:80/meerpaaldagen/camera1001large.stream" -i "rtmp://stream01.xxxx.nl:80/meerpaaldagen/audio.stream" -vcodec copy -acodec copy -shortest -f flv -map 0:0 -map 1:1 rtmp://stream01.xxxxx.nl:80/meerpaaldagen/camera1001largeaudio

```

But when i change the video input to rtmp it is no longer working

avconv version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright © 2000-2013 the Libav developers

built on Apr 2 2013 17:02:36 with gcc 4.6.3

[flv @ 0x17627a0] negative cts, previous timestamps might be wrong

I want to use RTMP because it seems to better. When i`m using RTSP i get green spot and drops in the video stream

---

<div class="post-metadata">

**Author:** ![bhargav\_modi](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@bhargav\_modi](https://community.wowza.com/u/bhargav_modi)\
**Post date:** [June 13, 2013, 11:32pm UTC](https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607/7 "2013-06-13T23:32:04Z")

</div>

Hi jenciso,

Thanks for giving the helpful information.

For the iOS, following link will help you to upload live stream from iphone to wowza,

[http://blog.themidnightcoders.com/index.php/2011/07/07/ios-applications-wowza-media-server-integration-with-rtmp/](http://blog.themidnightcoders.com/index.php/2011/07/07/ios-applications-wowza-media-server-integration-with-rtmp/)

Similarly, I also able to upload stream from android as well with rtmp.

But the main problem is in playing the uploaded stream in android, iphone. Like, rtmp is flash and we can successfully able to play rtmp video in above flash player. But most devices of android, iOS are not supporting flash. rtmp is not officially supported in android, iOS, [http://developer.android.com/guide/appendix/media-formats.html](http://developer.android.com/guide/appendix/media-formats.html).

Kindly, share any help you find in this case.

Thanks.

---

<div class="post-metadata">

**Author:** ![bhargav\_modi](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@bhargav\_modi](https://community.wowza.com/u/bhargav_modi)\
**Post date:** [June 17, 2013, 5:16am UTC](https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607/8 "2013-06-17T05:16:05Z")

</div>

Hi Richard,

Yes, RTSP seems best option for playing the video in android devices.

We successfully able to stream live video from android to wowza with RTMP. And we can also see the live video from the example of FlashRTMPPlayer, it works fine. But the main problem is that then its not possible to view the same video in another android device with RTSP because we are uploading through RTMP.

At wowza, can we re-stream live video from RTMP to RTSP? ffmpeg will be useful for this?

Thanks Rechard, answer of this question will help to many developers.

Bhargav.

> We fallback on recommending RTSP for Android because of the fragmented feature/version support.
> 
> Richard

---

<div class="post-metadata">

**Author:** ![javier\_enciso](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@javier\_enciso](https://community.wowza.com/u/javier_enciso)\
**Post date:** [June 13, 2013, 4:44pm UTC](https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607/9 "2013-06-13T16:44:54Z")

</div>

Richard,

thank you for your answer.

This seems like chinese for me (and I’m not!) but I’ll google your ideas and will return for more 😉

thanks again!

/j

---

<div class="post-metadata">

**Author:** ![javier\_enciso](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@javier\_enciso](https://community.wowza.com/u/javier_enciso)\
**Post date:** [June 21, 2013, 3:23pm UTC](https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607/10 "2013-06-21T15:23:23Z")

</div>

Best Richard,

I’ve taken some time to review your answer…

I believe my final goal wasn’t clear in my first post:

I’m currently having a website receiving two separated streams: one live audio stream, and one vod video stream (the client listen to the auction live, and selects witch product video to watch).

While this may not be best practice, it does work with flash in a browser in a common pc.

However on a mobile platform I found several troubles:

-old android have flash / newer android and ios doesn’t

-html5 doesn’t behave exactly the same in all devices

-can’t have two separated tags (one for audio and one for vod), because one stops the other…

So, the idea was to bring ONE stream, mixing the live audio plus a dynamic playlist of the products, so at least it is possible to listen and watch the correspondent image at the same time.

It seams possible through ffmpeg - tested succesfully, but don’t know if the server runs smoothly with a lot of watchers, or if ffmpeg can run constantly (as a service?), or if there is some memory leaks… or whatever…

Back to your answer:

> You might also manage this in the RTMP client. You can have multiple NetStreams on one NetConnection, or multiple NetConnections. It might be be better to have multiple NetConnections, and have them connected before ready to start a NetStream.

Does this solve my first goal?

When you talk about NetStreams and NetConnection, you are assuming I transmit and receive in flash. Correct?

I do transmit with Flash Media Live Encoder, but i want to receive both in flash and in html5 tag.

/thanks for any suggestion!

/best regards

/javier

---

<div class="post-metadata">

**Author:** ![javier\_enciso](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@javier\_enciso](https://community.wowza.com/u/javier_enciso)\
**Post date:** [June 21, 2013, 3:29pm UTC](https://community.wowza.com/t/mixing-live-audio-vod-to-one-stream/40607/11 "2013-06-21T15:29:05Z")

</div>

Hi bhargav!

thank you for your post…

It’s not what i was looking for though: I want to stream TO mobile devices (not FROM them).

In the ios/androids without flash we are trying to have a html5 video tag, so it’s not rtmp nor rtsp - we’re using http stream cupertino …

/best

/javier
