Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ingest no audio stream (HLS trouble) #409

Closed
icevl opened this issue May 27, 2015 · 4 comments
Closed

Ingest no audio stream (HLS trouble) #409

icevl opened this issue May 27, 2015 · 4 comments
Assignees
Labels
EnglishNative This issue is conveyed exclusively in English. Enhancement Improvement or enhancement.
Milestone

Comments

@icevl
Copy link

icevl commented May 27, 2015

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

@winlinvip
Copy link
Member

HLS does not support video only.

@winlinvip winlinvip added this to the srs 2.0 release milestone May 28, 2015
@winlinvip
Copy link
Member

Maybe SRS should support this.

@winlinvip winlinvip reopened this May 28, 2015
@winlinvip winlinvip added Enhancement Improvement or enhancement. and removed question labels May 28, 2015
@winlinvip
Copy link
Member

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.

@winlinvip
Copy link
Member

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:

  1. MAC safari.
  2. MAC chrome, jwplayer.
  3. MAC VLC.
  4. Android 4.4

@winlinvip winlinvip self-assigned this Aug 26, 2021
@winlinvip winlinvip added the EnglishNative This issue is conveyed exclusively in English. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EnglishNative This issue is conveyed exclusively in English. Enhancement Improvement or enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants