Zhufeng Tang
Zhufeng Tang

Reputation: 11

Why does SRS not recognize the audio format correctly in an RTMP stream?

SRS did not recognize the audio format correctly, the pushed RTMP stream is mono, but it is displayed as stereo on the webpage.

Using ffmpeg (version 4.4) to re-encode and forward an RTMP stream. The original stream is in speex format, mono, and 16000 Hz. The ffmpeg command is as follows

ffmpeg -i rtmp://127.0.0.1/live/livestream -vn -ac 1 -ar 22050 -c:a libfdk_aac -f flv rtmp://IP/live/livestream

test SRS version

v-4.0.268
v-4.0.251

ffmpeg returns as follows

  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
  ...

  Duration: 00:00:00.00, start: 3046.899000, bitrate: N/A
  Stream #0:0: Audio: aac (LC), 44100 Hz, mono, fltp, 65 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (aac (native) -> aac (libfdk_aac))
  ...
  Stream #0:0: Audio: aac ([10][0][0][0] / 0x000A), 22050 Hz, mono, s16, 48 kb/s
    Metadata:
      encoder         : Lavc58.134.100 libfdk_aac

ffprob info as follows

  Duration: 00:00:00.00, start: 10.867000, bitrate: N/A
  Stream #0:0: Audio: aac (LC), 22050 Hz, mono, fltp, 47 kb/s

SRS website recognize

Recv: 0.00Kbps
Send: 0.00Kbps
Audio: AAC/22050/Stereo/LC

I set OBS to mono and directly pushed the stream, but with FFMPEG, it is displayed as follows on the webpage

Recv: 0.00Kbps
Send: 0.00Kbps
Video: H264/Baseline/4/1920x1080
Audio: AAC/44100/Stereo/LC

ffprob info (rtmp)

  Duration: N/A, start: 0.000000, bitrate: 2625 kb/s
  Stream #0:0: Data: none
  Stream #0:1: Audio: aac (LC), 44100 Hz, mono, fltp, 65 kb/s
  Stream #0:2: Video: h264 (Constrained Baseline), yuv420p(progressive), 1920x1080, 2560 kb/s, 30 fps, 30 tbr, 1k tbn

Upvotes: 1

Views: 74

Answers (0)

Related Questions