Ingest no audio stream (HLS trouble)
icevl opened this issue · 4 comments
Hi. I use SRS 2.
When i catch my camera stream with no audio, on output from ingest i getting stream with audo "undf" codec and results HLS on mobile platforms doesnt work.
ffmoeg info HLS .ts file:
[NULL @ 0x237f1e0] start time for stream 0 is not set in estimate_timings_from_pts
[mpegts @ 0x237b420] Could not find codec parameters for stream 0 (Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Example of hls stream: http://cam.utl.ru/22/hls/live.m3u8
HLS does not support video only.
Maybe SRS should support this.
Use SRS ingest to drop audio and output HLS:
vhost __defaultVhost__ {
hls {
enabled on;
hls_fragment 10;
hls_window 60;
hls_path ./objs/nginx/html;
hls_m3u8_file [app]/[stream]/live.m3u8;
hls_ts_file [app]/[stream]/[timestamp].ts;
}
ingest livestream {
enabled on;
input {
type file;
url doc/source.200kbps.768x320.flv;
}
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine {
enabled on;
vcodec copy;
acodec an;
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
}
}
}
Get the info of HLS:
winlin:livestream winlin$ ffmpeg -i live.m3u8
Stream #0:0: Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp
Stream #0:1: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 768x320 [SAR 1:1 DAR 12:5], 25 fps, 25 tbr, 90k tbn, 50 tbc
There is no audio stream, but the HLS indicates the audio codec is AAC.
This because the SRS never know the codec of video and audio when write the ts PAT/PMT info.
So we must set the vcodec and acodec of HLS:
# the default audio codec of hls.
# when codec changed, write the PAT/PMT table, but maybe ok util next ts.
# so user can set the default codec for mp3.
# the available audio codec:
# aac, mp3, an
# default: aac
hls_acodec an;
# the default video codec of hls.
# when codec changed, write the PAT/PMT table, but maybe ok util next ts.
# so user can set the default codec for pure audio(without video) to vn.
# the available video codec:
# h264, vn
# default: h264
hls_vcodec h264;
So, we change the config of SRS to:
vhost __defaultVhost__ {
hls {
enabled on;
hls_fragment 10;
hls_window 60;
hls_path ./objs/nginx/html;
hls_m3u8_file [app]/[stream]/live.m3u8;
hls_ts_file [app]/[stream]/[timestamp].ts;
hls_acodec an;
hls_vcodec h264;
}
ingest livestream {
enabled on;
input {
type file;
url doc/source.200kbps.768x320.flv;
}
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine {
enabled on;
vcodec copy;
acodec an;
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
}
}
}
And the info of SRS:
winlin:srs winlin$ ./objs/srs -v
2.0.172
winlin:livestream winlin$ ffmpeg -i live.m3u8
Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 768x320 [SAR 1:1 DAR 12:5], 25 fps, 25 tbr, 90k tbn, 50 tbc
And it's test ok on:
- MAC safari.
- MAC chrome, jwplayer.
- MAC VLC.
- Android 4.4