AWS Elastic Transcoder / S3: converted videos in HLSv4 only play audio on low internet-bandwith

743 Views Asked by At

TLDR:

  • upload videos via aws-sdk (js) -> AWS Elastic Transcoder to S3 in HLSv4 format
  • upload my video with 4 presets: video_only_low, video_only_mid, video_only_high, audio_only (HLSv4 in Elastic Transcoder does not support a preset including video AND audio)
  • the auto-generated .m3u8 file has an audio-only stream next to my 3 video streams, so that user with slow internet only hear the audio without the video (blackscreen) in the video-player
  • i could remove the audio-only stream line from the .m3u8 file manually, but i would like to have auto-generated .m3u8 files without this audio-only stream

-> see questions at the end.

Full story:

I stream a video + audio with HLSv4 and I am using aws-sdk (js) (2.604.0) with AWS Elastic Transcoder and S3 to convert the original file (eg. .mp4) to HLSv4. I specified 4 Elastic Transcoder presets: video_low, video_mid, video_high and one for audio which is used by every video. For HLSv4 i can not generate one preset for video AND audio, there must be one or more presets for video and one for audio. After the transcoding, following generated .m3u8 file is in S3 output storage (next to the video/audio files in different qualities):

(replaced Guid with random guid)

    #EXTM3U
    #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-0",NAME="Default",AUTOSELECT=YES,DEFAULT=YES,URI="11111111-2222-3333-4444-555555555555_audio_v4.m3u8"
    #EXT-X-I-FRAME-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=14024000,CODECS="avc1.4d001f",URI="11111111-2222-3333-4444-555555555555_video_low_iframe.m3u8"
    #EXT-X-I-FRAME-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=22071000,CODECS="avc1.4d001f",URI="11111111-2222-3333-4444-555555555555_video_mid_iframe.m3u8"
    #EXT-X-I-FRAME-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=38803000,CODECS="avc1.4d0029",URI="11111111-2222-3333-4444-555555555555_video_high_iframe.m3u8"
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1387000,RESOLUTION=960x540,CODECS="avc1.4d001f,mp4a.40.2",AUDIO="audio-0" 11111111-2222-3333-4444-555555555555_video_low_v4.m3u8
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2001000,RESOLUTION=1280x720,CODECS="avc1.4d001f,mp4a.40.2",AUDIO="audio-0" 11111111-2222-3333-4444-555555555555_video_mid_v4.m3u8
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=4061000,RESOLUTION=1920x1080,CODECS="avc1.4d0029,mp4a.40.2",AUDIO="audio-0" 11111111-2222-3333-4444-555555555555_video_high_v4.m3u8
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=182000,CODECS="mp4a.40.2",AUDIO="audio-0" 11111111-2222-3333-4444-555555555555_audio_v4.m3u8

Our code + Elastic Transcoder worked great for the last years. Since the beginning of 2020, our users have been opening many tickets, that they only hear the audio stream without the video sometimes. So we tested the videos with different internet-bandwiths and we can reproduce the bug when the bandwith is not high enough for the video in low quality.

The .m3u8 file defines in the second line of the file above, that this is the audio with ID 'audio-0', that every video uses. Thats ok, so the audio is only stored once for all different video qualities.

The .m3u8 file defines in the last line, that audio-only is a stream for devices with a low bandwith. So i understand, that devices with slow internet only get the audio-only stream. But i don´t want that our users only stream the audio without the video, they should see a loading icon until the video player buffered enough for the lowest video quality. So for a test, i removed that last line, so there are only the video_low, -_mid and -_high streams available for the video player, so when i am on slow internet, the video player buffers until it has downloaded the first segment (7 secs) of the video.

So i could remove the audio-only stream line from all .m3u8 files of our videos to solve this bug. But i don´t want to update all new .m3u8 files every day and remove the last line of the generate file.

The creation of the Job for Elastic Transcoding is implemented via aws-sdk for javascript and uses the CreateJobOutputs object with all information about the presets the new video has to be transcoded.

2 questions:

  • What can i do, that the generated .m3u8 file does not contain the last line for the audio-only stream??

  • Why does our code and the video-stream worked great the last few years and since the beginning of 2020 our users have this problem? We update the aws-sdk monthly, but i couldn´t find any changes and the aws-sdk release notes for the Elastic Transcoder for a long time

0

There are 0 best solutions below