Skip to end of metadata
Go to start of metadata


ffmpeg is a powerful cross-platform tool for processing and publishing video- and audiocontent. In terms of publishing RTMP stream on server, ffmpeg allows:

  • to configure stream encoding parameters very flexible;
  • to send RTMP connection parameters to the server.

Quick manual on testing

1. For test we use:

  • WCS server
  • ffmpeg
  • Player web application in chrome browser to stream playback

2. Launch ffmpeg

ffmpeg -re -i BigBuckBunny.mp4 -preset ultrafast -acodec aac -vcodec h264 -strict -2 -f flv rtmp://


  • BigBuckBunny.mp4 is a file to publish
  • is WCS server
  • stream_ffmpeg is a stream name to publish on server

The stream publishing begins.

3. Open Player appliction in browser, where is WCS server. Set the stream name and press 'Play'. The stream playback begins.

Sorenson Spark + Speex 16 kHz stream publishing

WCS server can capture RTMP stream encoded with Sorenson Spark + Speex 16kHz to FLV container. This stream can be published, for example, using ffmpeg as follows:

ffmpeg -re -i BigBuckBunny.flv -preset ultrafast -ar 16000 -ac 1 -acodec speex -vcodec flv -strict -2 -f flv rtmp://

Known limits

1. To handle such stream including stream recording, the stream will be transcoded to H.264 + AAC.

2. Payload types 127 for video and 97 for audio should be set in SDP when publishing such stream, for example

o=- 1988962254 1988962254 IN IP4
c=IN IP4
t=0 0
m=video 0 RTP/AVP 127
a=rtpmap:127 FLV/90000
m=audio 0 RTP/AVP 97 8 0
a=rtpmap:97 SPEEX/16000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000

The features

Explicit specification of encoding parameters

ffmpeg allows to explicitly set the encoding parameters when stream is publishing, for example

ffmpeg -re -i BigBuckBunny.mp4 -acodec aac -vcodec libx264 -f flv -ar 44100 rtmp://

A more complicated case with addition of a sound track to a file that has not one (/dev/zero source is used for example):

ffmpeg -re -f lavfi -i ", setpts=N/(FRAME_RATE*TB)" -an -s 1280x720 -r 15 -f rawvideo -pix_fmt yuv420p - | ffmpeg -thread_queue_size 512 -an -f rawvideo -pix_fmt yuv420p -r 15 -s 1280x720 -i - -vn -f s16le -acodec pcm_s16le -ac 2 -i /dev/zero -r 15 -c:v libx264 -tune zerolatency -profile:v baseline -g 60 -b:v 960k -s 1280x720 -c:a aac -b:a 64k -f flv rtmp://

Passing parameters to the server when RTMP connection is establishing

In the "-rtmp_conn" option, ffmpeg allows to set RTMP connection paramtters that should be passed to the server when stream is publishing:

ffmpeg -re -i BigBuckBunny.mp4 -f flv -rtmp_conn "O:1 NS:appKey:flashStreamingApp NS:name:12121212 NS:stream:12121212 NO:custom:O:1 NS:auth:22222222 NS:stream:3333333 O:0 O:0" rtmp://

Here, the following parameters are passed

  • server application key flashStreamingApp
  • server application name 12121212
  • server stream name 12121212
  • custom object with additional data:
 "auth" : "22222222",
 "stream" : "3333333"

How to rotate stream published from ffmpeg

ffmpeg RTMP encoder allows to send orientation metadata to WCS server using command line switches:

ffmpeg -i input.mp4 -metadata:s:v rotate=90 -vcodec copy -acodec copy -strict -2 -f flv rtmp://

Note that ffmpeg sends orientattion value but not angle itself.