① 最近被導師要求做一個網頁上的視頻監控軟體,就是遠端有一個監控攝影機,要把視頻傳輸過來,打開瀏覽器就
我曾經做過一個簡單的網頁視頻監控軟體。首先把遠端監控攝像頭驅動起來,可以採用linux V4L驅動,就是能採集到一幅幅的jpeg圖片,然後搭一個小型web伺服器,網頁使用javascript腳本編寫,主要功能就是定時通過ajax遠程請求攝像頭採集到圖片的URL,然後通過javascript的局部刷新功能刷新HTML img標簽的src,實現網頁中的圖片不斷動態刷新,也就是實現了網頁視頻監控,當然不太流暢。想流暢就在遠端攝像頭那裡搭建一個rtsp流媒體伺服器,可以用FFMPEG中的ffserver,網頁端調用本地播放器通過rtsp協議播放流媒體即可。
福愛迪電子
② 網頁中如何嵌入rtsp協議的流媒體視頻
流媒體也沒什麼神秘的,它並不是一種網頁製作技術,用的也是普通 的網頁,但是裡面插入了播放器,流媒體用的協議卻不是http協議,而是rtsp協議,在Windows下它是用Server 2000/2003架設的,在Linux下不知是怎麼弄出來的.
還不錯,希望你採納。
③ html5怎麼播放流媒體視屏,比如rtsp協議的流媒體等
html5是網頁代碼的標准,跟視頻傳輸協議沒一分錢的關系。
html5支持的視頻格式是H.264,html5之前的網頁代碼是不支持視頻的。
網頁上能看到視頻是因為瀏覽器安裝了插件,比如flashplayer、Windows Media Player、RealPlayer、快播、網路影音等。
用什麼傳輸協議是看插件支持什麼協議。
④ 如何做到網路監控放在網頁上達到實時監控直播的效果。
目前大多數的監控攝像機視頻傳輸採用的是RTSP協議,僅限於本地區域網內傳輸,主要用於企事業單位內部監看管理,而要想實現互聯網直播:
一個是現場需具備互聯網網路條件;
二是視頻傳輸協議必須是RTMP或SRT等直播平台支持的傳輸協議;
三是您需要去開通一個直播地址;
MG300視頻網關,是一個嵌入式攜帶型硬體設備,將設備接入您的現場互聯網,即可將您前端攝像機的RTSP視頻流,實時轉換為RTMP/SRT直播流進行網路直播。與此同時,MG300具備了強悍的流媒體直播能力,可以同時接入9路以內的監控RTSP視頻流,同時推送到30+個不同的直播地址。
而且還可以將多個不同的監控RTSP視頻,合成一個直播畫面進行網路直播。現場無需任何工程改造,您只需購買一台網關設備,開通直播平台獲取RTMP/SRT直播地址,即可快速、便捷、低成本化構建屬於您自己的監控直播系統。
⑤ 請問手機網頁如何播放rtsp
這個網站完美的解決了你的問題,前提是你會寫代碼
發現自己太年輕so為了不把大家帶進坑,更新回答
web伺服器轉碼 hls、rtmp、flash(iOS不支持)
android本地解碼 各種sdk開發包
⑥ QT Web引擎支持rtsp流嗎
支持
qt客戶端實時播放rtsp音頻流demo並且無雜音
推流工具使用EasyDarwin
推流直接使用ffmpeg 推流到 EasyDarwin 伺服器,音頻流取自電腦拾音器,ffmepg指令為:
ffmpeg -f dshow -i audio=「麥克風 (Realtek® Audio)」 -codec:a aac -ac 2 -ar 16000 -f rtsp rtsp://10.1.3.170:554/3_a.sdp
至於怎麼推流自行網路呀
客戶端採用FFMPEG 取流,解析出PCM 音頻裸流,在一個線程中接收rtsp流並解析出音頻數據,具體代碼如下PlayVoicePlayer.c:
#include "playvoiceplayer.h"
#include <QDebug>
PlayVoicePlayer::PlayVoicePlayer(QObject *parent) : QThread(parent)
{
}
void PlayVoicePlayer::startPlay(QString url)
{
qDebug() << "Video2PCM::startPlay()";
playUrl = url;
unGetStream = true;
this->start();
}
void PlayVoicePlayer::run()
{
qDebug() << "Video2PCM::run():"<<playUrl;
isStart = true;
AVFormatContext *pFormatCtx = NULL;
AVCodecContext *pCodecCtx = NULL;
AVCodec *pCodec = NULL;
AVPacket packet;
AVFrame *pAudioFrame = NULL;
uint8_t *buffer = NULL;
struct SwrContext *audio_convert_ctx = NULL;
int got_picture;
int audioIndex;
int out_buffer_size;
av_register_all();
if (avformat_open_input(&pFormatCtx, playUrl.toStdString().data(), NULL, NULL) != 0)
{
emit getPcmStreamStop();
qDebug()<< " Video2PCM Couldn't open an input stream.";
return;
}
pFormatCtx->probesize = 5 *1024; //使用1000*1024 延時大概是2秒開始開始播放1920*1080使用這個參數暫時沒發新崩潰的情況
pFormatCtx->max_analyze_ration = 1 * AV_TIME_BASE;
if (avformat_find_stream_info(pFormatCtx, NULL) < 0)
{
emit getPcmStreamStop();
qDebug()<< "Video2PCM Couldn't find stream information.";
return;
}
audioIndex = -1;
for (int i = 0; i < pFormatCtx->nb_streams; i++)
{
if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
{
audioIndex = i;
break;
}
}
if (audioIndex == -1)
{
emit getPcmStreamStop();
qDebug()<< "Video2PCM Couldn't find a audio stream.";
return;
}
pCodecCtx = pFormatCtx->streams[audioIndex]->codec;
pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
if (pCodec == NULL) printf("Codec not found.\n");
if (avcodec_open2(pCodecCtx, pCodec, NULL) < 0)
{
emit getPcmStreamStop();
qDebug()<< "Video2PCM Could not open codec.";
return;
}
pAudioFrame = av_frame_alloc();
if (pAudioFrame == NULL)
{
emit getPcmStreamStop();
qDebug()<< "Video2PCM Could not alloc AVFrame";
return;
}
//音頻輸出參數
uint64_t out_channel_layout = AV_CH_LAYOUT_STEREO;//聲道格式
AVSampleFormat out_sample_fmt = AV_SAMPLE_FMT_S32;//采樣格式
int out_nb_samples = pCodecCtx->frame_size;//nb_samples: AAC-1024 MP3-1152
// int out_sample_rate = 44100;//采樣率
int out_sample_rate = 16000;//采樣率
int out_nb_channels = av_get_channel_layout_nb_channels(out_channel_layout);//根據聲道格式返回聲道個數
out_buffer_size = av_samples_get_buffer_size(NULL, out_nb_channels, out_nb_samples, out_sample_fmt, 1);
buffer = (uint8_t *)av_malloc(MAX_AUDIO_FRAME_SIZE);
audio_convert_ctx = swr_alloc();
if (audio_convert_ctx == NULL)
{
{
emit getPcmStreamStop();
qDebug()<< " Video2PCM Could not allocate SwrContext";
return;
}
}
swr_alloc_set_opts(audio_convert_ctx, out_channel_layout, out_sample_fmt,out_sample_rate,
pCodecCtx->channel_layout, pCodecCtx->sample_fmt, pCodecCtx->sample_rate, 0, NULL);
swr_init(audio_convert_ctx);
int index = 0;//計數器
while (isStart)
{
if(av_read_frame(pFormatCtx, &packet)<0)
{
emit getPcmStreamStop();
break;
}
if (packet.stream_index == audioIndex) {
if (avcodec_decode_audio4(pCodecCtx, pAudioFrame, &got_picture, &packet) < 0) {
qDebug() <<("Error in decoding audio frame.\n");
emit getPcmStreamStop();
break;
}
if (got_picture) {
// int dst_nb_samples = av_rescale_rnd(swr_get_delay(audio_convert_ctx, pAudioFrame->sample_rate) + pAudioFrame->nb_samples, pAudioFrame->sample_rate, pAudioFrame->sample_rate, AVRounding(1));
swr_convert(audio_convert_ctx, &buffer, MAX_AUDIO_FRAME_SIZE, (const uint8_t **)pAudioFrame->data, pAudioFrame->nb_samples);
if(unGetStream == true)
{
qDebug() << "Video2PCM unGetStream";
unGetStream =false;
emit getAudioStream();
}
// printf("index:%5d\t pts:%lld\t packet size:%d\n", index, packet.pts, packet.size);
//Write PCM
// fwrite(buffer, 1, out_buffer_size, fp_pcm);
emit decodePCM(packet.pts, QByteArray((char*)buffer, out_buffer_size));
index++;
}
}
av_free_packet(&packet);
}
qDebug() << "Video2PCM close1";
swr_free(&audio_convert_ctx);
av_free(buffer);
av_frame_free(&pAudioFrame);
avcodec_close(pCodecCtx);
avformat_close_input(&pFormatCtx);
isStart= false;
對應的PlayVoicePlayer.h文件如下:
#ifndef PLAYVOICEPLAYER_H
#define PLAYVOICEPLAYER_H
#include <QObject>
#include <QThread>
#ifdef _WINDOWS
extern "C"
{
#include "libavcodec\avcodec.h"
#include "libavformat\avformat.h"
#include "libswresample\swresample.h"
};
#else
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libswresample/swresample.h"
};
#endif
#include <QAudioFormat>
#include <QAudioOutput>
#define MAX_AUDIO_FRAME_SIZE 192000
class PlayVoicePlayer : public QThread
{
Q_OBJECT
public:
explicit PlayVoicePlayer(QObject *parent = nullptr);
void startPlay(QString url);
private:
bool isStart = true;
QString playUrl;
bool unGetStream;
signals:
void getPcmStreamStop();
void getAudioStream();
void decodePCM(qint64 pts, const QByteArray& pcm);
protected:
void run();
};
#endif // PLAYVOICEPLAYER_H
⑦ 如何獲取網路攝像頭(監控攝像頭)的rtsp的地址流
找廠家要搜索軟體,不同藏家都會有自己的搜索軟體,確實木有的話下一個wireshark,只把攝像機連在電腦上驚醒抓包能看到來源ip
問題理解有偏差,同樣的你可以再上面我說的額軟體中看到rtsp協議的埠,截取。
⑧ 監控中系統中,用web訪問前端網路攝像機,觀看實時視頻流,這一過程時候可以這樣理解
網路攝像機是把高品質的數字視頻攝像機和強大的網路伺服器結合在一起,把來自本地網路或者互聯網的圖像清晰地展示到您的桌面。是一種結合監控攝像機與網路技術所產生的新一代攝像機,只要將機器插在網線上(無需電腦)或通過無線,它即可將影像透過網路傳至地球另一端
⑨ 如何實現監控視頻實時網路直播
目前大多數的監控攝像機視頻傳輸採用的是RTSP協議,僅限於本地區域網內傳輸,主要用於企事業單位內部監看管理,而要想實現互聯網直播:
一個是現場需具備互聯網網路條件;
二是視頻傳輸協議必須是RTMP或SRT等直播平台支持的傳輸協議;
三是您需要去開通一個直播地址;
MG300視頻網關,是一個嵌入式攜帶型硬體設備,將設備接入您的現場互聯網,即可將您前端攝像機的RTSP視頻流,實時轉換為RTMP/SRT直播流進行網路直播。與此同時,MG300具備了強悍的流媒體直播能力,可以同時接入9路以內的監控RTSP視頻流,同時推送到30+個不同的直播地址。
而且還可以將多個不同的監控RTSP視頻,合成一個直播畫面進行網路直播。現場無需任何工程改造,您只需購買一台網關設備,開通直播平台獲取RTMP/SRT直播地址,即可快速、便捷、低成本化構建屬於您自己的監控直播系統。
⑩ 如何在web瀏覽器上實時監控攝像頭
攝像機要用網路攝像機,用交換機把攝像機與電腦聯在一起。把電腦ip地址改為攝像機上的同一網段中。打開ie瀏覽器,輸入攝像機ip地址,回車,按提示要安裝插件。後回車,輸入攝像機上的用戶名,密碼,回車,就可以看到實時監控畫面了。