diff options
author | Aman Karmani <aman@tmm1.net> | 2020-12-21 15:53:55 -0800 |
---|---|---|
committer | Aman Karmani <aman@tmm1.net> | 2020-12-28 14:08:44 -0800 |
commit | d20f059fb964436bac58f3ab3d0db2bd5185d316 (patch) | |
tree | b0843934b9d08e04eedb0543d20841a6e687adfb /libavformat/rtsp.c | |
parent | 98b76bb11f3d2bfb0f12373e9930c11ee48e8940 (diff) | |
download | ffmpeg-d20f059fb964436bac58f3ab3d0db2bd5185d316.tar.gz |
avformat/rtsp: add satip_raw flag to receive raw mpegts stream
This can be used to receive the raw mpegts stream from a SAT>IP
server, by letting avformat handle the RTSP/RTP/UDP negotiation
and setup, but then simply passing the MP2T stream through
instead of demuxing it further.
For example, this command would demux/remux the mpegts stream:
SATIP_URL='satip://192.168.1.99:554/?src=1&freq=12188&pol=h&ro=0.35&msys=dvbs&mtype=qpsk&plts=off&sr=27500&fec=34&pids=0,17,18,167,136,47,71'
ffmpeg -i $SATIP_URL -map 0 -c copy -f mpegts -y remux.ts
Whereas this command will simply write out the raw stream, with
the original PAT/PMT/PIDs intact:
ffmpeg -rtsp_flags satip_raw -i $SATIP_URL -map 0 -c copy -f data -y raw.ts
Signed-off-by: Aman Karmani <aman@tmm1.net>
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r-- | libavformat/rtsp.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 1f506129eb..d1f5762f7c 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -89,6 +89,7 @@ const AVOption ff_rtsp_options[] = { RTSP_FLAG_OPTS("rtsp_flags", "set RTSP flags"), { "listen", "wait for incoming connections", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_LISTEN}, 0, 0, DEC, "rtsp_flags" }, { "prefer_tcp", "try RTP via TCP first, if available", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_PREFER_TCP}, 0, 0, DEC|ENC, "rtsp_flags" }, + { "satip_raw", "export raw MPEG-TS stream instead of demuxing", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_SATIP_RAW}, 0, 0, DEC, "rtsp_flags" }, RTSP_MEDIATYPE_OPTS("allowed_media_types", "set media types to accept from the server"), { "min_port", "set minimum local UDP port", OFFSET(rtp_port_min), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MIN}, 0, 65535, DEC|ENC }, { "max_port", "set maximum local UDP port", OFFSET(rtp_port_max), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MAX}, 0, 65535, DEC|ENC }, @@ -265,9 +266,19 @@ static int init_satip_stream(AVFormatContext *s) av_strlcpy(rtsp_st->control_url, rt->control_uri, sizeof(rtsp_st->control_url)); - rtsp_st->stream_index = -1; - init_rtp_handler(&ff_mpegts_dynamic_handler, rtsp_st, NULL); - finalize_rtp_handler_init(s, rtsp_st, NULL); + if (rt->rtsp_flags & RTSP_FLAG_SATIP_RAW) { + AVStream *st = avformat_new_stream(s, NULL); + if (!st) + return AVERROR(ENOMEM); + st->id = rt->nb_rtsp_streams - 1; + rtsp_st->stream_index = st->index; + st->codecpar->codec_type = AVMEDIA_TYPE_DATA; + st->codecpar->codec_id = AV_CODEC_ID_MPEG2TS; + } else { + rtsp_st->stream_index = -1; + init_rtp_handler(&ff_mpegts_dynamic_handler, rtsp_st, NULL); + finalize_rtp_handler_init(s, rtsp_st, NULL); + } return 0; } |