ここ数日間、FFMpeg と FFServer を使って遊んでいます。組み込みデバイス (統合された HD カメラ付き) とさまざまなクライアント (スマートフォン) の間のライブストリーミングの候補と考えているからです。
FFServer の次の構成を使用して、ストリームを実現することができました。
HTTPPort 1234
RTSPPort 1235
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 512000 # Maximum bandwidth per client
# set this high enough to exceed stream bitrate
CustomLog -
NoDaemon # Remove this if you want FFserver to daemonize after start
<Feed feed.ffm> # This is the input feed where FFmpeg will send
File /tmp/feed.ffm # video stream.
FileMaxSize 512K
</Feed>
<Stream test.h264> # Output stream URL definition
Feed feed.ffm # Feed from which to receive video
Format rtp
# Video settings
VideoCodec libvpx
VideoSize 720x576 # Video resolution
VideoFrameRate 60 # Video FPS
AVOptionVideo flags +global_header # Parameters passed to encoder
# (same as ffmpeg command-line parameters)
AVOptionVideo cpu-used 0
AVOptionVideo qmin 10
AVOptionVideo qmax 42
AVOptionVideo quality good
AVOptionAudio flags +global_header
PreRoll 15
StartSendOnKey
VideoBitRate 400 # Video bitrate
NoAudio
</Stream>
そして、ストリームを FFServer に送信する次の FFMpeg コマンド:
ffmpeg -rtbufsize 2100M -f dshow -i video="Integrated Camera" -vcodec libx264 http://127.0.0.1:1234/feed.ffm
また、次の URL を使用して RTSP ストリームを再生する単純な Android クライアントもあります。
rtsp://mylocalnetworkip:1235/test.h264
しかし今、組み込みデバイスとスマートフォンの間で P2P 接続を実現しようとしています。これは (LAN ではなく) インターネット経由で、UDP ホール パンチングを実行できる必要があります (Skype が p2p ビデオ通話で行うように)。
- これはffmpegだけで達成できますか?
- ffmpeg をCoturnなどの Stun/Turn サーバーと統合して、対称 NAT をバイパスできますか?