Opened 8 years ago

Closed 7 years ago

#6308 closed defect (fixed)

fifo muxer broken with RTSP

Reported by: ChocolateArmpits Owned by: Jan Sebechlebsky
Priority: normal Component: avformat
Version: unspecified Keywords: fifo
Cc: sebechlebskyjan@gmail.com Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

fifo muxer doesn't work when used with RTSP. Used by itself RTSP works properly. fifo used with TCP or UDP works correctly (mpegts muxer). Using latest snapshot compiled with MingW 64bit on Windows 7 64bit.

Ffplay is used to listen for incoming RTSP stream.

ffplay -f rtsp -rtsp_flags listen rtsp://localhost:8088

Ffmpeg is used to encode a single audio stream that is sent using fifo+rtsp to the same localhost port. The command fails. If used with fifo autorecovery the output just keeps restarting but doesn't do anything successful either.

$ ffmpeg -v 9 -loglevel 99 -re -f lavfi -i sine -acodec aac -f fifo -map 0:a -fifo_format rtsp rtsp://localhost:8088
ffmpeg version N-85461-gcd8e627 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.2.0 (Rev2, Built by MSYS2 project)
  configuration:
  libavutil      55. 61.100 / 55. 61.100
  libavcodec     57. 92.100 / 57. 92.100
  libavformat    57. 72.100 / 57. 72.100
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 84.101 /  6. 84.101
  libswscale      4.  7.100 /  4.  7.100
  libswresample   2.  8.100 /  2.  8.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'lavfi'.
Reading option '-i' ... matched as input url with argument 'sine'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'aac'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'fifo'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:a'.
Reading option '-fifo_format' ... matched as AVOption 'fifo_format' with argument 'rtsp'.
Reading option 'rtsp://localhost:8088' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url sine.
Applying option re (read input at native frame rate) with argument 1.
Applying option f (force format) with argument lavfi.
Successfully parsed a group of options.
Opening an input file: sine.
detected 2 logical cores
[AVFilterGraph @ 000000000045a9c0] query_formats: 2 queried, 3 merged, 0 already done, 0 delayed
[lavfi @ 0000000000458cc0] All info found
[lavfi @ 0000000000458cc0] stream 0: start_time: 0.000 duration: -209146758205323.719
[lavfi @ 0000000000458cc0] format: start_time: 0.000 duration: -9223372036854.775 bitrate=705 kb/s
Input #0, lavfi, from 'sine':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #0:0, 1, 1/44100: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Successfully opened the file.
Parsing a group of options: output url rtsp://localhost:8088.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument aac.
Applying option f (force format) with argument fifo.
Applying option map (set input stream mapping) with argument 0:a.
Successfully parsed a group of options.
Opening an output file: rtsp://localhost:8088.
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[graph_0_in_0_0 @ 0000000000520640] Setting 'time_base' to value '1/44100'
[graph_0_in_0_0 @ 0000000000520640] Setting 'sample_rate' to value '44100'
[graph_0_in_0_0 @ 0000000000520640] Setting 'sample_fmt' to value 's16'
[graph_0_in_0_0 @ 0000000000520640] Setting 'channel_layout' to value '0x4'
[graph_0_in_0_0 @ 0000000000520640] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x4
[format_out_0_0 @ 0000000000521bc0] Setting 'sample_fmts' to value 'fltp'
[format_out_0_0 @ 0000000000521bc0] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[format_out_0_0 @ 0000000000521bc0] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'
[AVFilterGraph @ 0000000000458be0] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0000000000522620] [SWR @ 0000000000522760] Using s16p internally between filters
[auto_resampler_0 @ 0000000000522620] ch:1 chl:mono fmt:s16 r:44100Hz -> ch:1 chl:mono fmt:fltp r:44100Hz
Output #0, fifo, to 'rtsp://localhost:8088':
  Metadata:
    encoder         : Lavf57.72.100
    Stream #0:0, 0, 1/44100: Audio: aac (LC), 44100 Hz, mono, fltp, delay 1024, 69 kb/s
    Metadata:
      encoder         : Lavc57.92.100 aac
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[tcp @ 00000000005378c0] No default whitelist set
[rtsp @ 00000000005468a0] Sending:
OPTIONS ://:554 RTSP/1.0
CSeq: 1
User-Agent: Lavf57.72.100

--
[rtsp @ 00000000005468a0] ret=0 c=00 [cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 2 times
av_interleaved_write_frame(): Invalid data found when processing input
No more output streams to write to, finishing.
size=N/A time=00:00:00.00 bitrate=N/A speed=   0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (sine):
  Input stream #0:0 (audio): 2 packets read (4096 bytes); 2 frames decoded (2048 samples);
  Total: 2 packets (4096 bytes) demuxed
Output file #0 (rtsp://localhost:8088):
  Output stream #0:0 (audio): 2 frames encoded (2048 samples); 1 packets muxed (258 bytes);
  Total: 1 packets (258 bytes) muxed
2 frames successfully decoded, 0 decoding errors
[aac @ 0000000000491bc0] Qavg: 98.930
Conversion failed!

RTSP by itself works correctly. The data is sent and received. The console output is cut short.

$ ffmpeg -v 9 -loglevel 99 -re -f lavfi -i sine -acodec aac -map 0:a -f rtsp rtsp://localhost:8088
ffmpeg version N-85461-gcd8e627 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.2.0 (Rev2, Built by MSYS2 project)
  configuration:
  libavutil      55. 61.100 / 55. 61.100
  libavcodec     57. 92.100 / 57. 92.100
  libavformat    57. 72.100 / 57. 72.100
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 84.101 /  6. 84.101
  libswscale      4.  7.100 /  4.  7.100
  libswresample   2.  8.100 /  2.  8.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'lavfi'.
Reading option '-i' ... matched as input url with argument 'sine'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'aac'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:a'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'rtsp'.
Reading option 'rtsp://localhost:8088' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url sine.
Applying option re (read input at native frame rate) with argument 1.
Applying option f (force format) with argument lavfi.
Successfully parsed a group of options.
Opening an input file: sine.
detected 2 logical cores
[AVFilterGraph @ 00000000005aa8c0] query_formats: 2 queried, 3 merged, 0 already done, 0 delayed
[lavfi @ 00000000005a8ac0] All info found
[lavfi @ 00000000005a8ac0] stream 0: start_time: 0.000 duration: -209146758205323.719
[lavfi @ 00000000005a8ac0] format: start_time: 0.000 duration: -9223372036854.775 bitrate=705 kb/s
Input #0, lavfi, from 'sine':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #0:0, 1, 1/44100: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Successfully opened the file.
Parsing a group of options: output url rtsp://localhost:8088.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument aac.
Applying option map (set input stream mapping) with argument 0:a.
Applying option f (force format) with argument rtsp.
Successfully parsed a group of options.
Opening an output file: rtsp://localhost:8088.
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[graph_0_in_0_0 @ 00000000004d15c0] Setting 'time_base' to value '1/44100'
[graph_0_in_0_0 @ 00000000004d15c0] Setting 'sample_rate' to value '44100'
[graph_0_in_0_0 @ 00000000004d15c0] Setting 'sample_fmt' to value 's16'
[graph_0_in_0_0 @ 00000000004d15c0] Setting 'channel_layout' to value '0x4'
[graph_0_in_0_0 @ 00000000004d15c0] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x4
[format_out_0_0 @ 00000000004d2160] Setting 'sample_fmts' to value 'fltp'
[format_out_0_0 @ 00000000004d2160] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[format_out_0_0 @ 00000000004d2160] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'
[AVFilterGraph @ 00000000004d0f00] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 00000000004d3bc0] [SWR @ 00000000004d3da0] Using s16p internally between filters
[auto_resampler_0 @ 00000000004d3bc0] ch:1 chl:mono fmt:s16 r:44100Hz -> ch:1 chl:mono fmt:fltp r:44100Hz
[tcp @ 00000000005adae0] No default whitelist set
[rtsp @ 00000000005af300] Sending:
OPTIONS rtsp://localhost:8088 RTSP/1.0
CSeq: 1
User-Agent: Lavf57.72.100

--
[rtsp @ 00000000005af300] ret=1 c=52 [R]
[rtsp @ 00000000005af300] ret=1 c=54 [T]
[rtsp @ 00000000005af300] ret=1 c=53 [S]
[rtsp @ 00000000005af300] ret=1 c=50 [P]
[rtsp @ 00000000005af300] ret=1 c=2f [/]
[rtsp @ 00000000005af300] ret=1 c=31 [1]
[rtsp @ 00000000005af300] ret=1 c=2e [.]
[rtsp @ 00000000005af300] ret=1 c=30 [0]
[rtsp @ 00000000005af300] ret=1 c=20 [ ]
[rtsp @ 00000000005af300] ret=1 c=32 [2]
[rtsp @ 00000000005af300] ret=1 c=30 [0]
    Last message repeated 1 times
[rtsp @ 00000000005af300] ret=1 c=20 [ ]
[rtsp @ 00000000005af300] ret=1 c=4f [O]
[rtsp @ 00000000005af300] ret=1 c=4b [K]
]rtsp @ 00000000005af300] ret=1 c=0d [
[rtsp @ 00000000005af300] ret=1 c=0a [
]
[rtsp @ 00000000005af300] line='RTSP/1.0 200 OK'
[rtsp @ 00000000005af300] ret=1 c=43 [C]
[rtsp @ 00000000005af300] ret=1 c=53 [S]
[rtsp @ 00000000005af300] ret=1 c=65 [e]
[rtsp @ 00000000005af300] ret=1 c=71 [q]
[rtsp @ 00000000005af300] ret=1 c=3a [:]

Ffmpeg version

$ ffmpeg -version
ffmpeg version N-85461-gcd8e627 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.2.0 (Rev2, Built by MSYS2 project)
configuration:
libavutil      55. 61.100 / 55. 61.100
libavcodec     57. 92.100 / 57. 92.100
libavformat    57. 72.100 / 57. 72.100
libavdevice    57.  7.100 / 57.  7.100
libavfilter     6. 84.101 /  6. 84.101
libswscale      4.  7.100 /  4.  7.100
libswresample   2.  8.100 /  2.  8.100

Change History (4)

comment:1 by Jan Sebechlebsky, 7 years ago

Analyzed by developer: set
Cc: sebechlebskyjan@gmail.com added
Owner: set to Jan Sebechlebsky
Status: newopen

comment:2 by Jan Sebechlebsky, 7 years ago

Reproduced by developer: set

comment:3 by Jan Sebechlebsky, 7 years ago

Thank you for reporting the issue! I've just sent the patch to FFmpeg-devel mailing list and it should be applied soon.

comment:4 by Jan Sebechlebsky, 7 years ago

Component: undeterminedavformat
Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.