bcc-code / bcc-media-flows

[BCC Media] Our video transcoding workflows
1 stars 0 forks source link

Order of audio playlists in VOD HLS playlist is random #311

Closed andreasgangso closed 3 months ago

andreasgangso commented 3 months ago

Older videos, e.g. https://app.bcc.media/episode/2706, has correct audio ordering Newer videos, e.g. https://app.bcc.media/episode/2716 has random audio ordering

Video ordering for both of them could be better, by putting 540p first and then ascending from 180p. But this can be split into a separate issue.

Example (https://app.bcc.media/episode/2716)

#EXTM3U
#EXT-X-VERSION:6
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-STREAM-INF:BANDWIDTH=438411,AVERAGE-BANDWIDTH=438411,RESOLUTION=480x270,FRAME-RATE=25.000,CODECS="avc1.64000D,mp4a.40.2",AUDIO="audio_0"
0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_1.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=578814,AVERAGE-BANDWIDTH=578814,RESOLUTION=640x360,FRAME-RATE=25.000,CODECS="avc1.64000D,mp4a.40.2",AUDIO="audio_0"
0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_2.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1513283,AVERAGE-BANDWIDTH=1513283,RESOLUTION=1280x720,FRAME-RATE=25.000,CODECS="avc1.64000D,mp4a.40.2",AUDIO="audio_0"
0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_3.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=333683,AVERAGE-BANDWIDTH=333683,RESOLUTION=320x180,FRAME-RATE=25.000,CODECS="avc1.64000D,mp4a.40.2",AUDIO="audio_0"
0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_4.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=959293,AVERAGE-BANDWIDTH=959293,RESOLUTION=960x540,FRAME-RATE=25.000,CODECS="avc1.64000D,mp4a.40.2",AUDIO="audio_0"
0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_5.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=3652886,AVERAGE-BANDWIDTH=3652886,RESOLUTION=1920x1080,FRAME-RATE=25.000,CODECS="avc1.64000D,mp4a.40.2",AUDIO="audio_0"
0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_6.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Simplified Chinese",LANGUAGE="cmn",DEFAULT=YES,AUTOSELECT=YES,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_8_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Croatian",LANGUAGE="hrv",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_9_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Tamil",LANGUAGE="tam",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_10_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Norwegian",LANGUAGE="nor",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_11_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="German",LANGUAGE="deu",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_12_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Dutch",LANGUAGE="nld",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_13_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="English",LANGUAGE="eng",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_14_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="French",LANGUAGE="fra",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_15_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Spanish",LANGUAGE="spa",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_16_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Finnish",LANGUAGE="fin",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_17_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Russian",LANGUAGE="rus",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_18_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Portuguese",LANGUAGE="por",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_19_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Romanian",LANGUAGE="ron",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_20_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Turkish",LANGUAGE="tur",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_21_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Polish",LANGUAGE="pol",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_22_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Bulgarian",LANGUAGE="bul",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_23_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Hungarian",LANGUAGE="hun",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_24_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Italian",LANGUAGE="ita",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_25_0.m3u8
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio_0",CHANNELS="2",NAME="Slovenian",LANGUAGE="slv",DEFAULT=NO,AUTOSELECT=NO,URI="0c58838c265d4bcfbed371122b2f0706/bdb1510aef884871ada173341ece7a8d/index_26_0.m3u8
KillerX commented 3 months ago

Note: Check if this is consistent with the SMIL file. We have done some changes in how the files are transcoded so the ordering could be dependent on that.

andreasgangso commented 3 months ago

ill investigate a little

andreasgangso commented 3 months ago

We are filling up the audio tracks into the video files, starting with the lowest quality (180p) But its max 16 audio tracks per video file.

Issue is basically that the 17th language gets put into the next quality, and the ordering is not consistent, so the 270p can be at the top:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<smil>
    <head>
        <meta name="formats" content="mp4"></meta>
    </head>
    <body>
        <switch>
            <video src="SC24_TILBAKEBLIKK_SEQ_480x270.mp4" includeAudio="true" systemLanguage="tam" audioName="Tamil"></video>
            <video src="SC24_TILBAKEBLIKK_SEQ_960x540.mp4" includeAudio="false" systemLanguage="" audioName=""></video>
            <video src="SC24_TILBAKEBLIKK_SEQ_1920x1080.mp4" includeAudio="false" systemLanguage="" audioName=""></video>
            <video src="SC24_TILBAKEBLIKK_SEQ_1280x720.mp4" includeAudio="false" systemLanguage="" audioName=""></video>
            <video src="SC24_TILBAKEBLIKK_SEQ_640x360.mp4" includeAudio="false" systemLanguage="" audioName=""></video>
            <video src="SC24_TILBAKEBLIKK_SEQ_320x180.mp4" includeAudio="true" systemLanguage="nor,deu,nld,eng,fra,spa,fin,rus,por,ron,tur,pol,hun,slv,cmn,hrv" audioName="Norwegian,German,Dutch,English,French,Spanish,Finnish,Russian,Portuguese,Romanian,Turkish,Polish,Hungarian,Slovenian,Simplified Chinese,Croatian"></video>
        </switch>
    </body>
</smil>

Here, tamil gets picked as the default lang and the rest gets put below it. I'm assuming the fix is simply to order the qualities correctly.