{"action":"created","issue":{"url":"https://api.github.com/repos/gpac/gpac/issues/23","labels_url":"https://api.github.com/repos/gpac/gpac/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/gpac/gpac/issues/23/comments","events_url":"https://api.github.com/repos/gpac/gpac/issues/23/events","html_url":"https://github.com/gpac/gpac/issues/23","id":52630874,"number":23,"title":"[DASH] Bitstream switching between Representations that use different codecs.","user":{"login":"vladimir-kazakov","id":3518844,"avatar_url":"https://avatars.githubusercontent.com/u/3518844?v=3","gravatar_id":"","url":"https://api.github.com/users/vladimir-kazakov","html_url":"https://github.com/vladimir-kazakov","followers_url":"https://api.github.com/users/vladimir-kazakov/followers","following_url":"https://api.github.com/users/vladimir-kazakov/following{/other_user}","gists_url":"https://api.github.com/users/vladimir-kazakov/gists{/gist_id}","starred_url":"https://api.github.com/users/vladimir-kazakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladimir-kazakov/subscriptions","organizations_url":"https://api.github.com/users/vladimir-kazakov/orgs","repos_url":"https://api.github.com/users/vladimir-kazakov/repos","events_url":"https://api.github.com/users/vladimir-kazakov/events{/privacy}","received_events_url":"https://api.github.com/users/vladimir-kazakov/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2014-12-22T08:59:54Z","updated_at":"2015-05-21T15:48:02Z","closed_at":"2015-01-06T15:26:43Z","body":"Hi!\r\n\r\nWhile creating DASH media using MP4Box (GPAC rev 5572), I noticed a warning that says \"[DASH]: Couldnt merge AVC|H264 SPS from different files (same SPS ID used) - different sample descriptions will be used\". Also, by looking at the code and by checking the MPD, I noticed that bitstream switching is turned off in this case: https://github.com/gpac/gpac/blob/25a10ffec1af2431a708d3b0ca4133c228cc4787/src/media_tools/dash_segmenter.c#L2437\r\n\r\nMy media consists of 2 video (v) and 1 audio (a) stream (http://1drv.ms/1xDsl27):\r\n1.v) 360p using Constrained Baseline profile and level 3.0.\r\n2.v) 720p using High profile and level 3.1.\r\n1.a) AAC-LC.\r\n\r\nSo, what triggers this behavior (and warning) is the fact that I'm using different codecs for different video Representations.\r\n\r\nBut it seems that something is wrong here.\r\n1) DASH-AVC/264 Interoperability Points v2.0 (and other versions) does not require Representations in one specific AdaptationSet to use the same codec. (This case is not even mentioned there.)\r\n2) ISO/IEC 23009-1 (2nd edition) (DASH standard) also does not have such a requirement, but it additionally mentions in 4.3 that \"Clients may ignore Representations that rely on codecs or other rendering technologies they do not support or that are otherwise unsuitable\".\r\n\r\nIn other words, only media players (Clients) must decide whether they're going to switch to specific (supported) streams. So, bitstream switching must not be disabled by default, if different codecs are used.\r\n\r\nAlso, speaking of the warning itself, it seems wrong or misleading (although I must say that I don't know much about SPS NAL units). Why MP4Box is trying to merge SPSs? Since different profiles and levels are used, it should be OK that SPSs are different, isn't it? And if SPSs \"couldn't be merged\", then why the \"same SPS ID used\"?"},"comment":{"url":"https://api.github.com/repos/gpac/gpac/issues/comments/104326366","html_url":"https://github.com/gpac/gpac/issues/23#issuecomment-104326366","issue_url":"https://api.github.com/repos/gpac/gpac/issues/23","id":104326366,"user":{"login":"Murmur","id":79523,"avatar_url":"https://avatars.githubusercontent.com/u/79523?v=3","gravatar_id":"","url":"https://api.github.com/users/Murmur","html_url":"https://github.com/Murmur","followers_url":"https://api.github.com/users/Murmur/followers","following_url":"https://api.github.com/users/Murmur/following{/other_user}","gists_url":"https://api.github.com/users/Murmur/gists{/gist_id}","starred_url":"https://api.github.com/users/Murmur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Murmur/subscriptions","organizations_url":"https://api.github.com/users/Murmur/orgs","repos_url":"https://api.github.com/users/Murmur/repos","events_url":"https://api.github.com/users/Murmur/events{/privacy}","received_events_url":"https://api.github.com/users/Murmur/received_events","type":"User","site_admin":false},"created_at":"2015-05-21T15:48:02Z","updated_at":"2015-05-21T15:48:02Z","body":"Dash multibitrate with -bs-switching multi creates a single init.mp4 file where TRAK/MDIA/MINF/STBL table has three AVC1 children. Child element has SPS and PPS h264 stream details. \r\n\r\nmp4box uses  `MOOF/TRAF/TFHD/sample_description_index` 2 and 3 numbers in an appropriate track fragment files. Fragments for first video track has `MOOF/TRAF/flags=20000` so index field is not explicitly set, it maps to first avc1 child. That's my limited mp4 understanding. mp4box writes manifest `codecs=\"avc3.4d4028\"` video representation attributes.\r\n\r\nThis test stream from internet has an explicit `MOOF/TRAF/TFHD/sample_description_index` 1, 2 and 3 numbers in all track fragment files. This file is multi_avc1 file but codecs attributes are using avc1.* prefix.\r\n[Where_The_Trail_Ends_768_448_384_ddp.mpd](http://streaming.dolby.com/ondel/playback/Dolby_Digital_Plus_Online_Playback_Kit_v1.1/Test_Signals/HbbTV/HPL40_25fps/Unencrypted/multi_av_rate/71/Where_The_Trail_Ends_768_448_384_ddp.mpd)\r\n[video init file](http://streaming.dolby.com/ondel/playback/Dolby_Digital_Plus_Online_Playback_Kit_v1.1/Test_Signals/HbbTV/HPL40_25fps/Unencrypted/multi_av_rate/71/Where_The_Trail_Ends_768_448_384_ddp_V.mp4), [video1 seg1](http://streaming.dolby.com/ondel/playback/Dolby_Digital_Plus_Online_Playback_Kit_v1.1/Test_Signals/HbbTV/HPL40_25fps/Unencrypted/multi_av_rate/71/Where_The_Trail_Ends_768_448_384_ddp_V_1_1.m4s), [video2 seg1](http://streaming.dolby.com/ondel/playback/Dolby_Digital_Plus_Online_Playback_Kit_v1.1/Test_Signals/HbbTV/HPL40_25fps/Unencrypted/multi_av_rate/71/Where_The_Trail_Ends_768_448_384_ddp_V_2_1.m4s), [video3 seg1](http://streaming.dolby.com/ondel/playback/Dolby_Digital_Plus_Online_Playback_Kit_v1.1/Test_Signals/HbbTV/HPL40_25fps/Unencrypted/multi_av_rate/71/Where_The_Trail_Ends_768_448_384_ddp_V_3_1.m4s)\r\n\r\n```\r\n## MP4Box - GPAC version 0.5.2-DEV-rev384-gaa0f405-master\r\nmp4box.exe -noprog -dash 8000 -frag 8000 -mem-frags -rap -frag-rap -profile dashavc264:live\r\n -profile-ext \"urn:hbbtv:dash:profile:isoff-live:2012\"\r\n -bs-switching multi -sample-groups-traf -single-traf -no-frags-default -subsegs-per-sidx 0\r\n -min-buffer 4000\r\n -segment-name \"testvideo_$RepresentationID$_$Number$$Init=init$\" -segment-timeline\r\n -out \"output\\testvideo.mpd\"\r\n \"temp-360p.mp4#trackID=1:id=v1\"\r\n \"temp-720p.mp4#trackID=1:id=v2\"\r\n \"temp-1080p.mp4#trackID=1:id=v3\"\r\n \"temp-128k.mp4#trackID=1:id=a4\"\r\n```\r\n\r\nI have access to several HbbTV televisions and all devices playback Dolphy Where_The_Trail_Ends_768_448_384_ddp.mpd test file. It is h264+ec3 multibitrate file.\r\n\r\nMy own test file works fine on some devices with avc3.* codec prefix. Some failed but after editing avc1.* prefix in codecs attributes manifest worked fine. Some devices don't playback anything. I need to study this further but am gathering random differences so far.\r\n- first video stream fragments don't use an explicit sample_description_index value\r\n- Dolphy has ec3 audio but I had aac_lc, need to change this to aac_he, rip ec3 for testing or don't use audio track at all.\r\n- I had 640x360, 1280x720, 1920x1080 video size, Dolphy has 720x576, 1280x720, 1920x1080 size. Maybe hbbtv devices don't work well with non-broadcast resolutions. I did try single bitrate 360p and it did work on a problematic device.\r\n\r\nI don't have aac_he in my ffmpeg build yet so that may have a problem. I need to download non-gpl ffmpeg with libfdk_aac modules and try this difference later.\r\n\r\nThis problem sort of belongs to this topic but I am not sure if should create a new issue topic, or just communicate this here for a while. Missing explicit sample_index is major(?) difference I have found in meta data."}}