winlin

add drawtext filter sample

@@ -32,7 +32,7 @@ FMS URL: rtmp://127.0.0.1:1935/live @@ -32,7 +32,7 @@ FMS URL: rtmp://127.0.0.1:1935/live
32 Stream: livestream 32 Stream: livestream
33 For example, use ffmpeg to publish: 33 For example, use ffmpeg to publish:
34 for((;;)); do \ 34 for((;;)); do \
35 - ./objs/ffmpeg/bin/ffmpeg -re -i doc/source.flv -vcodec copy -acodec copy \ 35 + ./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.flv -vcodec copy -acodec copy \
36 -f flv -y rtmp://127.0.0.1:1935/live/livestream; \ 36 -f flv -y rtmp://127.0.0.1:1935/live/livestream; \
37 sleep 1; \ 37 sleep 1; \
38 done 38 done
@@ -15,17 +15,14 @@ vhost __defaultVhost__ { @@ -15,17 +15,14 @@ vhost __defaultVhost__ {
15 hls_path ./objs/nginx/html; 15 hls_path ./objs/nginx/html;
16 hls_fragment 5; 16 hls_fragment 5;
17 hls_window 30; 17 hls_window 30;
18 - forward 127.0.0.1:1936; 18 + #forward 127.0.0.1:1936;
19 transcode { 19 transcode {
20 enabled on; 20 enabled on;
21 ffmpeg ./objs/ffmpeg/bin/ffmpeg; 21 ffmpeg ./objs/ffmpeg/bin/ffmpeg;
22 - #ffmpeg ./research/ffempty/ffempty;  
23 engine ld{ 22 engine ld{
24 enabled on; 23 enabled on;
25 vfilter { 24 vfilter {
26 - #vf 'drawtext=text=SRS';  
27 - #vf 'crop=in_w-20:in_h-160:10:80';  
28 - i ./doc/ffmpeg-logo.png; 25 + i ./doc/ffmpeg-min.png;
29 filter_complex 'overlay=10:10'; 26 filter_complex 'overlay=10:10';
30 } 27 }
31 vcodec libx264; 28 vcodec libx264;
@@ -43,7 +40,6 @@ vhost __defaultVhost__ { @@ -43,7 +40,6 @@ vhost __defaultVhost__ {
43 asample_rate 44100; 40 asample_rate 44100;
44 achannels 2; 41 achannels 2;
45 aparams { 42 aparams {
46 - profile:a aac_low;  
47 } 43 }
48 output rtmp://[vhost]:[port]/[app]/[stream]_ld; 44 output rtmp://[vhost]:[port]/[app]/[stream]_ld;
49 } 45 }
@@ -72,6 +68,126 @@ vhost __defaultVhost__ { @@ -72,6 +68,126 @@ vhost __defaultVhost__ {
72 } 68 }
73 } 69 }
74 } 70 }
  71 +# the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
  72 +vhost mirror.transcode.vhost.com {
  73 + transcode {
  74 + enabled on;
  75 + ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  76 + engine mirror{
  77 + enabled on;
  78 + vfilter {
  79 + vf 'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2';
  80 + }
  81 + vcodec libx264;
  82 + vbitrate 300;
  83 + vfps 20;
  84 + vwidth 480;
  85 + vheight 320;
  86 + vthreads 2;
  87 + vprofile baseline;
  88 + vpreset superfast;
  89 + vparams {
  90 + }
  91 + acodec libaacplus;
  92 + abitrate 30;
  93 + asample_rate 44100;
  94 + achannels 2;
  95 + aparams {
  96 + }
  97 + output rtmp://[vhost]:[port]/[app]/[stream]_mirror;
  98 + }
  99 + }
  100 +}
  101 +# the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
  102 +vhost drawtext.transcode.vhost.com {
  103 + transcode {
  104 + enabled on;
  105 + ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  106 + engine drawtext{
  107 + enabled on;
  108 + vfilter {
  109 + vf 'drawtext=text=SimpleRtmpServer(SRS):x=10:y=10:fontcolor=#EEEEEE:fontfile=./doc/FreeSerifBold.ttf';
  110 + }
  111 + vcodec libx264;
  112 + vbitrate 300;
  113 + vfps 20;
  114 + vwidth 480;
  115 + vheight 320;
  116 + vthreads 2;
  117 + vprofile baseline;
  118 + vpreset superfast;
  119 + vparams {
  120 + }
  121 + acodec libaacplus;
  122 + abitrate 30;
  123 + asample_rate 44100;
  124 + achannels 2;
  125 + aparams {
  126 + }
  127 + output rtmp://[vhost]:[port]/[app]/[stream]_drawtext;
  128 + }
  129 + }
  130 +}
  131 +# the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
  132 +vhost crop.transcode.vhost.com {
  133 + transcode {
  134 + enabled on;
  135 + ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  136 + engine crop{
  137 + enabled on;
  138 + vfilter {
  139 + vf 'crop=in_w-20:in_h-160:10:80';
  140 + }
  141 + vcodec libx264;
  142 + vbitrate 300;
  143 + vfps 20;
  144 + vwidth 480;
  145 + vheight 320;
  146 + vthreads 2;
  147 + vprofile baseline;
  148 + vpreset superfast;
  149 + vparams {
  150 + }
  151 + acodec libaacplus;
  152 + abitrate 30;
  153 + asample_rate 44100;
  154 + achannels 2;
  155 + aparams {
  156 + }
  157 + output rtmp://[vhost]:[port]/[app]/[stream]_crop;
  158 + }
  159 + }
  160 +}
  161 +# the logo filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
  162 +vhost logo.transcode.vhost.com {
  163 + transcode {
  164 + enabled on;
  165 + ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  166 + engine logo{
  167 + enabled on;
  168 + vfilter {
  169 + vf 'crop=200:100:10:10';
  170 + }
  171 + vcodec libx264;
  172 + vbitrate 300;
  173 + vfps 20;
  174 + vwidth 480;
  175 + vheight 320;
  176 + vthreads 2;
  177 + vprofile baseline;
  178 + vpreset superfast;
  179 + vparams {
  180 + }
  181 + acodec libaacplus;
  182 + abitrate 30;
  183 + asample_rate 44100;
  184 + achannels 2;
  185 + aparams {
  186 + }
  187 + output rtmp://[vhost]:[port]/[app]/[stream]_logo;
  188 + }
  189 + }
  190 +}
75 # transcode all app and stream of vhost 191 # transcode all app and stream of vhost
76 vhost all.transcode.vhost.com { 192 vhost all.transcode.vhost.com {
77 # the streaming transcode configs. 193 # the streaming transcode configs.
@@ -137,6 +253,8 @@ vhost all.transcode.vhost.com { @@ -137,6 +253,8 @@ vhost all.transcode.vhost.com {
137 achannels 2; 253 achannels 2;
138 # other ffmpeg audio params 254 # other ffmpeg audio params
139 aparams { 255 aparams {
  256 + # audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
  257 + profile:a aac_low;
140 } 258 }
141 # output stream. variables: 259 # output stream. variables:
142 # [vhost] the input stream vhost. 260 # [vhost] the input stream vhost.
@@ -207,96 +325,6 @@ vhost all.transcode.vhost.com { @@ -207,96 +325,6 @@ vhost all.transcode.vhost.com {
207 } 325 }
208 } 326 }
209 } 327 }
210 -# the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction  
211 -vhost mirror.transcode.vhost.com {  
212 - transcode {  
213 - enabled on;  
214 - ffmpeg ./objs/ffmpeg/bin/ffmpeg;  
215 - engine mirror{  
216 - enabled on;  
217 - vfilter {  
218 - vf 'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2';  
219 - }  
220 - vcodec libx264;  
221 - vbitrate 300;  
222 - vfps 20;  
223 - vwidth 480;  
224 - vheight 320;  
225 - vthreads 2;  
226 - vprofile baseline;  
227 - vpreset superfast;  
228 - vparams {  
229 - }  
230 - acodec libaacplus;  
231 - abitrate 30;  
232 - asample_rate 44100;  
233 - achannels 2;  
234 - aparams {  
235 - }  
236 - output rtmp://[vhost]:[port]/[app]/[stream]_mirror;  
237 - }  
238 - }  
239 -}  
240 -# the logo filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop  
241 -vhost crop.transcode.vhost.com {  
242 - transcode {  
243 - enabled on;  
244 - ffmpeg ./objs/ffmpeg/bin/ffmpeg;  
245 - engine crop{  
246 - enabled on;  
247 - vfilter {  
248 - vf 'crop=in_w-20:in_h-160:10:80';  
249 - }  
250 - vcodec libx264;  
251 - vbitrate 300;  
252 - vfps 20;  
253 - vwidth 480;  
254 - vheight 320;  
255 - vthreads 2;  
256 - vprofile baseline;  
257 - vpreset superfast;  
258 - vparams {  
259 - }  
260 - acodec libaacplus;  
261 - abitrate 30;  
262 - asample_rate 44100;  
263 - achannels 2;  
264 - aparams {  
265 - }  
266 - output rtmp://[vhost]:[port]/[app]/[stream]_crop;  
267 - }  
268 - }  
269 -}  
270 -# the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop  
271 -vhost logo.transcode.vhost.com {  
272 - transcode {  
273 - enabled on;  
274 - ffmpeg ./objs/ffmpeg/bin/ffmpeg;  
275 - engine logo{  
276 - enabled on;  
277 - vfilter {  
278 - vf 'crop=200:100:10:10';  
279 - }  
280 - vcodec libx264;  
281 - vbitrate 300;  
282 - vfps 20;  
283 - vwidth 480;  
284 - vheight 320;  
285 - vthreads 2;  
286 - vprofile baseline;  
287 - vpreset superfast;  
288 - vparams {  
289 - }  
290 - acodec libaacplus;  
291 - abitrate 30;  
292 - asample_rate 44100;  
293 - achannels 2;  
294 - aparams {  
295 - }  
296 - output rtmp://[vhost]:[port]/[app]/[stream]_logo;  
297 - }  
298 - }  
299 -}  
300 # transcode all stream using the empty ffmpeg demo, donothing. 328 # transcode all stream using the empty ffmpeg demo, donothing.
301 vhost ffempty.transcode.vhost.com { 329 vhost ffempty.transcode.vhost.com {
302 transcode { 330 transcode {
不能预览此文件类型
  1 +ffmpeg-logo.png
  2 +ffmpeg-min.png
  3 + ffmpeg的logo。
  4 +source.flv
  5 + avatar预告片,400kbps。
  6 +
  7 +FreeSerifBold.ttf
  8 + 字体文件,ffmpeg的drawtext filter需要使用。
  9 + 参考:http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
  10 + 下载地址:http://www.fonts2u.com/free-serif.font
  11 +
  12 +aac-iso-13818-7.pdf
  13 + aac标准,aac的编码等。
  14 +
  15 +aac-mp4a-format-ISO_IEC_14496-3+2001.pdf
  16 + aac的封装标准,即ts/flv里面的aac raw data标准。
  17 +
  18 +amf0_spec_121207.pdf
  19 + adobe amf0标准
  20 +
  21 +amf3_spec_121207.pdf
  22 + adobe amf3标准。
  23 +
  24 +H.264-AVC-ISO_IEC_14496-10.pdf
  25 + avc标准,编码部分。
  26 +
  27 +H.264-AVC-ISO_IEC_14496-15.pdf
  28 + avc标准,封装部分。
  29 +
  30 +H.264_MPEG-4-Part-10-White-Paper.pdf
  31 + h264简介。
  32 +
  33 +hls-m3u8-draft-pantos-http-live-streaming-12.txt
  34 + m3u8标准。
  35 +
  36 +hls-mpeg-ts-iso13818-1.pdf
  37 + ts标准。
  38 +
  39 +hls-mpeg-ts-VB_WhitePaper_TransportStreamVSProgramStream_rd2.pdf
  40 + ts的介绍。
  41 +
  42 +rtmp.part1.Chunk-Stream.pdf
  43 +rtmp.part2.Message-Formats.pdf
  44 +rtmp.part3.Commands-Messages.pdf
  45 +rtmp_specification_1.0.pdf
  46 + adobe rtmp标准。
  47 +
  48 +video_file_format_spec_v10_1.pdf
  49 + adobe f4v/flv标准。
This file is too large to display.