xqq / mpegts.js

HTML5 MPEG2-TS / FLV Stream Player
Apache License 2.0
1.63k stars 205 forks source link

Error to play h264 and aac 5.1 channels HTTP-FLV stream #157

Open winlinvip opened 6 months ago

winlinvip commented 6 months ago

Start SRS to convert RTMP to HTTP-FLV:

docker run --rm -it -p 8080:8080 -p 1935:1935 ossrs/srs:5 \
  ./objs/srs -c conf/http.flv.live.conf

Download a small segment from: bbb-4k-10s.mp4.zip, or you can download the huge original source from bbb_sunflower_2160p_60fps_normal.mp4.

Transcode to HEVC by FFmpeg 6.1 and publish to SRS via RTMP:

ffmpeg -stream_loop -1 -re -i bbb-4k-10s.mp4 -c:v copy -c:a aac -ar 44100 \
  -f flv rtmp://localhost/live/livestream

Open http://localhost:8080/players/srs_player.html?autostart=true the errors is:

image

Workaround is to transcode the channels to 6 or 2:

ffmpeg -stream_loop -1 -re -i bbb-4k-10s.mp4 -c:v copy -c:a aac -ar 44100 -ac 6 \
  -f flv rtmp://localhost/live/livestream

Note that the original video is 6 channels, which is 5.1 channels.

monyone commented 6 months ago

@winlinvip FFmpeg seems to send AAC audio_config = 0 in this situlation, it not supported in MSE (Chrome, Firefox, etc...) Workaround is specify channelmap -af channelmap=channel_layout=5.1. This enforce channel config to 6, seems OK.