Streaming API — это инструмент для получения публичных данных из ВКонтакте по заданным ключевым словам. В отличие от методов обычного API, не нужно постоянно повторять запросы, чтобы получить обновления. Мы сами будем присылать новый подходящий контент по мере его появления.
Streaming API передаёт данные с использованием протокола WebSocket.
# ffmpeg -v verbose -i rtmp://localhost/live/testtv1234567890 -async 1 -vsync -1 -c:v libx264 -c:a aac -b:v 256k -b:a 32k -vf "scale=480:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -f flv rtmp://localhost/hls/testtv1234567890_low
ffmpeg version 2.4.3-1ubuntu1~trusty6 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 22 2014 17:07:19 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --prefix=/usr --extra-version='1ubuntu1~trusty6' --build-suffix=-ffmpeg --toolchain=hardened --extra-cflags= --extra-cxxflags= --libdir=/usr/lib/x86_64-linux-gnu --shlibdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-fontconfig --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-opengl --enable-x11grab --enable-libxvid --enable-libx265 --enable-libdc1394 --enable-libiec61883 --enable-libzvbi --enable-libzmq --enable-frei0r --enable-libx264 --enable-libsoxr --enable-openal --enable-libopencv
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100
Parsing...
Parsed protocol: 0
Parsed host : localhost
Parsed app : live
RTMP_Connect1, ... connected, handshaking
HandShake: Type Answer : 03
HandShake: Server Uptime : 27820176
HandShake: FMS Version : 0.0.0.0
HandShake: Handshaking finished....
RTMP_Connect1, handshaked
Invoking connect
HandleServerBW: server BW = 5000000
HandleClientBW: client BW = 5000000 2
HandleChangeChunkSize, received: chunk size change to 4000
RTMP_ClientPacket, received: invoke 190 bytes
(object begin)
Property: <Name: no-name., STRING: _result>
Property: <Name: no-name., NUMBER: 1.00>
Property: <Name: no-name., OBJECT>
(object begin)
Property: <Name: fmsVer, STRING: FMS/3,0,1,123>
Property: <Name: capabilities, NUMBER: 31.00>
(object end)
Property: <Name: no-name., OBJECT>
(object begin)
Property: <Name: level, STRING: status>
Property: <Name: code, STRING: NetConnection.Connect.Success>
Property: <Name: description, STRING: Connection succeeded.>
Property: <Name: objectEncoding, NUMBER: 0.00>
(object end)
(object end)
HandleInvoke, server invoking <_result>
HandleInvoke, received result for method call <connect>
sending ctrl. type: 0x0003
Invoking createStream
RTMP_ClientPacket, received: invoke 29 bytes
(object begin)
Property: <Name: no-name., STRING: _result>
Property: <Name: no-name., NUMBER: 2.00>
Property: NULL
Property: <Name: no-name., NUMBER: 1.00>
(object end)
HandleInvoke, server invoking <_result>
HandleInvoke, received result for method call <createStream>
SendPlay, seekTime=0, stopTime=0, sending play: testtv1234567890
Invoking play
sending ctrl. type: 0x0003
RTMP_ClientPacket, received: invoke 108 bytes
(object begin)
Property: <Name: no-name., STRING: onStatus>
Property: <Name: no-name., NUMBER: 0.00>
Property: NULL
Property: <Name: no-name., OBJECT>
(object begin)
Property: <Name: level, STRING: error>
Property: <Name: code, STRING: NetStream.Play.StreamNotFound>
Property: <Name: description, STRING: No such stream>
(object end)
(object end)
HandleInvoke, server invoking <onStatus>
HandleInvoke, onStatus: NetStream.Play.StreamNotFound
Closing connection: NetStream.Play.StreamNotFound
rtmp://localhost/live/testtv1234567890: Unknown error occurred