ffmpeg(ライブカメラ用サーバー)の設定



############################################################################
●ffmpeg (ライブカメラ用サーバー)の設定

(1)準備(USBカメラを用意する)

 カメラ:
    UVC対応 WEBカメラ


(2)FFMPEGのインストール

    公式サイト:    http://www.ffmpeg.org/

■パッケージでインストールする場合
(ffmpeg と ffserver がアボートする)

1) パッケージでインストールする場合はリポジトリを追加する

    「サードパーティーのリポジトリを追加」を参照


2) FFMPEGをインストールする

[root@localhost ~]# yum -y install ffmpeg


3) ffserver の設定ファイル(ffserver.conf)の雛形が無いので作成する

ffserverを起動するとアボートしましたとメッセージが出て終了してしまう。
ソースコードからインストールした方が良さそうです。

■ソースコードからインストールする場合

1) ソースコードをダウンロードする。
    リポジトリから最新のソースを取得するか、リリース版のtarballを取得する

1-1)リポジトリからソースをダウンロードする場合

git が入っていなければ、インストールする

[root@localhost ~]# yum -y install git

リポジトリからソースをダウンロードする

[root@localhost ~]# cd /usr/local/src

[root@localhost src]# git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg

1-2)リリース版の tarball を使う場合

taballをダウンロードする

[root@localhost ~]# cd /usr/local/src
[root@localhost src]# wget http://www.ffmpeg.org/releases/ffmpeg-2.0.1.tar.gz

ダウンロードした tarballを展開する

[root@localhost src]# tar zxvf ffmpeg-2.0.1.tar.gz

2) ダウンロードしたディレクトリに移動して、INSTALL というファイルを読む

[root@localhost src]# cd ffmpeg-2.0.1


3) INSTALL の記述通りにビルド&インストールする

[root@localhost ffmpeg]# ./configure
yasm not found, use --disable-yasm for a crippled build

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solving the problem.

上記のようなメッセージが出るので --disable-yasm をつけて再度実行

[root@www ffmpeg-2.0.1]# ./configure --disable-yasm
install prefix            /usr/local
source path               .
C compiler                gcc
ARCH                      x86 (generic)
big-endian                no
runtime cpu detection     yes
yasm                      no
MMX enabled               yes
MMXEXT enabled            yes
3DNow! enabled            yes
3DNow! extended enabled   yes
SSE enabled               yes
SSSE3 enabled             yes
AVX enabled               yes
FMA4 enabled              yes
i686 features enabled     no
CMOV is fast              no
EBX available             yes
EBP available             yes
debug symbols             yes
strip symbols             yes
optimize for size         no
optimizations             yes
static                    yes
shared                    no
postprocessing support    no
new filter support        yes
network support           yes
threading support         pthreads
safe bitstream reader     yes
SDL support               no
opencl enabled            no
texi2html enabled         no
perl enabled              yes
pod2man enabled           yes
makeinfo enabled          no

External libraries:
bzlib                   iconv                   zlib

Enabled decoders:
aac                     bmv_audio               iff_byterun1
aac_latm                bmv_video               iff_ilbm
aasc                    brender_pix             imc
ac3                     c93                     indeo2
adpcm_4xm               cavs                    indeo3
adpcm_adx               cdgraphics              indeo4
adpcm_afc               cdxl                    indeo5
adpcm_ct                cinepak                 interplay_dpcm
adpcm_dtk               cljr                    interplay_video
adpcm_ea                cllc                    jacosub
adpcm_ea_maxis_xa       comfortnoise            jpeg2000
adpcm_ea_r1             cook                    jpegls
adpcm_ea_r2             cpia                    jv
adpcm_ea_r3             cscd                    kgv1
adpcm_ea_xas            cyuv                    kmvc
adpcm_g722              dca                     lagarith
adpcm_g726              dfa                     loco
adpcm_ima_amv           dirac                   mace3
adpcm_ima_apc           dnxhd                   mace6
adpcm_ima_dk3           dpx                     mdec
adpcm_ima_dk4           dsicinaudio             microdvd
adpcm_ima_ea_eacs       dsicinvideo             mimic
adpcm_ima_ea_sead       dvbsub                  mjpeg
adpcm_ima_iss           dvdsub                  mjpegb
adpcm_ima_oki           dvvideo                 mlp
adpcm_ima_qt            dxa                     mmvideo
adpcm_ima_rad           dxtory                  motionpixels
adpcm_ima_smjpeg        eac3                    movtext
adpcm_ima_wav           eacmv                   mp1
adpcm_ima_ws            eamad                   mp1float
adpcm_ms                eatgq                   mp2
adpcm_sbpro_2           eatgv                   mp2float
adpcm_sbpro_3           eatqi                   mp3
adpcm_sbpro_4           eightbps                mp3adu
adpcm_swf               eightsvx_exp            mp3adufloat
adpcm_thp               eightsvx_fib            mp3float
adpcm_xa                escape124               mp3on4
adpcm_yamaha            escape130               mp3on4float
aic                     evrc                    mpc7
alac                    exr                     mpc8
als                     ffv1                    mpeg1video
amrnb                   ffvhuff                 mpeg2video
amrwb                   ffwavesynth             mpeg4
amv                     flac                    mpegvideo
anm                     flashsv                 mpl2
ansi                    flashsv2                msa1
ape                     flic                    msmpeg4v1
ass                     flv                     msmpeg4v2
asv1                    fourxm                  msmpeg4v3
asv2                    fraps                   msrle
atrac1                  frwu                    mss1
atrac3                  g2m                     mss2
aura                    g723_1                  msvideo1
aura2                   g729                    mszh
avrn                    gif                     mts2
avrp                    gsm                     mvc1
avs                     gsm_ms                  mvc2
avui                    h261                    mxpeg
ayuv                    h263                    nellymoser
bethsoftvid             h263i                   nuv
bfi                     h263p                   paf_audio
bink                    h264                    paf_video
binkaudio_dct           huffyuv                 pam
binkaudio_rdft          iac                     pbm
bintext                 idcin                   pcm_alaw
bmp                     idf                     pcm_bluray
pcm_dvd                 roq                     v308
pcm_f32be               roq_dpcm                v408
pcm_f32le               rpza                    v410
pcm_f64be               rv10                    vb
pcm_f64le               rv20                    vble
pcm_lxf                 rv30                    vc1
pcm_mulaw               rv40                    vc1image
pcm_s16be               s302m                   vcr1
pcm_s16be_planar        sami                    vima
pcm_s16le               sanm                    vmdaudio
pcm_s16le_planar        sgi                     vmdvideo
pcm_s24be               sgirle                  vmnc
pcm_s24daud             shorten                 vorbis
pcm_s24le               sipr                    vp3
pcm_s24le_planar        smackaud                vp5
pcm_s32be               smacker                 vp6
pcm_s32le               smc                     vp6a
pcm_s32le_planar        smvjpeg                 vp6f
pcm_s8                  snow                    vp8
pcm_s8_planar           sol_dpcm                vplayer
pcm_u16be               sonic                   vqa
pcm_u16le               sp5x                    wavpack
pcm_u24be               srt                     webp
pcm_u24le               ssa                     webvtt
pcm_u32be               subrip                  wmalossless
pcm_u32le               subviewer               wmapro
pcm_u8                  subviewer1              wmav1
pcm_zork                sunrast                 wmav2
pcx                     svq1                    wmavoice
pgm                     svq3                    wmv1
pgmyuv                  tak                     wmv2
pgssub                  targa                   wmv3
pictor                  targa_y216              wmv3image
pjs                     text                    wnv1
png                     theora                  ws_snd1
ppm                     thp                     xan_dpcm
prores                  tiertexseqvideo         xan_wc3
prores_lgpl             tiff                    xan_wc4
ptx                     tmv                     xbin
qcelp                   truehd                  xbm
qdm2                    truemotion1             xface
qdraw                   truemotion2             xl
qpeg                    truespeech              xsub
qtrle                   tscc                    xwd
r10k                    tscc2                   y41p
r210                    tta                     yop
ra_144                  twinvq                  yuv4
ra_288                  txd                     zero12v
ralf                    ulti                    zerocodec
rawvideo                utvideo                 zlib
realtext                v210                    zmbv
rl2                     v210x

Enabled encoders:
a64multi                jpegls                  ppm
a64multi5               ljpeg                   prores
aac                     mjpeg                   prores_aw
ac3                     movtext                 prores_ks
ac3_fixed               mp2                     qtrle
adpcm_adx               mpeg1video              r10k
adpcm_g722              mpeg2video              r210
adpcm_g726              mpeg4                   ra_144
adpcm_ima_qt            msmpeg4v2               rawvideo
adpcm_ima_wav           msmpeg4v3               roq
adpcm_ms                msvideo1                roq_dpcm
adpcm_swf               nellymoser              rv10
adpcm_yamaha            pam                     rv20
alac                    pbm                     s302m
amv                     pcm_alaw                sgi
ass                     pcm_f32be               snow
asv1                    pcm_f32le               sonic
asv2                    pcm_f64be               sonic_ls
avrp                    pcm_f64le               srt
avui                    pcm_mulaw               ssa
ayuv                    pcm_s16be               subrip
bmp                     pcm_s16be_planar        sunrast
cljr                    pcm_s16le               svq1
comfortnoise            pcm_s16le_planar        targa
dca                     pcm_s24be               tiff
dnxhd                   pcm_s24daud             tta
dpx                     pcm_s24le               utvideo
dvbsub                  pcm_s24le_planar        v210
dvdsub                  pcm_s32be               v308
dvvideo                 pcm_s32le               v408
eac3                    pcm_s32le_planar        v410
ffv1                    pcm_s8                  vorbis
ffvhuff                 pcm_s8_planar           wmav1
flac                    pcm_u16be               wmav2
flashsv                 pcm_u16le               wmv1
flashsv2                pcm_u24be               wmv2
flv                     pcm_u24le               xbm
g723_1                  pcm_u32be               xface
gif                     pcm_u32le               xsub
h261                    pcm_u8                  xwd
h263                    pcx                     y41p
h263p                   pgm                     yuv4
huffyuv                 pgmyuv                  zlib
jpeg2000                png                     zmbv

Enabled hwaccels:

Enabled parsers:
aac                     dvd_nav                 mpegvideo
aac_latm                dvdsub                  png
ac3                     flac                    pnm
adx                     gsm                     rv30
bmp                     h261                    rv40
cavsvideo               h263                    tak
cook                    h264                    vc1
dca                     mjpeg                   vorbis
dirac                   mlp                     vp3
dnxhd                   mpeg4video              vp8
dvbsub                  mpegaudio

Enabled demuxers:
aac                     hls                     pcm_u16be
ac3                     ico                     pcm_u16le
act                     idcin                   pcm_u24be
adf                     idf                     pcm_u24le
adp                     iff                     pcm_u32be
adx                     ilbc                    pcm_u32le
aea                     image2                  pcm_u8
afc                     image2pipe              pjs
aiff                    ingenient               pmp
amr                     ipmovie                 pva
anm                     ircam                   pvf
apc                     iss                     qcp
ape                     iv8                     r3d
aqtitle                 ivf                     rawvideo
asf                     jacosub                 realtext
ass                     jv                      redspark
ast                     latm                    rl2
au                      lmlm4                   rm
avi                     loas                    roq
avr                     lvf                     rpl
avs                     lxf                     rsd
bethsoftvid             m4v                     rso
bfi                     matroska                rtp
bink                    mgsts                   rtsp
bintext                 microdvd                sami
bit                     mjpeg                   sap
bmv                     mlp                     sbg
boa                     mm                      sdp
brstm                   mmf                     segafilm
c93                     mov                     shorten
caf                     mp3                     siff
cavsvideo               mpc                     smacker
cdg                     mpc8                    smjpeg
cdxl                    mpegps                  smush
concat                  mpegts                  sol
data                    mpegtsraw               sox
daud                    mpegvideo               spdif
dfa                     mpl2                    srt
dirac                   mpsub                   str
dnxhd                   msnwc_tcp               subviewer
dsicin                  mtv                     subviewer1
dts                     mv                      swf
dtshd                   mvi                     tak
dv                      mxf                     tedcaptions
dxa                     mxg                     thp
ea                      nc                      tiertexseq
ea_cdata                nistsphere              tmv
eac3                    nsv                     truehd
epaf                    nut                     tta
ffm                     nuv                     tty
ffmetadata              ogg                     txd
filmstrip               oma                     vc1
flac                    paf                     vc1t
flic                    pcm_alaw                vivo
flv                     pcm_f32be               vmd
fourxm                  pcm_f32le               vobsub
frm                     pcm_f64be               voc
g722                    pcm_f64le               vplayer
g723_1                  pcm_mulaw               vqf
g729                    pcm_s16be               w64
gif                     pcm_s16le               wav
gsm                     pcm_s24be               wc3
gxf                     pcm_s24le               webvtt
h261                    pcm_s32be               wsaud
h263                    pcm_s32le               wsvqa
h264                    pcm_s8                  wtv
wv                      xmv                     yop
xa                      xwma                    yuv4mpegpipe
xbin

Enabled muxers:
a64                     image2pipe              pcm_s24be
ac3                     ipod                    pcm_s24le
adts                    ircam                   pcm_s32be
adx                     ismv                    pcm_s32le
aiff                    ivf                     pcm_s8
amr                     jacosub                 pcm_u16be
asf                     latm                    pcm_u16le
asf_stream              m4v                     pcm_u24be
ass                     matroska                pcm_u24le
ast                     matroska_audio          pcm_u32be
au                      md5                     pcm_u32le
avi                     microdvd                pcm_u8
avm2                    mjpeg                   psp
bit                     mkvtimestamp_v2         rawvideo
caf                     mlp                     rm
cavsvideo               mmf                     roq
crc                     mov                     rso
data                    mp2                     rtp
daud                    mp3                     rtsp
dirac                   mp4                     sap
dnxhd                   mpeg1system             segment
dts                     mpeg1vcd                smjpeg
dv                      mpeg1video              smoothstreaming
eac3                    mpeg2dvd                sox
f4v                     mpeg2svcd               spdif
ffm                     mpeg2video              srt
ffmetadata              mpeg2vob                stream_segment
filmstrip               mpegts                  swf
flac                    mpjpeg                  tee
flv                     mxf                     tg2
framecrc                mxf_d10                 tgp
framemd5                null                    truehd
g722                    nut                     vc1
g723_1                  ogg                     vc1t
gif                     oma                     voc
gxf                     pcm_alaw                w64
h261                    pcm_f32be               wav
h263                    pcm_f32le               webm
h264                    pcm_f64be               webvtt
hls                     pcm_f64le               wtv
ico                     pcm_mulaw               wv
ilbc                    pcm_s16be               yuv4mpegpipe
image2                  pcm_s16le

Enabled protocols:
cache                   gopher                  pipe
concat                  hls                     rtmp
crypto                  http                    rtmpt
data                    httpproxy               rtp
ffrtmphttp              md5                     srtp
file                    mmsh                    tcp
ftp                     mmst                    udp

Enabled filters:
aconvert                colorbalance            null
aevalsrc                colorchannelmixer       nullsink
afade                   concat                  nullsrc
aformat                 copy                    overlay
ainterleave             crop                    pad
allpass                 curves                  pan
alphaextract            dctdnoiz                perms
alphamerge              decimate                pixdesctest
amerge                  deshake                 psnr
amix                    drawbox                 removelogo
amovie                  drawgrid                rgbtestsrc
anull                   earwax                  rotate
anullsink               edgedetect              scale
anullsrc                equalizer               select
apad                    extractplanes           sendcmd
aperms                  fade                    separatefields
aphaser                 field                   setdar
aresample               fieldmatch              setfield
aselect                 fieldorder              setpts
asendcmd                format                  setsar
asetnsamples            fps                     settb
asetpts                 framestep               showinfo
asetrate                gradfun                 showspectrum
asettb                  haldclut                showwaves
ashowinfo               haldclutsrc             silencedetect
asplit                  hflip                   sine
astats                  highpass                smptebars
astreamsync             histogram               smptehdbars
atempo                  idet                    split
atrim                   il                      swapuv
avectorscope            interleave              telecine
bandpass                join                    testsrc
bandreject              life                    thumbnail
bass                    lowpass                 tile
bbox                    lut                     transpose
biquad                  lut3d                   treble
blackdetect             lutrgb                  trim
blend                   lutyuv                  unsharp
cellauto                mandelbrot              vflip
channelmap              movie                   vignette
channelsplit            negate                  volume
color                   noformat                volumedetect

Enabled bsfs:
aac_adtstoasc           mjpeg2jpeg              mp3_header_decompress
chomp                   mjpega_dump_header      noise
dump_extradata          mov2textsub             remove_extradata
h264_mp4toannexb        mp3_header_compress     text2movsub
imx_dump_header

Enabled indevs:
alsa                    fbdev                   oss
dv1394                  lavfi                   v4l2

Enabled outdevs:
alsa                    oss                     v4l2

License: LGPL version 2.1 or later
Creating config.mak, config.h, and doc/config.texi...
[root@www ffmpeg-2.0.1]#

今度はOKなのでビルドする

[root@localhost ffmpeg-2.0.1]# make
CC      libavdevice/alldevices.o
CC      libavdevice/alsa-audio-common.o
CC      libavdevice/alsa-audio-dec.o
CC      libavdevice/alsa-audio-enc.o
CC      libavdevice/avdevice.o
CC      libavdevice/dv1394.o
CC      libavdevice/fbdev.o
CC      libavdevice/lavfi.o
CC      libavdevice/oss_audio.o
CC      libavdevice/timefilter.o
CC      libavdevice/v4l2-common.o
CC      libavdevice/v4l2.o
libavdevice/v4l2.c: In function ‘mmap_read_frame’:
libavdevice/v4l2.c:554: 警告: ‘destruct’ is deprecated (declared at ./libavcodec/avcodec.h:1095)
CC      libavdevice/v4l2enc.o
AR      libavdevice/libavdevice.a
CC      libavfilter/af_aconvert.o
CC      libavfilter/af_afade.o
CC      libavfilter/af_aformat.o
CC      libavfilter/af_amerge.o
CC      libavfilter/af_amix.o

    :
    :
    :

ffprobe.c:2031: note: initialized from here
ffprobe.c:2031: note: initialized from here
ffprobe.c: In function ‘opt_show_streams’:
ffprobe.c:2031: 警告: dereferencing pointer ‘id’ does break strict-aliasing rules
ffprobe.c:2032: 警告: dereferencing pointer ‘id’ does break strict-aliasing rules
ffprobe.c:2031: note: initialized from here
ffprobe.c:2031: note: initialized from here
LD      ffprobe_g
CP      ffprobe
STRIP   ffprobe
CC      ffserver.o
LD      ffserver_g
CP      ffserver
STRIP   ffserver
[root@localhost ffmpeg-2.0.1]#

警告は出るが一応ビルドは正常に終了するのでインストールする

[root@localhost ffmpeg-2.0.1]# make install
INSTALL doc/ffmpeg.1
INSTALL doc/ffprobe.1
INSTALL doc/ffserver.1
INSTALL doc/ffmpeg-all.1
INSTALL doc/ffprobe-all.1
INSTALL doc/ffserver-all.1
INSTALL doc/ffmpeg-utils.1
INSTALL doc/ffmpeg-scaler.1
INSTALL doc/ffmpeg-resampler.1
INSTALL doc/ffmpeg-codecs.1
INSTALL doc/ffmpeg-bitstream-filters.1
INSTALL doc/ffmpeg-formats.1
INSTALL doc/ffmpeg-protocols.1
INSTALL doc/ffmpeg-devices.1
INSTALL doc/ffmpeg-filters.1
INSTALL doc/libavutil.3
INSTALL doc/libswscale.3
INSTALL doc/libswresample.3
INSTALL doc/libavcodec.3
INSTALL doc/libavformat.3
INSTALL doc/libavdevice.3
INSTALL doc/libavfilter.3
INSTALL doc/ffmpeg.1
INSTALL doc/ffprobe.1
INSTALL doc/ffserver.1
INSTALL doc/ffmpeg-all.1
INSTALL doc/ffprobe-all.1
INSTALL doc/ffserver-all.1
INSTALL doc/ffmpeg-utils.1
INSTALL doc/ffmpeg-scaler.1
INSTALL doc/ffmpeg-resampler.1
INSTALL doc/ffmpeg-codecs.1
INSTALL doc/ffmpeg-bitstream-filters.1
INSTALL doc/ffmpeg-formats.1
INSTALL doc/ffmpeg-protocols.1
INSTALL doc/ffmpeg-devices.1
INSTALL doc/ffmpeg-filters.1
INSTALL doc/libavutil.3
INSTALL doc/libswscale.3
INSTALL doc/libswresample.3
INSTALL doc/libavcodec.3
INSTALL doc/libavformat.3
INSTALL doc/libavdevice.3
INSTALL doc/libavfilter.3
INSTALL install-progs-yes
INSTALL ffmpeg
INSTALL ffprobe
INSTALL ffserver
INSTALL presets/libvpx-1080p.ffpreset
INSTALL presets/libvpx-1080p50_60.ffpreset
INSTALL presets/libvpx-360p.ffpreset
INSTALL presets/libvpx-720p.ffpreset
INSTALL presets/libvpx-720p50_60.ffpreset
INSTALL presets/libx264-ipod320.ffpreset
INSTALL presets/libx264-ipod640.ffpreset
INSTALL doc/ffprobe.xsd
INSTALL doc/examples/decoding_encoding.c
INSTALL doc/examples/demuxing.c
INSTALL doc/examples/filtering_audio.c
INSTALL doc/examples/filtering_video.c
INSTALL doc/examples/metadata.c
INSTALL doc/examples/muxing.c
INSTALL doc/examples/resampling_audio.c
INSTALL doc/examples/scaling_video.c
INSTALL doc/examples/Makefile
INSTALL doc/examples/README
INSTALL presets/libvpx-1080p.ffpreset
INSTALL presets/libvpx-1080p50_60.ffpreset
INSTALL presets/libvpx-360p.ffpreset
INSTALL presets/libvpx-720p.ffpreset
INSTALL presets/libvpx-720p50_60.ffpreset
INSTALL presets/libx264-ipod320.ffpreset
INSTALL presets/libx264-ipod640.ffpreset
INSTALL doc/ffprobe.xsd
INSTALL doc/examples/decoding_encoding.c
INSTALL doc/examples/demuxing.c
INSTALL doc/examples/filtering_audio.c
INSTALL doc/examples/filtering_video.c
INSTALL doc/examples/metadata.c
INSTALL doc/examples/muxing.c
INSTALL doc/examples/resampling_audio.c
INSTALL doc/examples/scaling_video.c
INSTALL doc/examples/Makefile
INSTALL doc/examples/README
INSTALL libavdevice/libavdevice.a
INSTALL libavfilter/libavfilter.a
INSTALL libavformat/libavformat.a
INSTALL libavcodec/libavcodec.a
INSTALL libswresample/libswresample.a
INSTALL libswscale/libswscale.a
INSTALL libavutil/libavutil.a
INSTALL libavdevice/avdevice.h
INSTALL libavdevice/version.h
INSTALL libavdevice/libavdevice.pc
INSTALL libavfilter/asrc_abuffer.h
INSTALL libavfilter/avcodec.h
INSTALL libavfilter/avfilter.h
INSTALL libavfilter/avfiltergraph.h
INSTALL libavfilter/buffersink.h
INSTALL libavfilter/buffersrc.h
INSTALL libavfilter/version.h
INSTALL libavfilter/libavfilter.pc
INSTALL libavformat/avformat.h
INSTALL libavformat/avio.h
INSTALL libavformat/version.h
INSTALL libavformat/libavformat.pc
INSTALL libavcodec/avcodec.h
INSTALL libavcodec/avfft.h
INSTALL libavcodec/dxva2.h
INSTALL libavcodec/old_codec_ids.h
INSTALL libavcodec/vaapi.h
INSTALL libavcodec/vda.h
INSTALL libavcodec/vdpau.h
INSTALL libavcodec/version.h
INSTALL libavcodec/xvmc.h
INSTALL libavcodec/libavcodec.pc
INSTALL libswresample/swresample.h
INSTALL libswresample/version.h
INSTALL libswresample/libswresample.pc
INSTALL libswscale/swscale.h
INSTALL libswscale/version.h
INSTALL libswscale/libswscale.pc
INSTALL libavutil/adler32.h
INSTALL libavutil/aes.h
INSTALL libavutil/attributes.h
INSTALL libavutil/audio_fifo.h
INSTALL libavutil/audioconvert.h
INSTALL libavutil/avassert.h
INSTALL libavutil/avstring.h
INSTALL libavutil/avutil.h
INSTALL libavutil/base64.h
INSTALL libavutil/blowfish.h
INSTALL libavutil/bprint.h
INSTALL libavutil/bswap.h
INSTALL libavutil/buffer.h
INSTALL libavutil/channel_layout.h
INSTALL libavutil/common.h
INSTALL libavutil/cpu.h
INSTALL libavutil/crc.h
INSTALL libavutil/error.h
INSTALL libavutil/eval.h
INSTALL libavutil/fifo.h
INSTALL libavutil/file.h
INSTALL libavutil/frame.h
INSTALL libavutil/hmac.h
INSTALL libavutil/imgutils.h
INSTALL libavutil/intfloat.h
INSTALL libavutil/intfloat_readwrite.h
INSTALL libavutil/intreadwrite.h
INSTALL libavutil/lfg.h
INSTALL libavutil/log.h
INSTALL libavutil/mathematics.h
INSTALL libavutil/md5.h
INSTALL libavutil/mem.h
INSTALL libavutil/murmur3.h
INSTALL libavutil/dict.h
INSTALL libavutil/old_pix_fmts.h
INSTALL libavutil/opt.h
INSTALL libavutil/parseutils.h
INSTALL libavutil/pixdesc.h
INSTALL libavutil/pixfmt.h
INSTALL libavutil/random_seed.h
INSTALL libavutil/rational.h
INSTALL libavutil/ripemd.h
INSTALL libavutil/samplefmt.h
INSTALL libavutil/sha.h
INSTALL libavutil/sha512.h
INSTALL libavutil/time.h
INSTALL libavutil/timecode.h
INSTALL libavutil/timestamp.h
INSTALL libavutil/version.h
INSTALL libavutil/xtea.h
INSTALL libavutil/lzo.h
INSTALL libavutil/avconfig.h
INSTALL libavutil/libavutil.pc
[root@localhost ffmpeg-2.0.1]#

4) ffserver の設定ファイル(ffserver.conf)の雛形を /usr/local/etc にコピーする

[root@localhost ffmpeg-2.0.1]# cp ./doc/ffserver.conf /usr/local/etc


■インストール後の設定

    /usr/local/etc/ffserver.conf の編集

[root@localhost etc]# cat ffserver.conf

Port 8090
BindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -
NoDaemon


File /tmp/feed1.ffm
FileMaxSize 200K
ACL allow 127.0.0.1



Feed feed1.ffm
Format mpeg
#AudioBitRate 32            <-- コメントアウト
#AudioChannels 1            <-- コメントアウト
#AudioSampleRate 44100      <-- コメントアウト
VideoBitRate 64
VideoBufferSize 40
VideoFrameRate 3
VideoSize 160x128
VideoGopSize 12
NoAudio                     <-- コメントを外す


# Single JPEG

           <-- コメントを外す
Feed feed1.ffm              <-- コメントを外す
Format jpeg                 <-- コメントを外す
VideoFrameRate 2            <-- コメントを外す
VideoIntraOnly              <-- コメントを外す
#VideoSize 352x240          <-- コメントのまま
NoAudio                     <-- コメントを外す
Strict -1                   <-- コメントを外す
                   <-- コメントを外す

# Flash

           <-- コメントを外す
Feed feed1.ffm              <-- コメントを外す
Format swf                  <-- コメントを外す
VideoFrameRate 2            <-- コメントを外す
VideoIntraOnly              <-- コメントを外す
NoAudio                     <-- コメントを外す
                   <-- コメントを外す

# ASF compatible


Feed feed1.ffm
Format asf
VideoFrameRate 15
#VideoSize 352x240          <-- 変更
VideoSize 320x240           <-- サイズを変える
VideoBitRate 256
VideoBufferSize 40
VideoGopSize 30
#AudioBitRate 64            <-- コメントアウトする
StartSendOnKey
NoAudio                     <-- 追加


# Real with audio and video at 64 kbits

            <-- コメントを外す
Feed feed1.ffm              <-- コメントを外す
Format rm                   <-- コメントを外す
#AudioBitRate 32
VideoBitRate 128            <-- コメントを外す
VideoFrameRate 25           <-- コメントを外す
VideoGopSize 25             <-- コメントを外す
NoAudio                     <-- コメントを外す
                   <-- コメントを外す

# Server status


Format status

# Only allow local people to get the status
ACL allow localhost
ACL allow 192.168.1.0 192.168.255.255

#FaviconURL http://pond1.gladstonefamily.net:8080/favicon.ico


# Redirect index.html to the appropriate site


URL http://www.ffmpeg.org/


■起動スクリプトを作成する

[root@localhost init.d]# cat livecam
#!/bin/bash
#
# livecam       This shell script start and stop ffmpeg and ffserver.
#
# chkconfig: 345 97 11
# description: Starts and stops the ffmpeg and ffserver daemons \
#              used to provide Live Camera services.

### BEGIN INIT INFO
# Provides: livecam
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Should-Start: $syslog $named
# Should-Stop: $syslog $named
# Short-Description: start and stop livecam
# Description: livecam is the ffserver and ffmpeg video streaming service.
### END INIT INFO

#CAMERA_MODULE=pwc
CAMERA_MODULE=""

#export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so

# ffmpeg を起動する場合は 1 起動しない場合は 0
ffm=1
# 他機のffmpegでキャプチャした画像を自機のffserverで配信する場合など
#ffm=0          # no ffmpeg (ffserver only)

# ffserver を起動する場合は 1 起動しない場合は 0
ffs=1
# 自機のffmpegでキャプチャした画像を他機のffserverで配信する場合など
#ffs=0          # no ffserver (ffmpeg only)

SERVER="localhost:8090"

CONFIG=/usr/local/etc/ffserver.conf
FFSERVER=/usr/local/bin/ffserver

FFMPEG=/usr/local/bin/ffmpeg
FFMPEG_OPT="-f video4linux2 -an -s 320x240 -i /dev/video0 http://${SERVER}/feed1.ffm"

LOCKFILE=/var/lock/subsys/ffserver

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

RETVAL=0
RETVAL2=0

start() {
        echo "livecam start..."
        /bin/ps ax | /bin/grep -v grep | /bin/grep -q ${FFMPEG} >/dev/null 2>&1
        if [ $? -eq 0 ]; then
                echo "ffmpeg is running..."
                ffm=0
        fi
        /bin/ps ax | /bin/grep -v grep | /bin/grep -q ${FFSERVER} >/dev/null 2>&1
        if [ $? -eq 0 ]; then
                echo "ffserver is running ..."
                ffs=0
        fi
        if [ x"$CAMERA_MODULE" != x"" ]; then
                if ! /sbin/lsmod | grep -q ${CAMERA_MODULE} ; then
                        echo -n $"Loading camera modules: "
                        /sbin/modprobe ${CAMERA_MODULE}
                        sleep 3
                fi
        fi
        if [ $ffs -eq 1 ]; then
                echo "starting livecam ..."
                echo -n $"Starting ffserver services: "
                ${FFSERVER} -f ${CONFIG} >/dev/null 2>&1 &
#               ${FFSERVER} -f ${CONFIG} &
                RETVAL=$?
                echo
                sleep 3
        fi
        if [ $ffm -eq 1 ]; then
                echo -n $"Starting ffmpeg services: "
                ${FFMPEG} ${FFMPEG_OPT} >/dev/null 2>&1 &
#               ${FFMPEG} ${FFMPEG_OPT} &
                RETVAL2=$?
                echo
        fi
        [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch ${LOCKFILE} || RETVAL=1
        echo ""
        return $RETVAL
}

stop() {
        echo "livecam stop..."
        if [ $ffm -eq 1 ]; then
                echo -n $"Shutting down ffmpeg services: "
                killproc ffmpeg
                RETVAL=$?
                echo
        fi
        if [ $ffs -eq 1 ]; then
                echo -n $"Shutting down ffserver services: "
                killproc ffserver
                RETVAL2=$?
                echo
        fi
        [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f ${LOCKFILE}
        echo ""
        return $RETVAL
}


#
# Usage statement.
#

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                stop
                start
                ;;
        *)
                echo "usage: $0 {start|stop|restart}"
                exit 1
                ;;
esac

exit $RETVAL

[root@localhost init.d]#

■起動スクリプトを登録する

[root@localhost etc]# cd /etc/init.d
[root@localhost init.d]# chkconfig --add livecam
[root@localhost init.d]# chkconfig livecam on




戻る