溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

FFmpeg RTSP HEVC碼流探測(cè)剖析

發(fā)布時(shí)間:2020-05-16 08:57:12 來源:網(wǎng)絡(luò) 閱讀:1975 作者:fengyuzaitu 欄目:編程語言

例如:"rtsp://admin:admin12345@192.168.28.136:554/h365/ch2/main/av_stream"

請(qǐng)求海康攝像機(jī)H265碼流

SDP報(bào)文如下:
v=0
o=- 1566124110963848 1566124110963848 IN IP4 192.168.28.136
s=Media Presentation
e=NONE
b=AS:5100
t=0 0
a=control:rtsp://192.168.28.136:554/h365/ch2/main/av_stream/
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:5000
a=recvonly
a=x-dimensions:1920,1080
a=control:rtsp://192.168.28.136:554/h365/ch2/main/av_stream/trackID=1
a=rtpmap:96 H265/90000
a=fmtp:96 sprop-sps=QgEBAWAAAAMAsAAAAwAAAwB7oAPAgBDlja5JMvTcBAQEAg==; sprop-pps=RAHA8vA8kAA=
m=audio 0 RTP/AVP 8
c=IN IP4 0.0.0.0
b=AS:50
a=recvonly
a=control:rtsp://192.168.28.136:554/h365/ch2/main/av_stream/trackID=2
a=rtpmap:8 PCMA/8000
a=Media_header:MEDIAINFO=494D4B48010200000400050011710110401F000000FA000000000000000000000000000000000000;
a=appversion:1.0


static int sdp_parse_rtpmap(AVFormatContext *s,
??????????????????????????? AVStream *st, RTSPStream *rtsp_st,
??????????????????????????? int payload_type, const char *p)

通過sdp_parse_rtpmap函數(shù)分析SDP中的a=rtpmap:96 H265/90000
在調(diào)用函數(shù)??????? const RTPDynamicProtocolHandler *handler =
??????????? ff_rtp_handler_find_by_name(buf, par->codec_type);中 獲取到h365的處理句柄


rtsp 分包NALU

?????? if (codec_id == AV_CODEC_ID_HEVC)
??????????? ret = hevc_parse_nal_header(nal, logctx);
??????? else
??????????? ret = h364_parse_nal_header(nal, logctx);


static void parse_fmtp(AVFormatContext *s, RTSPState *rt,
?????????????????????? int payload_type, const char *line)
通過h365的句柄調(diào)用
static av_cold int hevc_parse_sdp_line(AVFormatContext *ctx, int st_index,
?????????????????????????????????????? PayloadContext *hevc_data, const char *line)
該函數(shù)將SPS/PPS的內(nèi)容保存在(AVFormatContext結(jié)構(gòu)體中的AVStream流中的extradata變量


創(chuàng)建視頻流和音頻流
update_stream_avctx函數(shù)只是將avcodec_parameters_to_context(st->internal->avctx, st->codecpar);
并沒有做其他的操作


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI