diff --git a/README.md b/README.md index 8b09b6473..2bd46fd90 100755 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ FMS URL: rtmp://127.0.0.1:1935/live Stream: livestream For example, use ffmpeg to publish: 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; \ sleep 1; \ done diff --git a/trunk/conf/srs.conf b/trunk/conf/srs.conf index 72b8d0a6d..67bc8ef3a 100755 --- a/trunk/conf/srs.conf +++ b/trunk/conf/srs.conf @@ -15,17 +15,14 @@ vhost __defaultVhost__ { hls_path ./objs/nginx/html; hls_fragment 5; hls_window 30; - forward 127.0.0.1:1936; + #forward 127.0.0.1:1936; transcode { enabled on; ffmpeg ./objs/ffmpeg/bin/ffmpeg; - #ffmpeg ./research/ffempty/ffempty; engine ld{ enabled on; vfilter { - #vf 'drawtext=text=SRS'; - #vf 'crop=in_w-20:in_h-160:10:80'; - i ./doc/ffmpeg-logo.png; + i ./doc/ffmpeg-min.png; filter_complex 'overlay=10:10'; } vcodec libx264; @@ -43,7 +40,6 @@ vhost __defaultVhost__ { asample_rate 44100; achannels 2; aparams { - profile:a aac_low; } 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 vhost all.transcode.vhost.com { # the streaming transcode configs. @@ -137,6 +253,8 @@ vhost all.transcode.vhost.com { achannels 2; # other ffmpeg audio params aparams { + # audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders + profile:a aac_low; } # output stream. variables: # [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. vhost ffempty.transcode.vhost.com { transcode { diff --git a/trunk/doc/FreeSerifBold.ttf b/trunk/doc/FreeSerifBold.ttf new file mode 100644 index 000000000..59a7a90f6 Binary files /dev/null and b/trunk/doc/FreeSerifBold.ttf differ diff --git a/trunk/doc/ffmpeg-min.png b/trunk/doc/ffmpeg-min.png new file mode 100644 index 000000000..10059744a Binary files /dev/null and b/trunk/doc/ffmpeg-min.png differ diff --git a/trunk/doc/readme.txt b/trunk/doc/readme.txt new file mode 100644 index 000000000..fd4b38578 --- /dev/null +++ b/trunk/doc/readme.txt @@ -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标准。 diff --git a/trunk/doc/source.flv b/trunk/doc/source.flv index 84bbb0cd7..36f1765f7 100644 Binary files a/trunk/doc/source.flv and b/trunk/doc/source.flv differ