Opened 6 years ago

Last modified 3 weeks ago

#3702 new defect

RTSP Streaming fails with "Could not write header for output file"

Reported by: DJX Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: rtsp
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

FFmpeg will not re-restream an RTP stream to RTSP.
It hangs and must be terminated with Ctrl+C.
After issuing a Ctrl+C, it displays the error: Could not write header for output file #0 (incorrect codec parameters ?): Error number -5 occurred

How to reproduce:

ffmpeg -re -i rtp://239.255.1.1:59002 -f rtsp -c copy rtsp://localhost:554/live
ffmpeg version N-63746-gfbaf73a Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  3 2014 22:10:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libope
njpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsox
r --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab -
-enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-
libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 89.100 / 52. 89.100
  libavcodec     55. 66.100 / 55. 66.100
  libavformat    55. 42.100 / 55. 42.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
[mpeg2video @ 0000000002abc300] Invalid frame dimensions 0x0.
    Last message repeated 4 times
[rtp @ 0000000002b006e0] Could not find codec parameters for stream 3 (Unknown:
none ([134][0][0][0] / 0x0086)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtp, from 'rtp://239.255.1.1:59002':
  Duration: N/A, start: 24023.945356, bitrate: 320 kb/s
  Program 10
    Stream #0:2: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv),
704x480 [SAR 10:11 DAR 4:3], max. 5000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.9
4 tbc
    Stream #0:0(eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fl
tp, 192 kb/s
    Stream #0:1(spa): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fl
tp, 128 kb/s
    Stream #0:3: Unknown: none ([134][0][0][0] / 0x0086)
Output #0, rtsp, to 'rtsp://localhost:554/live':
  Metadata:
    encoder         : Lavf55.42.100
    Stream #0:0: Video: mpeg2video ([2][0][0][0] / 0x0002), yuv420p, 704x480 [SA
R 10:11 DAR 4:3], q=2-31, max. 5000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
    Stream #0:1(eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, 19
2 kb/s
Stream mapping:
  Stream #0:2 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Error
number -5 occurred
Received signal 2: terminating.

Change History (25)

comment:1 Changed 6 years ago by cehoyos

How can I reproduce this issue?

comment:2 Changed 6 years ago by DJX

Good question.
The source RTP stream is from a SiliconDust? HDHomeRun that is streaming a US TV channel.
I am unable to provide public access to this stream at this time.
I guess it would require a developer to have the equipment.

comment:3 Changed 6 years ago by cehoyos

Does reading from the rtp source work?

comment:4 Changed 6 years ago by DJX

Yes.
FFplay can display the RTP source stream.

ffplay rtp://239.255.1.1:59002
ffplay version N-63746-gfbaf73a Copyright (c) 2003-2014 the FFmpeg developers
  built on Jun  3 2014 22:10:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libope
njpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsox
r --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab -
-enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-
libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 89.100 / 52. 89.100
  libavcodec     55. 66.100 / 55. 66.100
  libavformat    55. 42.100 / 55. 42.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
[mpeg2video @ 00000000003069c0] Invalid frame dimensions 0x0.=0/0
    Last message repeated 4 times
[mpeg2video @ 00000000003069c0] Invalid frame dimensions 0x0.=0/0
[mpeg2video @ 00000000003069c0] Invalid frame dimensions 0x0.=0/0
[mpeg2video @ 00000000003069c0] Invalid frame dimensions 0x0.=0/0
[mpeg2video @ 00000000003069c0] Invalid frame dimensions 0x0.=0/0
[rtp @ 0000000000303060] Could not find codec parameters for stream 3 (Unknown:
none ([134][0][0][0] / 0x0086)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtp, from 'rtp://239.255.1.1:59002':
  Duration: N/A, start: 25246.133467, bitrate: 384 kb/s
  Program 10
    Stream #0:1: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv),
720x480 [SAR 8:9 DAR 4:3], max. 3080 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94
tbc
    Stream #0:2(eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fl
tp, 192 kb/s
    Stream #0:0(spa): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fl
tp, 192 kb/s
    Stream #0:3: Unknown: none ([134][0][0][0] / 0x0086)
[ac3 @ 0000000000305ac0] frame sync error
RTP: missed 54 packetsd=   0 aq=  144KB vq= 1088KB sq=    0B f=0/0
[rtp @ 0000000000303060] PES packet size mismatch
    Last message repeated 1 times
[ac3 @ 0000000000305ac0] frame sync errorq= 1946KB sq=    0B f=0/0
[mpeg2video @ 00000000003069c0] 00 motion_type at 24 13   0B f=0/0
[mpeg2video @ 00000000003069c0] ac-tex damaged at 10 20
[mpeg2video @ 00000000003069c0] 00 motion_type at 3 16
[mpeg2video @ 00000000003069c0] 00 motion_type at 30 22
[mpeg2video @ 00000000003069c0] ac-tex damaged at 21 18
[mpeg2video @ 00000000003069c0] slice mismatch
    Last message repeated 1 times
[mpeg2video @ 00000000003069c0] 00 motion_type at 38 24
[mpeg2video @ 00000000003069c0] invalid cbp 0 at 18 19
[mpeg2video @ 00000000003069c0] 00 motion_type at 3 25
[mpeg2video @ 00000000003069c0] 00 motion_type at 20 26
[mpeg2video @ 00000000003069c0] ac-tex damaged at 16 27
[mpeg2video @ 00000000003069c0] mb incr damaged
    Last message repeated 1 times
[mpeg2video @ 00000000003069c0] Warning MVs not available
[mpeg2video @ 00000000003069c0] concealing 720 DC, 720 AC, 720 MV errors in P fr
ame
[ac3 @ 0000000000305ac0] frame sync errorq= 2074KB sq=    0B f=0/1
25279.39 A-V:  0.030 fd=   3 aq=  150KB vq= 1994KB sq=    0B f=0/1
Last edited 6 years ago by DJX (previous) (diff)

comment:5 Changed 6 years ago by cehoyos

Does stream copy to a file work?

comment:6 Changed 6 years ago by DJX

For the most part, yes.
It gets messed up when the audio stream changes during commercials.
Besides that, it seems to write OK.

ffmpeg -i rtp://239.255.1.1:59002 -c copy c:\temp\test.m2ts
ffmpeg version N-63746-gfbaf73a Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  3 2014 22:10:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libope
njpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsox
r --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab -
-enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-
libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 89.100 / 52. 89.100
  libavcodec     55. 66.100 / 55. 66.100
  libavformat    55. 42.100 / 55. 42.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
[mpeg2video @ 0000000002bbc160] Invalid frame dimensions 0x0.
    Last message repeated 13 times
[rtp @ 0000000002ab0420] Could not find codec parameters for stream 3 (Unknown:
none ([134][0][0][0] / 0x0086)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtp, from 'rtp://239.255.1.1:59002':
  Duration: N/A, start: 30332.765733, bitrate: 320 kb/s
  Program 10
    Stream #0:2: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv),
704x480 [SAR 10:11 DAR 4:3], max. 5000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.9
4 tbc
    Stream #0:0(eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fl
tp, 192 kb/s
    Stream #0:1(spa): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fl
tp, 128 kb/s
    Stream #0:3: Unknown: none ([134][0][0][0] / 0x0086)
Output #0, mpegts, to 'c:\temp\test.m2ts':
  Metadata:
    encoder         : Lavf55.42.100
    Stream #0:0: Video: mpeg2video ([2][0][0][0] / 0x0002), yuv420p, 704x480 [SA
R 10:11 DAR 4:3], q=2-31, max. 5000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
    Stream #0:1(eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, 19
2 kb/s
Stream mapping:
  Stream #0:2 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  153 fps=0.0 q=-1.0 size=     857kB time=00:00:06.46 bitrate=1085.7kbits/
frame=  168 fps=161 q=-1.0 size=     933kB time=00:00:06.96 bitrate=1097.7kbits/
frame=  182 fps=117 q=-1.0 size=    1019kB time=00:00:07.43 bitrate=1122.9kbits/
frame=  198 fps= 95 q=-1.0 size=    1219kB time=00:00:07.96 bitrate=1253.6kbits/
frame=  214 fps= 83 q=-1.0 size=    1325kB time=00:00:08.49 bitrate=1277.2kbits/
frame=  229 fps= 74 q=-1.0 size=    1430kB time=00:00:08.99 bitrate=1301.7kbits/
frame=  247 fps= 68 q=-1.0 size=    1542kB time=00:00:09.60 bitrate=1315.6kbits/
frame=  262 fps= 63 q=-1.0 size=    1646kB time=00:00:10.10 bitrate=1334.7kbits/
frame=  277 fps= 59 q=-1.0 size=    1761kB time=00:00:10.60 bitrate=1360.9kbits/
frame=  293 fps= 57 q=-1.0 size=    1870kB time=00:00:11.13 bitrate=1375.5kbits/
frame=  309 fps= 54 q=-1.0 size=    1975kB time=00:00:11.66 bitrate=1386.2kbits/
frame=  324 fps= 52 q=-1.0 size=    2073kB time=00:00:12.16 bitrate=1395.2kbits/
frame=  340 fps= 50 q=-1.0 size=    2180kB time=00:00:12.70 bitrate=1406.0kbits/
frame=  356 fps= 49 q=-1.0 size=    2294kB time=00:00:13.23 bitrate=1419.6kbits/
frame=  371 fps= 48 q=-1.0 size=    2396kB time=00:00:13.73 bitrate=1428.9kbits/
frame=  387 fps= 47 q=-1.0 size=    2498kB time=00:00:14.27 bitrate=1433.7kbits/
frame=  402 fps= 45 q=-1.0 size=    2605kB time=00:00:14.77 bitrate=1444.4kbits/
frame=  418 fps= 45 q=-1.0 size=    2706kB time=00:00:15.30 bitrate=1448.3kbits/
frame=  434 fps= 44 q=-1.0 size=    2860kB time=00:00:15.83 bitrate=1479.3kbits/
frame=  450 fps= 43 q=-1.0 size=    2956kB time=00:00:16.37 bitrate=1478.8kbits/
frame=  465 fps= 43 q=-1.0 size=    3057kB time=00:00:16.87 bitrate=1484.3kbits/
frame=  481 fps= 42 q=-1.0 size=    3154kB time=00:00:17.40 bitrate=1484.5kbits/
frame=  498 fps= 42 q=-1.0 size=    3256kB time=00:00:17.97 bitrate=1484.1kbits/
frame=  513 fps= 41 q=-1.0 size=    3364kB time=00:00:18.47 bitrate=1491.5kbits/
frame=  528 fps= 40 q=-1.0 size=    3452kB time=00:00:18.97 bitrate=1490.4kbits/
frame=  544 fps= 40 q=-1.0 size=    3535kB time=00:00:19.51 bitrate=1484.3kbits/
frame=  559 fps= 40 q=-1.0 size=    3637kB time=00:00:20.01 bitrate=1489.0kbits/
frame=  575 fps= 39 q=-1.0 size=    3737kB time=00:00:20.54 bitrate=1490.2kbits/
frame=  589 fps= 39 q=-1.0 size=    3833kB time=00:00:21.01 bitrate=1494.3kbits/
frame=  607 fps= 39 q=-1.0 size=    3942kB time=00:00:21.61 bitrate=1494.3kbits/
frame=  621 fps= 38 q=-1.0 size=    4033kB time=00:00:22.07 bitrate=1496.2kbits/
frame=  629 fps= 38 q=-1.0 size=    4186kB time=00:00:22.34 bitrate=1534.6kbits/
frame=  641 fps= 37 q=-1.0 size=    4350kB time=00:00:22.74 bitrate=1566.7kbits/
frame=  661 fps= 37 q=-1.0 size=    4558kB time=00:00:23.41 bitrate=1594.6kbits/
frame=  681 fps= 37 q=-1.0 size=    4732kB time=00:00:24.08 bitrate=1609.8kbits/
frame=  699 fps= 37 q=-1.0 size=    4862kB time=00:00:24.68 bitrate=1613.8kbits/
frame=  714 fps= 37 q=-1.0 size=    5000kB time=00:00:25.18 bitrate=1626.5kbits/
frame=  729 fps= 37 q=-1.0 size=    5126kB time=00:00:25.68 bitrate=1635.2kbits/
frame=  740 fps= 37 q=-1.0 Lsize=    5395kB time=00:00:26.05 bitrate=1696.4kbits
/s
video:4193kB audio:593kB subtitle:0kB other streams:0kB global headers:0kB muxin
g overhead: 12.719521%
Received signal 2: terminating.

comment:7 Changed 6 years ago by cehoyos

What happens if you try to send the recorded stream via rtsp (either reencoding the stream or with -codec copy)?

comment:8 Changed 6 years ago by DJX

Does not work either way.

Copy:

ffmpeg -re -i C:\Temp\test.m2ts -f rtsp -c copy rtsp://localhost:554/live
ffmpeg version N-63746-gfbaf73a Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  3 2014 22:10:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libope
njpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsox
r --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab -
-enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-
libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 89.100 / 52. 89.100
  libavcodec     55. 66.100 / 55. 66.100
  libavformat    55. 42.100 / 55. 42.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from 'C:\Temp\test.m2ts':
  Duration: 00:00:27.77, start: 1.400000, bitrate: 2889 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420
p(tv), 704x480 [SAR 10:11 DAR 4:3], max. 5000 kb/s, 29.97 fps, 29.97 tbr, 90k tb
n, 59.94 tbc
    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, ste
reo, fltp, 192 kb/s
Output #0, rtsp, to 'rtsp://localhost:554/live':
  Metadata:
    encoder         : Lavf55.42.100
    Stream #0:0: Video: mpeg2video ([2][0][0][0] / 0x0002), yuv420p, 704x480 [SA
R 10:11 DAR 4:3], q=2-31, max. 5000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
    Stream #0:1(eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, 19
2 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Error
number -5 occurred
Received signal 2: terminating.

Transcode:

ffmpeg -re -i C:\Temp\test.m2ts -f rtsp rtsp://localhost:554/live
ffmpeg version N-63746-gfbaf73a Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  3 2014 22:10:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libope
njpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsox
r --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab -
-enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-
libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 89.100 / 52. 89.100
  libavcodec     55. 66.100 / 55. 66.100
  libavformat    55. 42.100 / 55. 42.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from 'C:\Temp\test.m2ts':
  Duration: 00:00:27.77, start: 1.400000, bitrate: 2889 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420
p(tv), 704x480 [SAR 10:11 DAR 4:3], max. 5000 kb/s, 29.97 fps, 29.97 tbr, 90k tb
n, 59.94 tbc
    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, ste
reo, fltp, 192 kb/s
Output #0, rtsp, to 'rtsp://localhost:554/live':
  Metadata:
    encoder         : Lavf55.42.100
    Stream #0:0: Video: mpeg4, yuv420p, 704x480 [SAR 10:11 DAR 4:3], q=2-31, 200
 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc55.66.100 mpeg4
    Stream #0:1(eng): Audio: aac (libvo_aacenc), 48000 Hz, stereo, s16, 128 kb/s

    Metadata:
      encoder         : Lavc55.66.100 libvo_aacenc
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> mpeg4)
  Stream #0:1 -> #0:1 (ac3 -> libvo_aacenc)
Could not write header for output file #0 (incorrect codec parameters ?): Error
number -5 occurred
Received signal 2: terminating.

comment:9 Changed 6 years ago by cehoyos

What about the following two command lines?

$ ffmpeg -f lavfi -i testsrc -f rtsp rtsp://localhost:554/live
$ ffmpeg -f lavfi -i sine -f rtsp rtsp://localhost:554/live

comment:10 Changed 6 years ago by DJX

Ah, I see what you're getting at...
Negative on both, looks like RTSP doesn't work at all.

testsrc:

ffmpeg -f lavfi -i testsrc-f rtsp rtsp://localhost:554/live
ffmpeg version N-63746-gfbaf73a Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  3 2014 22:10:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libope
njpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsox
r --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab -
-enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-
libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 89.100 / 52. 89.100
  libavcodec     55. 66.100 / 55. 66.100
  libavformat    55. 42.100 / 55. 42.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1
 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Output #0, rtsp, to 'rtsp://localhost:554/live':
  Metadata:
    encoder         : Lavf55.42.100
    Stream #0:0: Video: mpeg4, yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 k
b/s, 25 fps, 90k tbn, 25 tbc
    Metadata:
      encoder         : Lavc55.66.100 mpeg4
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> mpeg4)
Could not write header for output file #0 (incorrect codec parameters ?): Error
number -5 occurred
Received signal 2: terminating.

sine:

ffmpeg -f lavfi -i sine -frtsp rtsp://localhost:554/live
ffmpeg version N-63746-gfbaf73a Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  3 2014 22:10:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libope
njpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsox
r --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab -
-enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-
libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 89.100 / 52. 89.100
  libavcodec     55. 66.100 / 55. 66.100
  libavformat    55. 42.100 / 55. 42.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'sine':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Output #0, rtsp, to 'rtsp://localhost:554/live':
  Metadata:
    encoder         : Lavf55.42.100
    Stream #0:0: Audio: aac (libvo_aacenc), 44100 Hz, mono, s16, 128 kb/s
    Metadata:
      encoder         : Lavc55.66.100 libvo_aacenc
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> libvo_aacenc)
Could not write header for output file #0 (incorrect codec parameters ?): Error
number -5 occurred
Received signal 2: terminating.

comment:11 Changed 6 years ago by cehoyos

  • Keywords rtsp added

comment:12 Changed 6 years ago by DJX

Just checking in since this ticket is coming up on about 1 year old.
Same behavior is seen on latest git head.

ffmpeg -f lavfi -i testsrc -f rtsp rtsp://localhost:8554/live
ffmpeg version N-72276-gf99fed7 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
 --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
ble-decklink --enable-zlib
  libavutil      54. 23.101 / 54. 23.101
  libavcodec     56. 39.101 / 56. 39.101
  libavformat    56. 33.101 / 56. 33.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1
 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Output #0, rtsp, to 'rtsp://localhost:8554/live':
  Metadata:
    encoder         : Lavf56.33.101
    Stream #0:0: Video: mpeg4, yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 k
b/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.39.101 mpeg4
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Could not write header for output file #0 (incorrect codec parameters ?): Immedi
ate exit requested
Received signal 2: terminating.

comment:13 Changed 4 years ago by DJX

RTSP Streaming still doesn't work.

ffmpeg -f lavfi -i testsrc -f rtsp rtsp://localhost:8554/live
ffmpeg version N-80522-ge0faad8 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --ena
ble-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-
libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enab
le-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-li
bopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora
 --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --en
able-decklink --enable-zlib
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 46.100 / 57. 46.100
  libavformat    57. 38.102 / 57. 38.102
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.102 /  6. 46.102
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
[rtsp @ 000000000053ea60] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar i
nstead.
Output #0, rtsp, to 'rtsp://localhost:8554/live':
  Metadata:
    encoder         : Lavf57.38.102
    Stream #0:0: Video: mpeg4, yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.46.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Could not write header for output file #0 (incorrect codec parameters ?): Immediate exit requested
Exiting normally, received signal 2.

comment:14 Changed 4 years ago by DJX

  • Summary changed from Re-stream RTP to RTSP to RTSP Streaming fails with "Could not write header for output file"

comment:15 Changed 3 years ago by DJX

Still failing:

ffmpeg -f lavfi -i testsrc -f rtsp rtsp://localhost:554/live

ffmpeg version N-87871-g7480f232d2 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
  libavutil      55. 79.100 / 55. 79.100
  libavcodec     57.108.100 / 57.108.100
  libavformat    57. 84.100 / 57. 84.100
  libavdevice    57. 11.100 / 57. 11.100
  libavfilter     6.108.100 /  6.108.100
  libswscale      4.  9.100 /  4.  9.100
  libswresample   2. 10.100 /  2. 10.100
  libpostproc    54.  8.100 / 54.  8.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Could not write header for output file #0 (incorrect codec parameters ?): Immediate exit requested
Error initializing output stream 0:0 --
Exiting normally, received signal 2.

comment:16 Changed 3 years ago by DJX

ffmpeg -f lavfi -i testsrc -f rtsp rtsp://localhost:554/live
ffmpeg version N-91146-gfe84f70819 Copyright (c) 2000-2018 the FFmpeg developers

built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 19.102 / 58. 19.102
libavformat 58. 16.100 / 58. 16.100
libavdevice 58. 4.100 / 58. 4.100
libavfilter 7. 24.100 / 7. 24.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100

Input #0, lavfi, from 'testsrc':

Duration: N/A, start: 0.000000, bitrate: N/A

Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc

Stream mapping:

Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))

Press [q] to stop, ? for help
Could not write header for output file #0 (incorrect codec parameters ?): Immediate exit requested
Error initializing output stream 0:0 --
Exiting normally, received signal 2.

comment:17 Changed 18 months ago by DJX

Yearly check-in ;-)

ffmpeg -f lavfi -i testsrc -f rtsp rtsp://localhost:554/live
ffmpeg version N-93994-gd81913e680 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 28.100 / 56. 28.100
  libavcodec     58. 52.102 / 58. 52.102
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 55.100 /  7. 55.100
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Could not write header for output file #0 (incorrect codec parameters ?): Immediate exit requested
Error initializing output stream 0:0 --
Exiting normally, received signal 2.

comment:18 Changed 6 weeks ago by DJX

ffmpeg -f lavfi -i testsrc -f rtsp rtsp://localhost:554/live
ffmpeg version 2020-10-11-git-7ea4bcff7b-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      56. 60.100 / 56. 60.100
  libavcodec     58.111.100 / 58.111.100
  libavformat    58. 62.100 / 58. 62.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Could not write header for output file #0 (incorrect codec parameters ?): Immediate exit requested
Error initializing output stream 0:0 --
Exiting normally, received signal 2.

comment:19 Changed 4 weeks ago by taliho

what rtsp server are you using? I cannot reproduce locally. The following works fine for me:

ffplay -loglevel trace -rtsp_flags listen -timeout 10 -i rtsp://127.0.0.1:12345/live.sdp

ffmpeg -f lavfi -i sine -f rtsp rtsp://127.0.0.1:12345/live.sdp

comment:20 Changed 3 weeks ago by DJX

Testing with your commands:

FFmpeg:

ffmpeg -f lavfi -i sine -f rtsp rtsp://127.0.0.1:12345/live.sdp
ffmpeg version 2020-11-04-git-cfdddec0c8-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      56. 60.100 / 56. 60.100
  libavcodec     58.112.101 / 58.112.101
  libavformat    58. 64.100 / 58. 64.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 88.102 /  7. 88.102
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, lavfi, from 'sine':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help

FFplay:

ffplay -loglevel trace -rtsp_flags listen -timeout 10 -i rtsp://127.0.0.1:12345/live.sdp
ffplay version 2020-11-04-git-cfdddec0c8-full_build-www.gyan.dev Copyright (c) 2003-2020 the FFmpeg developers
  built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      56. 60.100 / 56. 60.100
  libavcodec     58.112.101 / 58.112.101
  libavformat    58. 64.100 / 58. 64.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 88.102 /  7. 88.102
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Initialized direct3d renderer.
Probing rtsp score:100 size:0q=    0KB vq=    0KB sq=    0B f=0/0
[tcp @ 0000014fa8da4440] No default whitelist set
[rtsp @ 0000014fa8dac200] Unable to open RTSP for listening f=0/0
rtsp://127.0.0.1:12345/live.sdp: Unknown error
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0

If I hit Ctrl+C twice on the FFmpeg instance I get the following:

Could not write header for output file #0 (incorrect codec parameters ?): Immediate exit requested
Error initializing output stream 0:0 --
[aac @ 0000024393e1a440] Qavg: nan
Exiting normally, received signal 2.

comment:21 Changed 3 weeks ago by taliho

It works for me on Linux. You are starting the ffplay side first, right?

I will try to test on windows to see if I can reproduce.

comment:22 Changed 3 weeks ago by DJX

I thought you had to start streaming with FFmpeg before you could play it back with FFplay?
If I'm fast enough with starting FFplay and then FFmpeg, it does receive content using your commands.

That does not work for my original command though: ffmpeg -f lavfi -i testsrc -f rtsp rtsp://localhost:554/live

My use case was to stream content via RTSP. So FFmpeg would be acting as a server; Running first and then clients connect later.

comment:23 Changed 3 weeks ago by taliho

FFmpeg cannot be used as an RTSP server. FFmpeg just sends data to an RTSP server which then re-distributes the content.

VLC has an option to create an RTSP server or could try:
https://github.com/revmischa/rtsp-server

In the example above, ffplay "pretends" it's an RTSP server but plays the content instead of redistributing it, which also explains why you have to start ffplay before ffmpeg
(this option is set with -rtsp_flags listen). Without this option ffplay would behave in the usual way and try to connect to an rtsp server.

comment:24 follow-up: Changed 3 weeks ago by DJX

Understood.
So the fact that "ffmpeg -f lavfi -i testsrc -f rtsp rtsp://localhost:554/live" hangs is expected?

comment:25 in reply to: ↑ 24 Changed 3 weeks ago by taliho

Replying to DJX:

Understood.
So the fact that "ffmpeg -f lavfi -i testsrc -f rtsp rtsp://localhost:554/live" hangs is expected?

For me the command times out and exits straight away if the rtsp server is not up.

Note: See TracTickets for help on using tickets.