Skip to content

Commit

Permalink
implemented exec feature
Browse files Browse the repository at this point in the history
  • Loading branch information
arut committed Jun 8, 2012
1 parent eec4b7b commit 4bb4848
Show file tree
Hide file tree
Showing 4 changed files with 533 additions and 9 deletions.
27 changes: 27 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ NGINX-based RTMP server

* H264 support

* Online transcoding with FFmpeg
(experimental)

* HTTP callbacks on publish/play/record

* Advanced buffering techniques
Expand Down Expand Up @@ -77,6 +80,30 @@ rtmp {
#allow play all;
}

# Transcoding (ffmpeg needed)
application big {
live on;

# On every pusblished stream run this command (ffmpeg)
# with substitutions: $app/${app}, $name/${name} for application & stream name.
#
# This ffmpeg call receives stream from this application &
# reduces the resolution down to 32x32. The stream is the published to
# 'small' application (see below) under the same name.
#
# ffmpeg can do anything with the stream like video/audio
# transcoding, resizing, altering container/codec params etc
#
# Multiple exec lines can be specified.

exec ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec flv -acodec copy -s 32x32 -f flv rtmp://localhost:1935/small/${name};
}

application small {
live on;
# Video with rediced resolution comes here from ffmpeg
}

application mypush {
live on;

Expand Down
2 changes: 2 additions & 0 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CORE_MODULES="$CORE_MODULES
ngx_rtmp_netcall_module \
ngx_rtmp_notify_module \
ngx_rtmp_relay_module \
ngx_rtmp_exec_module \
"


Expand Down Expand Up @@ -38,6 +39,7 @@ NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
$ngx_addon_dir/ngx_rtmp_relay_module.c \
$ngx_addon_dir/ngx_rtmp_bandwidth.c \
$ngx_addon_dir/ngx_rtmp_codecs.c \
$ngx_addon_dir/ngx_rtmp_exec_module.c \
"
CFLAGS="$CFLAGS -I$ngx_addon_dir"

Expand Down
21 changes: 12 additions & 9 deletions ngx_rtmp_cmd_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,22 @@
#include "ngx_rtmp.h"


/* Basic RTMP call support */
#define NGX_RTMP_MAX_APP 128
#define NGX_RTMP_MAX_NAME 256
#define NGX_RTMP_MAX_URL 256


/* TODO: improve string sizes */
/* Basic RTMP call support */

typedef struct {
double trans;
u_char app[128];
u_char app[NGX_RTMP_MAX_APP];
u_char flashver[32];
u_char swf_url[256];
u_char tc_url[256];
u_char swf_url[NGX_RTMP_MAX_URL];
u_char tc_url[NGX_RTMP_MAX_URL];
double acodecs;
double vcodecs;
u_char page_url[256];
u_char page_url[NGX_RTMP_MAX_URL];
} ngx_rtmp_connect_t;


Expand All @@ -41,14 +44,14 @@ typedef struct {


typedef struct {
u_char name[256];
u_char name[NGX_RTMP_MAX_NAME];
u_char type[16];
int silent;
} ngx_rtmp_publish_t;


typedef struct {
u_char name[256];
u_char name[NGX_RTMP_MAX_NAME];
} ngx_rtmp_fcpublish_t;


Expand All @@ -58,7 +61,7 @@ typedef ngx_rtmp_fcpublish_t ngx_rtmp_fcunsubscribe_t;


typedef struct {
u_char name[256];
u_char name[NGX_RTMP_MAX_NAME];
double start;
double duration;
int reset;
Expand Down
Loading

0 comments on commit 4bb4848

Please sign in to comment.