Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Overview

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 for 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://test1.flashphoner.com:1935/live/stream_ffmpeg

Where

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

The stream publishing begins.

3. Open Player appliction in browser https://test1.flashphoner.com:8888/client2/examples/demo/streaming/player/player.html, where test1.flashphoner.com is WCS server. Set the stream name and press 'Play'. The stream playback begins.

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://127.0.0.1:1935/live/stream_ffmpeg

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 "movie=filename=test.mov:loop=0, 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://127.0.0.1/live/test_video

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://test1.flashphoner.com:1935/12121212

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"
}
  • No labels