Skip to content

VidmanLive protocol description

Alexey Stepanov edited this page Jun 1, 2016 · 9 revisions

Vidmanlive is used for video broadcasting in Periscope app instead of previous liveorigin (RTMP).

Endpoint: vidman-[region].periscope.tv (region for example, eu-central-1)
Port: 80

Traffic dump

On create broadcast: pcapng (Wireshark) | Raw data
On start streaming: pcapng (Wireshark) | Raw data
TS video from Periscope for viewers: TS (rename it from .png)

The protocol

Chart of communication in single TCP-session is following:

  1. Client sends header to server
  2. Server sends response to client
  3. (optional) Client sends empty packets (payload filled with 0x2D bytes) until user clicks "Start broadcast" button
  4. Client sends body (video) to server

Header

Contains object in AMF format, 1507 bytes

[
  // object type: movieclip-marker (0x04)
  false,
  3.131513e-294,
  false,
  // 00 00
  "fast-publish",
  3,
  null,
  "iAQExgvLVlamObGyd.ZFXNrlShnVXMwDMI5T_arScOxtQLZNc-YD0Y93aLgVcuzqG3zrvCyfDQZzXkuezi8WeU-1lJKaFNavNcWsj�Jjw=",
  //stream_name field of createBroadcast request, but 0xC3 is inserted at 101 position
  "live",
  "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsInZlcnNpb24iOiIyIn0.eyJBbGxvd2VkUHJvdG9jb2xzIjpbInJ0bXAiLCJydG1wcyJdLCJCcm9hZ�GNhc3RJZCI6IjF6cUpWa0Rkd2JYeEIiLCJHcmFudFR5cGUiOiJ3cml0ZSIsIkdyYW50ZWRBdCI6MTQ2MzgyOTY0NywiR3JhbnRlZFRvIjoiMW9OUWx4V3lvQVF3UiIsI�mV4cCI6MTQ2MzkxNjA0N30.crSw6MPUQDycr880a1X5NVHwQK1dS36wps_D54x7twE",
  //  credential field of createBroadcast request, but 0xC3 is inserted at 242 and 114 position
  null,
  // 00 00 00 00 03 9F
  { // tag type META (0x12)
    // 01 00 00 00
    "onMetaData": { // type: object
      "frameHeight": 568,
      "trackinfo": [
        {
          "sampledescription": [
            {
              "sampletype": "H264"
            }
          ],
          "language": "eng",
          "description": "{H264CodecConfigInfo: codec:H264, profile:Main, level:2.1, frameSize:320x568, displaySize:320x568, crop: l:0 r:0 t:0 b:0}",
          "type": "video",
          // after "t" in "type" goes "0xC5"
          "profile-level-id": "640015",
          "timescale": 90000,
          "sprop-parameter-sets": "Z2QAFazTBQEn5YBtChKcAA==,aO4G4sA"
        },
        {
          "config": "1208",
          "sampledescription": [
            {
              "sampletype": "mpeg4-generic"
            }
          ],
          "language": "eng",
          "description": "{AACFrame: codec:AAC, channels:1, frequency:44100, samplesPerFrame:1024, objectType:LC}",
          "type": "audio",
          "timescale": 90000
        }
      ],
      "audiocodecid": "mp4a",
      "frameWidth": 320,
      "rtpsessioninfo": {
        "name": "Live stream from Periscope",
        "connectiondata": "In IP4 0.0.0.0",
        "protocolversion": 0,
        "timing": "0 0"
        // after first "0" goes "0xC5"
      },
      "audiosamplerate": 44100,
      "height": 568,
      "width": 320,
      "displayWidth": 320,
      "videocodecid": "avc1",
      "displayHeight": 568,
      "audiochannels": 1
    },
    "01 00 00 00":5.568117e-309
    // 00 02 00 07 00 00 00 00 00 25
  },
  false,
  3.198544e-308,
  1.016779e-202
]

Server response

Contains object in AMF format, 173 bytes

{ // type: object
  // 00 00 00 00 00 A0 14 01 00 00 00
  "onStatus": 3,
  null: {
    "level":"status",
    "code":"NetStream.Publish.Start",
    "description":"successful response to the publish comand"
  },
  "vidmanVersion":"vidman_1_0_0"
}

Body

Contains the sequence of packets, which is the following structure:

Name Number of bytes Description
Packet header 1, 4 or 8, or 63, or 66 ?
Constant 1 8 AF 01 01 40 22 80 A3 7D
Settings 1 Bitwise flags, see below
Constant 2 1 85
Payload 181 or 182 Size depends on "long/short packet" flag in "settings" byte
End of packet 1 2F
Settings
Number of bits 8-bit BE mask Description
1 0x80 0
1 0x40 1
1 0x20 0
1 0x10 Long packet (182 bytes payload)
1 0x8 Short packet (181 bytes payload)
1 0x4 0
1 0x2 0
1 0x1 0

Bash command for testing

(cat header; sleep 5; cat body) | nc vidman-eu-central-1.periscope.tv 80
Clone this wiki locally