PCMU Audio in H264 stream to Wowza

Topics: Question
Aug 23 at 7:37 AM
I have a problem with creating one stream which contains audio and video from audio and video separately. I'm using net7mma library for rtsp server. I'm streaming video to wowza. I got H264/AVC video raw stream and PCMU 44,1k samplerate audio stream.
This is how I do this:
Firstly I create media:
RFC6184Media newMedia = new RFC6184Media(704, 480, camName);
Then when video frame comes I do:
var newFrame = new RFC6184Media.RFC6184Frame(96);
For this steps everything works fine, video looks good. The problem is when I want to add audio. From my device I receive raw PCMU 8k sample rate so I need to resample it to 44100 using NAudio library:
var provider = new RawSourceWaveStream(new MemoryStream(buff), new WaveFormat(8000, 1));

var outFormat = new WaveFormat(44100, provider.WaveFormat.Channels);
var resampler = new WaveFormatConversionStream(outFormat, provider);

MemoryStream memStr = new MemoryStream();

WaveFileWriter.CreateWaveFile("pcm", resampler);
var audioBytes = File.ReadAllBytes("pcm");

var newFrame = PacketizeBufer(audioBytes);
My method for packetization looks like this:
 private RtpFrame PacketizeBufer(byte[] messageBuffer)
        var newFrame = new RtpFrame(0);
        int countOfArray = messageBuffer.Length / 1500;
        if (messageBuffer.Length % 1500 > 0)
        RtpPacket packet;
        for (int i = 0; i < countOfArray; i++)
            byte[] tempToSend = messageBuffer.Skip(i * 1500).Take(1500).ToArray();
            if (i == countOfArray - 1)
                packet = new RtpPacket(2, false, false, true, 0, 0, 0, i, 0, tempToSend);
            packet = new RtpPacket(2, false, false, false, 0, 0, 0, i, 0, tempToSend);
        return newFrame;
SDP looks like this:
o=ASTI-Media-Server 15943110217466738919 -2503633856242812693 IN IP4 [ip_addr]
a=rtpmap:0 PCMU/44100
a=fmtp:0 packetization-mode=1;profile-level-id=64001F;sprop-parameter-sets=Z0LAHtkDxWhAAAADAEAAAAwDxYuS,aMuMsg==
a=fmtp:96 packetization-mode=1;profile-level-id=64001F;sprop-parameter-sets=Z0LAHtkDxWhAAAADAEAAAAwDxYuS,aMuMsg==
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
m=audio 0 RTP/AVP 0
Session=> 2359fd8e-f449-4db7-a19e-48ca78cc3422
The strange thing about this is when I save video and audio to one file it won't work. When I save video and audio separately (video as h264, audio as wav) video gest audio somehow.