ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.75k stars 5.39k forks source link

GB28181: Dahua/Hikvision cameras, when streaming to SRS without enabling audio, using ffplay m3u8, encounter Stream #0:0: Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp. #2570

Closed geiliwanghaichao closed 2 years ago

geiliwanghaichao commented 3 years ago

Migrate to https://github.com/ossrs/srs-gb28181/issues/14

GB has been moved to a separate repository srs-gb28181, please refer to #2845. For any issues, please submit them to the GB repository bug, or pr.' Make sure to maintain the markdown structure.

TRANS_BY_GPT3

geiliwanghaichao commented 3 years ago

According to the method in reference #1326, modify the code in the function SrsTsPacket* SrsTsPacket::create_pmt(SrsTsContext* context, int16_t pmt_number, int16_t pmt_pid, int16_t vpid, SrsTsStream vs, int16_t apid, SrsTsStream as) of the srs_kernel_ts.cpp file as follows: image

Comment out the above two lines of code to remove the display of the audio channel when playing the m3u8 file using ffplay. 167a18b08bbe25faac8f59e1ec85d10 However, it is currently unclear what impact this framework has. I don't know if @winlinvip has confirmed this issue or if there is a fundamental solution to this problem.

TRANS_BY_GPT3

duiniuluantanqin commented 3 years ago

After looking at the code, the encoding format for HLS is specified in the configuration file as hls_acodec/hls_vcodec. This means that the encoding format needs to be determined before the program starts. If there is no audio, you can make the following settings.

vhost __defaultVhost__ {
    hls {
        enabled         on;
        hls_fragment    10;
        hls_window      60;
        hls_path        ./objs/nginx/html;
        hls_m3u8_file   [app]/[stream].m3u8;
        hls_ts_file     [app]/[stream]-[seq].ts;
        hls_acodec      an;
    }
}

I'm not sure if this will meet your requirements.

If you want to automatically determine the encoding format, it is necessary to reorganize the code and see if it is necessary.

PS: Also, let me mention that your way of making changes definitely won't work. If you comment out those two lines of code and then re-enable the audio, it will crash.

TRANS_BY_GPT3

winlinvip commented 2 years ago

Migrate to https://github.com/ossrs/srs-gb28181/issues/14

GB has been moved to a separate repository srs-gb28181, please refer to #2845. For any issues, please submit them to the GB repository bug, or pr. Make sure to maintain the markdown structure.

TRANS_BY_GPT3