mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add drawtext filter sample
This commit is contained in:
parent
ecec80ab43
commit
5cc1ad6da8
6 changed files with 174 additions and 97 deletions
|
@ -32,7 +32,7 @@ FMS URL: rtmp://127.0.0.1:1935/live
|
||||||
Stream: livestream
|
Stream: livestream
|
||||||
For example, use ffmpeg to publish:
|
For example, use ffmpeg to publish:
|
||||||
for((;;)); do \
|
for((;;)); do \
|
||||||
./objs/ffmpeg/bin/ffmpeg -re -i doc/source.flv -vcodec copy -acodec copy \
|
./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.flv -vcodec copy -acodec copy \
|
||||||
-f flv -y rtmp://127.0.0.1:1935/live/livestream; \
|
-f flv -y rtmp://127.0.0.1:1935/live/livestream; \
|
||||||
sleep 1; \
|
sleep 1; \
|
||||||
done
|
done
|
||||||
|
|
|
@ -15,17 +15,14 @@ vhost __defaultVhost__ {
|
||||||
hls_path ./objs/nginx/html;
|
hls_path ./objs/nginx/html;
|
||||||
hls_fragment 5;
|
hls_fragment 5;
|
||||||
hls_window 30;
|
hls_window 30;
|
||||||
forward 127.0.0.1:1936;
|
#forward 127.0.0.1:1936;
|
||||||
transcode {
|
transcode {
|
||||||
enabled on;
|
enabled on;
|
||||||
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||||
#ffmpeg ./research/ffempty/ffempty;
|
|
||||||
engine ld{
|
engine ld{
|
||||||
enabled on;
|
enabled on;
|
||||||
vfilter {
|
vfilter {
|
||||||
#vf 'drawtext=text=SRS';
|
i ./doc/ffmpeg-min.png;
|
||||||
#vf 'crop=in_w-20:in_h-160:10:80';
|
|
||||||
i ./doc/ffmpeg-logo.png;
|
|
||||||
filter_complex 'overlay=10:10';
|
filter_complex 'overlay=10:10';
|
||||||
}
|
}
|
||||||
vcodec libx264;
|
vcodec libx264;
|
||||||
|
@ -43,7 +40,6 @@ vhost __defaultVhost__ {
|
||||||
asample_rate 44100;
|
asample_rate 44100;
|
||||||
achannels 2;
|
achannels 2;
|
||||||
aparams {
|
aparams {
|
||||||
profile:a aac_low;
|
|
||||||
}
|
}
|
||||||
output rtmp://[vhost]:[port]/[app]/[stream]_ld;
|
output rtmp://[vhost]:[port]/[app]/[stream]_ld;
|
||||||
}
|
}
|
||||||
|
@ -72,6 +68,126 @@ vhost __defaultVhost__ {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
# the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
|
||||||
|
vhost mirror.transcode.vhost.com {
|
||||||
|
transcode {
|
||||||
|
enabled on;
|
||||||
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||||
|
engine mirror{
|
||||||
|
enabled on;
|
||||||
|
vfilter {
|
||||||
|
vf 'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2';
|
||||||
|
}
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 300;
|
||||||
|
vfps 20;
|
||||||
|
vwidth 480;
|
||||||
|
vheight 320;
|
||||||
|
vthreads 2;
|
||||||
|
vprofile baseline;
|
||||||
|
vpreset superfast;
|
||||||
|
vparams {
|
||||||
|
}
|
||||||
|
acodec libaacplus;
|
||||||
|
abitrate 30;
|
||||||
|
asample_rate 44100;
|
||||||
|
achannels 2;
|
||||||
|
aparams {
|
||||||
|
}
|
||||||
|
output rtmp://[vhost]:[port]/[app]/[stream]_mirror;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
|
||||||
|
vhost drawtext.transcode.vhost.com {
|
||||||
|
transcode {
|
||||||
|
enabled on;
|
||||||
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||||
|
engine drawtext{
|
||||||
|
enabled on;
|
||||||
|
vfilter {
|
||||||
|
vf 'drawtext=text=SimpleRtmpServer(SRS):x=10:y=10:fontcolor=#EEEEEE:fontfile=./doc/FreeSerifBold.ttf';
|
||||||
|
}
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 300;
|
||||||
|
vfps 20;
|
||||||
|
vwidth 480;
|
||||||
|
vheight 320;
|
||||||
|
vthreads 2;
|
||||||
|
vprofile baseline;
|
||||||
|
vpreset superfast;
|
||||||
|
vparams {
|
||||||
|
}
|
||||||
|
acodec libaacplus;
|
||||||
|
abitrate 30;
|
||||||
|
asample_rate 44100;
|
||||||
|
achannels 2;
|
||||||
|
aparams {
|
||||||
|
}
|
||||||
|
output rtmp://[vhost]:[port]/[app]/[stream]_drawtext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
|
||||||
|
vhost crop.transcode.vhost.com {
|
||||||
|
transcode {
|
||||||
|
enabled on;
|
||||||
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||||
|
engine crop{
|
||||||
|
enabled on;
|
||||||
|
vfilter {
|
||||||
|
vf 'crop=in_w-20:in_h-160:10:80';
|
||||||
|
}
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 300;
|
||||||
|
vfps 20;
|
||||||
|
vwidth 480;
|
||||||
|
vheight 320;
|
||||||
|
vthreads 2;
|
||||||
|
vprofile baseline;
|
||||||
|
vpreset superfast;
|
||||||
|
vparams {
|
||||||
|
}
|
||||||
|
acodec libaacplus;
|
||||||
|
abitrate 30;
|
||||||
|
asample_rate 44100;
|
||||||
|
achannels 2;
|
||||||
|
aparams {
|
||||||
|
}
|
||||||
|
output rtmp://[vhost]:[port]/[app]/[stream]_crop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# the logo filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
|
||||||
|
vhost logo.transcode.vhost.com {
|
||||||
|
transcode {
|
||||||
|
enabled on;
|
||||||
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||||
|
engine logo{
|
||||||
|
enabled on;
|
||||||
|
vfilter {
|
||||||
|
vf 'crop=200:100:10:10';
|
||||||
|
}
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 300;
|
||||||
|
vfps 20;
|
||||||
|
vwidth 480;
|
||||||
|
vheight 320;
|
||||||
|
vthreads 2;
|
||||||
|
vprofile baseline;
|
||||||
|
vpreset superfast;
|
||||||
|
vparams {
|
||||||
|
}
|
||||||
|
acodec libaacplus;
|
||||||
|
abitrate 30;
|
||||||
|
asample_rate 44100;
|
||||||
|
achannels 2;
|
||||||
|
aparams {
|
||||||
|
}
|
||||||
|
output rtmp://[vhost]:[port]/[app]/[stream]_logo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
# transcode all app and stream of vhost
|
# transcode all app and stream of vhost
|
||||||
vhost all.transcode.vhost.com {
|
vhost all.transcode.vhost.com {
|
||||||
# the streaming transcode configs.
|
# the streaming transcode configs.
|
||||||
|
@ -137,6 +253,8 @@ vhost all.transcode.vhost.com {
|
||||||
achannels 2;
|
achannels 2;
|
||||||
# other ffmpeg audio params
|
# other ffmpeg audio params
|
||||||
aparams {
|
aparams {
|
||||||
|
# audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
|
||||||
|
profile:a aac_low;
|
||||||
}
|
}
|
||||||
# output stream. variables:
|
# output stream. variables:
|
||||||
# [vhost] the input stream vhost.
|
# [vhost] the input stream vhost.
|
||||||
|
@ -207,96 +325,6 @@ vhost all.transcode.vhost.com {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
|
|
||||||
vhost mirror.transcode.vhost.com {
|
|
||||||
transcode {
|
|
||||||
enabled on;
|
|
||||||
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
|
||||||
engine mirror{
|
|
||||||
enabled on;
|
|
||||||
vfilter {
|
|
||||||
vf 'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2';
|
|
||||||
}
|
|
||||||
vcodec libx264;
|
|
||||||
vbitrate 300;
|
|
||||||
vfps 20;
|
|
||||||
vwidth 480;
|
|
||||||
vheight 320;
|
|
||||||
vthreads 2;
|
|
||||||
vprofile baseline;
|
|
||||||
vpreset superfast;
|
|
||||||
vparams {
|
|
||||||
}
|
|
||||||
acodec libaacplus;
|
|
||||||
abitrate 30;
|
|
||||||
asample_rate 44100;
|
|
||||||
achannels 2;
|
|
||||||
aparams {
|
|
||||||
}
|
|
||||||
output rtmp://[vhost]:[port]/[app]/[stream]_mirror;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# the logo filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
|
|
||||||
vhost crop.transcode.vhost.com {
|
|
||||||
transcode {
|
|
||||||
enabled on;
|
|
||||||
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
|
||||||
engine crop{
|
|
||||||
enabled on;
|
|
||||||
vfilter {
|
|
||||||
vf 'crop=in_w-20:in_h-160:10:80';
|
|
||||||
}
|
|
||||||
vcodec libx264;
|
|
||||||
vbitrate 300;
|
|
||||||
vfps 20;
|
|
||||||
vwidth 480;
|
|
||||||
vheight 320;
|
|
||||||
vthreads 2;
|
|
||||||
vprofile baseline;
|
|
||||||
vpreset superfast;
|
|
||||||
vparams {
|
|
||||||
}
|
|
||||||
acodec libaacplus;
|
|
||||||
abitrate 30;
|
|
||||||
asample_rate 44100;
|
|
||||||
achannels 2;
|
|
||||||
aparams {
|
|
||||||
}
|
|
||||||
output rtmp://[vhost]:[port]/[app]/[stream]_crop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
|
|
||||||
vhost logo.transcode.vhost.com {
|
|
||||||
transcode {
|
|
||||||
enabled on;
|
|
||||||
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
|
||||||
engine logo{
|
|
||||||
enabled on;
|
|
||||||
vfilter {
|
|
||||||
vf 'crop=200:100:10:10';
|
|
||||||
}
|
|
||||||
vcodec libx264;
|
|
||||||
vbitrate 300;
|
|
||||||
vfps 20;
|
|
||||||
vwidth 480;
|
|
||||||
vheight 320;
|
|
||||||
vthreads 2;
|
|
||||||
vprofile baseline;
|
|
||||||
vpreset superfast;
|
|
||||||
vparams {
|
|
||||||
}
|
|
||||||
acodec libaacplus;
|
|
||||||
abitrate 30;
|
|
||||||
asample_rate 44100;
|
|
||||||
achannels 2;
|
|
||||||
aparams {
|
|
||||||
}
|
|
||||||
output rtmp://[vhost]:[port]/[app]/[stream]_logo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# transcode all stream using the empty ffmpeg demo, donothing.
|
# transcode all stream using the empty ffmpeg demo, donothing.
|
||||||
vhost ffempty.transcode.vhost.com {
|
vhost ffempty.transcode.vhost.com {
|
||||||
transcode {
|
transcode {
|
||||||
|
|
BIN
trunk/doc/FreeSerifBold.ttf
Normal file
BIN
trunk/doc/FreeSerifBold.ttf
Normal file
Binary file not shown.
BIN
trunk/doc/ffmpeg-min.png
Normal file
BIN
trunk/doc/ffmpeg-min.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
49
trunk/doc/readme.txt
Normal file
49
trunk/doc/readme.txt
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
ffmpeg-logo.png
|
||||||
|
ffmpeg-min.png
|
||||||
|
ffmpeg的logo。
|
||||||
|
source.flv
|
||||||
|
avatar预告片,400kbps。
|
||||||
|
|
||||||
|
FreeSerifBold.ttf
|
||||||
|
字体文件,ffmpeg的drawtext filter需要使用。
|
||||||
|
参考:http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
|
||||||
|
下载地址:http://www.fonts2u.com/free-serif.font
|
||||||
|
|
||||||
|
aac-iso-13818-7.pdf
|
||||||
|
aac标准,aac的编码等。
|
||||||
|
|
||||||
|
aac-mp4a-format-ISO_IEC_14496-3+2001.pdf
|
||||||
|
aac的封装标准,即ts/flv里面的aac raw data标准。
|
||||||
|
|
||||||
|
amf0_spec_121207.pdf
|
||||||
|
adobe amf0标准
|
||||||
|
|
||||||
|
amf3_spec_121207.pdf
|
||||||
|
adobe amf3标准。
|
||||||
|
|
||||||
|
H.264-AVC-ISO_IEC_14496-10.pdf
|
||||||
|
avc标准,编码部分。
|
||||||
|
|
||||||
|
H.264-AVC-ISO_IEC_14496-15.pdf
|
||||||
|
avc标准,封装部分。
|
||||||
|
|
||||||
|
H.264_MPEG-4-Part-10-White-Paper.pdf
|
||||||
|
h264简介。
|
||||||
|
|
||||||
|
hls-m3u8-draft-pantos-http-live-streaming-12.txt
|
||||||
|
m3u8标准。
|
||||||
|
|
||||||
|
hls-mpeg-ts-iso13818-1.pdf
|
||||||
|
ts标准。
|
||||||
|
|
||||||
|
hls-mpeg-ts-VB_WhitePaper_TransportStreamVSProgramStream_rd2.pdf
|
||||||
|
ts的介绍。
|
||||||
|
|
||||||
|
rtmp.part1.Chunk-Stream.pdf
|
||||||
|
rtmp.part2.Message-Formats.pdf
|
||||||
|
rtmp.part3.Commands-Messages.pdf
|
||||||
|
rtmp_specification_1.0.pdf
|
||||||
|
adobe rtmp标准。
|
||||||
|
|
||||||
|
video_file_format_spec_v10_1.pdf
|
||||||
|
adobe f4v/flv标准。
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue