Controlling timestamp in the initial RTMP audio/video packets

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Controlling timestamp in the initial RTMP audio/video packets

Niels Brunsgaard
Hello ffmpeg team,

We're using the ffmpeg AV libraries for an in-house H.264 encoder. Our
encoder streams audio/video (A/V) via RTMP to a Wowza streaming engine,
which in turn delivers the video to our HLS users. We have a couple of use
cases where our application needs to be able to specify the initial
timestamp for the session:

USE CASE 1: Encoder is sending A/V via RTMP to Wowza A. The encoder looses
connectivity to Wowza A and switches over to Wowza B. In order to maintain
a smooth playback experience we need to maintain consistent time codes
across the switch over.
USE CASE 2: Encoder 1 is sending A/V via RTMP to Wowza A, and encoder 2 is
sending the same A/V via RTMP to Wowza B. In order to maintain a smooth
playback experience when users switch between A and B we need time codes
for the 2 encoders to be in sync. The 2 encoders share time codes outside
of ffmpeg.
USE CASE 3: Encoder 1 is sending A/V via RTMP to Wowza A, and encoder 2 is
sending an alternate audio signal via RTMP to Wowza A. In order to maintain
A/V synchronization we need the 2 encoders time codes to be in sync.

Our problem: When we initiate an RTMP connection the first audio and video
packets always have their timestamp set to zero, regardless of what time
codes we pass it. See wireshark packet snippet below. How do we make
libavformat use our time codes in the first audio and video packets,
instead of zeros?


Real Time Messaging Protocol (Video Data)
    RTMP Header
        00.. .... = Format: 0
        ..00 0110 = Chunk Stream ID: 6
        Timestamp: 0
        Body size: 47
        Type ID: Video Data (0x09)
        Stream ID: 1
    RTMP Body
        Control: 0x17 (keyframe H.264)
            0001 .... = Type: keyframe (1)
            .... 0111 = Format: H.264 (7)
        Video data: 0000000001640029ffe1001b27640029ac1316c05005bb01...
Real Time Messaging Protocol (Audio Data)
    RTMP Header
        00.. .... = Format: 0
        ..00 0100 = Chunk Stream ID: 4
        Timestamp: 0
        Body size: 4
        Type ID: Audio Data (0x08)
        Stream ID: 1
    RTMP Body
        Control: 0xaf (HE-AAC 44 kHz 16 bit stereo)
            1010 .... = Format: HE-AAC (10)
            .... 11.. = Sample rate: 44 kHz (3)
            .... ..1. = Sample size: 16 bit (1)
            .... ...1 = Channels: stereo (1)
        Audio data: 001210


--

*Niels Brunsgaard*Video Solutions Architect  |  p. (303) 881-3259
FloSports
<http://www.google.com/url?q=http%3A%2F%2Fwww.flosports.tv%2F&sa=D&sntz=1&usg=AFQjCNFt0Ul_xC6SOF0fcr7K-DNW2cMI_w>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".