Opened 17 months ago

Last modified 17 months ago

#8683 new defect

publish srt stream with special streamid

Reported by: xiaozhihong Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords: libsrt
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

My FFmpeg version and built message:
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers

built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609
configuration: --prefix=/root/git/xiaozhihong/shell/ff/FFmpeg/build --pkg-config-flags=--static --extra-cflags=-I/root/git/xiaozhihong/shell/ff/FFmpeg/build/include --extra-ldflags=-L/root/git/xiaozhihong/shell/ff/FFmpeg/build/lib --extra-libs='-lpthread -lm' --bindir=/root/git/xiaozhihong/shell/ff/FFmpeg/build/bin --enable-static --enable-libsrt --disable-libxcb --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-libxcb-shape --disable-vdpau --disable-libass --enable-gpl --enable-libfdk-aac --enable-libopus --enable-libx264 --enable-nonfree

=================================================
My FFmpeg command line:
ffmpeg -re -stream_loop -1 -i input.flv -c copy -f flv "srt://localhost:9000?streamid=test_stream?key1=value1&key2=value2"

My problem:
I have a sepcial streamid like "test_stream?key1=value1&key2=value2", when I publish stream with SRT by using this special streamid, ffmpeg will truncate it to "test_stream?key1=value1", I lost "&key2=value2"

I see the source code in libavformat/libsrt.c, FFmpeg will try to find the special argement in srt url.
Can I use "srt://localhost:9000?streamid="test_stream?key1=value1&key2=value2"" instead of "srt://localhost:9000?streamid=test_stream?key1=value1&key2=value2" or any other solution?

Thanks.

Change History (2)

comment:1 by Carl Eugen Hoyos, 17 months ago

Keywords: libsrt added; SRT removed
Version: 4.2unspecified

If you want to report a bug, please test current FFmpeg git head and provide the command line together with the complete, uncut console output to make this a valid ticket.

in reply to:  1 comment:2 by xiaozhihong, 17 months ago

Replying to cehoyos:

If you want to report a bug, please test current FFmpeg git head and provide the command line together with the complete, uncut console output to make this a valid ticket.

I had test the curent FFmpeg git head version, it have the same problem.
Console output:

./ffmpeg -re -stream_loop -1 -i input.flv -c copy -f mpegts "srt://localhost:9000?streamid=test_stream?key1=value1&key2=value2"
ffmpeg version N-97960-g7ae3401 Copyright (c) 2000-2020 the FFmpeg developers

built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609
configuration: --prefix=/root/git/xiaozhihong/shell/ff_master/FFmpeg/build --pkg-config-flags=--static --extra-cflags=-I/root/git/xiaozhihong/shell/ff_master/FFmpeg/build/include --extra-ldflags=-L/root/git/xiaozhihong/shell/ff_master/FFmpeg/build/lib --extra-libs='-lpthread -lm' --bindir=/root/git/xiaozhihong/shell/ff_master/FFmpeg/build/bin --enable-static --enable-libsrt --disable-libxcb --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-libxcb-shape --disable-vdpau --disable-libass --enable-gpl --enable-libfdk-aac --enable-libx264 --enable-nonfree
libavutil 56. 49.100 / 56. 49.100
libavcodec 58. 87.101 / 58. 87.101
libavformat 58. 43.100 / 58. 43.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 83.100 / 7. 83.100
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100

Input #0, flv, from 'input.flv':

Metadata:

encoder : Lavf58.29.100

Duration: 00:00:05.00, start: 0.000000, bitrate: 208 kb/s

Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 1000 kb/s, 30 fps, 30 tbr, 1k tbn, 60 tbc
Stream #0:1: Audio: adpcm_swf, 44100 Hz, mono, s16, 176 kb/s

streamid=test_stream?key1=value1
Output #0, mpegts, to 'srt://localhost:9000?streamid=test_stream?key1=value1&key2=value2':

Metadata:

encoder : Lavf58.43.100
Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 30 fps, 30 tbr, 90k tbn, 1k tbc
Stream #0:1: Audio: adpcm_swf, 44100 Hz, mono, s16, 176 kb/s

Stream mapping:

Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)

Press [q] to stop, ? for help
[mpegts @ 0x3ced740] Stream 1, codec adpcm_swf, is muxed as a private data stream and may not be recognized upon reading.
frame= 87 fps= 30 q=-1.0 Lsize= 111kB time=00:00:02.87 bitrate= 314.5kbits/s speed=0.998x
video:16kB audio:63kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 38.747089%
Exiting normally, received signal 2.

I add one line code to log my streamid, diff below

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -591,6 +591,7 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)

ret = AVERROR(ENOMEM);
goto err;

}

+ av_log(NULL, AV_LOG_ERROR, "streamid=%s\n", s->streamid);

}
if (av_find_info_tag(buf, sizeof(buf), "smoother", p)) {

av_freep(&s->smoother);

Last edited 17 months ago by xiaozhihong (previous) (diff)
Note: See TracTickets for help on using tickets.