Open laurfb opened 2 weeks ago
This PR(fix sample_rate error in statistic) is experimental and not recommended for merging into the main branch. Many scenarios haven't been considered, such as the MP3 format. This would add a lot of code without much benefit.
Of course, if you don't need to consider more formats, you can merge it into your own branch. It is functional.
Hi. Did some test with srt streams with aac, mp3 and ogg audio codecs. The results:
srt/rtmp streams with aac audio, sampling 48000: statistics displayed for both, but with default 44100 sampling frequncy instead of 48000
srt/rtmp streams with mp3 audio, sampling 48000: statistics displayed only for rtmp, again with default 44100 sampling frequncy instead of 48000, only video for srt
srt/rtmp streams with ogg audio, sampling 48000: the same, statistic displayed only for rtmp, default 44100 sampling frequncy displayed instead of 48000, only video for srt, audio detected as AAC
Anyway, it's an (important) step ahead! :) Thx!
regards, Laur
OK, I will recheck the SRT streaming
In Stream (console) page srs report always 44100 as sampling frequency for audio regardless of real value. At the moment srs can manage/recognize only four sampling frequency (5512, 11025, 22050, 44100). Any other sampling feequency, apart from the four mentioned, are displayed as 44100.
Version srs docker v6.x/5.x
To Reproduce push some rtmp stream to srs (OBS/ffmpeg, etc,) like:
ffmpeg -re -i input.mp4 -c:v libx264 -profile:v high -preset:v ultrafast -b:v 8M -c:a aac -ar 48000 -ac 2 -b:a 256k -f flv rtmp://192.168.1.1:1935/live/test
or with any other sampling frequency (48000, 96000, whatever)
Checking outputed stream with ffmpeg/ffprobe/ffplay we got corectly the expected audio sampling frequency:
but srs always display 44100
Expected behavior Display real (detected) value (48000, 96000...).
Additional context Related to this issue: srs doen't display any info about received streams if "srt_to_rtmp" option is set to "off". If "srt_to_rtmp" is set to "on" srs display altered info for video and always "44100" as sampling frequency for audio regardless real input values.
Don't know in this case if this is the expected behavior (no info if "srt_to_rtmp" is set to "off")
To Reproduce Push srt stream to srs:
ffmpeg -re -i input.mp4 -c:v libx264 -profile:v high -preset:v ultrafast -b:v 8M -c:a aac -ar 48000 -ac 2 -b:a 256k -f mpegts srt://192.168.1.1:10080?streamid=#!::r=live/test,m=publish
Check output stream data with:
ffplay srt://192.168.1.1:10080?streamid=#!::r=live/test,m=request or with ffprobe srt://192.168.1.1:10080?streamid=#!::r=live/test,m=request
and compare with info reported by srs
regards, Laur