{"action":"created","issue":{"url":"https://api.github.com/repos/gpac/gpac/issues/234","labels_url":"https://api.github.com/repos/gpac/gpac/issues/234/labels{/name}","comments_url":"https://api.github.com/repos/gpac/gpac/issues/234/comments","events_url":"https://api.github.com/repos/gpac/gpac/issues/234/events","html_url":"https://github.com/gpac/gpac/issues/234","id":105367880,"number":234,"title":"[MP4Box] [DASH] [iOS] Wrong playback speed and the broken media player timeline.","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":[{"url":"https://api.github.com/repos/gpac/gpac/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/gpac/gpac/labels/player%20(mp4client/osmo)","name":"player (mp4client/osmo)","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-09-08T12:21:51Z","updated_at":"2015-09-15T15:26:04Z","closed_at":null,"body":"Hi!\r\n\r\nWhile creating DASH on-demand media using MP4Box (GPAC version 0.5.2-DEV-rev575-geedd2f0-master) for some iOS media player, I noticed following issues:\r\n\r\n* The video playback speed is wrong. Depending on media, it may be either too fast or too slow. At the same time, the audio plays (sounds) at its normal speed.\r\n* The timeline of the media player is broken. The media player shows it like there's a lot of content. So, when the media ends, there's still a lot of space to the right.\r\n\r\nWhat's interesting, Google's eDash packager (https://github.com/google/edash-packager) produces DASH media that plays correctly. This points to the fact that MP4Box is doing something wrong. I've tried to find out what may cause such issues, and I noticed following issues in MP4Box. Test media with logs can be found here: http://1drv.ms/1JPg0t8. (I also use mp4dump for inspecting media, which comes from Bento4.)\r\n\r\n1. After dashing the media, durations of the movie ('moov/mvhd') and the track ('moov/trak/tkhd') are being reset to 0. You may see it in /MP4Box/mp4box.info.video.txt and /MP4Box/mp4dump.video.txt. The media player that I use uses this information, and because of that is not able to display the timeline correctly. In the /Source folder, you may see logs that show that before dashing in MP4Box, durations are present.\r\n\r\n1. \"MP4Box -info\" with eDash media, looses durations mentioned in (1). You can see it by looking at /eDash/mp4box.info.video.txt. This seems like another bug in MP4Box, because the /eDash/mp4dump.video.txt shows that durations are there. So, it's just MP4Box shows them as zeroes."},"comment":{"url":"https://api.github.com/repos/gpac/gpac/issues/comments/140429295","html_url":"https://github.com/gpac/gpac/issues/234#issuecomment-140429295","issue_url":"https://api.github.com/repos/gpac/gpac/issues/234","id":140429295,"user":{"login":"cconcolato","id":1830314,"avatar_url":"https://avatars.githubusercontent.com/u/1830314?v=3","gravatar_id":"","url":"https://api.github.com/users/cconcolato","html_url":"https://github.com/cconcolato","followers_url":"https://api.github.com/users/cconcolato/followers","following_url":"https://api.github.com/users/cconcolato/following{/other_user}","gists_url":"https://api.github.com/users/cconcolato/gists{/gist_id}","starred_url":"https://api.github.com/users/cconcolato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cconcolato/subscriptions","organizations_url":"https://api.github.com/users/cconcolato/orgs","repos_url":"https://api.github.com/users/cconcolato/repos","events_url":"https://api.github.com/users/cconcolato/events{/privacy}","received_events_url":"https://api.github.com/users/cconcolato/received_events","type":"User","site_admin":false},"created_at":"2015-09-15T15:26:04Z","updated_at":"2015-09-15T15:26:04Z","body":">I noticed that the timescale changes only in the \"moov\". Is it correct behavior? I was expecting it to be updated everywhere.\r\n\r\nThis is the correct behavior. `-timescale` changes the movie timescale (updating the movie duration, the track duration values expressed in this timescale, the edit list entries). If you want change the track timescale (aka media timescale), you have to do it during the import such as:\r\n```\r\nMP4Box -add input.mp4:timescale=1000 -timescale 1000 input.mp4\r\n```\r\nThis will import the input file, make a track whose timescale is 1000 and set as well the movie timescale to 1000.\r\n\r\n>It seems that there's a precision issue.\r\n\r\nIndeed, changing the timescale of a track shouldn't affect its duration in seconds (or marginally given the precision). I've created a separate issue #247 to track that bug.\r\n\r\n> I can't find this quote in the ISOBMFF spec. Which version do you have?\r\n\r\nThe text I quoted is part of the first corrigendum: 14496-12:2012/Cor.1:2013. Available here: http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=63525\r\nNote that there are 3 other corrigenda and 3 additional amendments: \r\nhttp://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=61988\r\nA new 5th edition is about to be released.\r\n\r\n> Then why there's 0?\r\n\r\nIf I run your command line, and then do `MP4Box -diso 360p-400k_dashinit.mp4`, you can see the following two lines:\r\n```\r\n...\r\n<TrackExtendsBox SampleDescriptionIndex=\"1\" SampleDuration=\"0\" SampleSize=\"0\" TrackID=\"1\">\r\n...\r\n<TrackFragmentHeaderBox BaseDataOffset=\"moof\" SampleDuration=\"512\" TrackID=\"1\">\r\n...\r\n```\r\nThe value 0 in the TraxkExtendsBox ('trex') is superseded by the local value 512 in the TrackFragmentHeaderBox ('tfhd'). So the value 0 is not wrong.\r\nIf you look at the [DASHIF guidelines](http://dashif.org/wp-content/uploads/2015/04/DASH-IF-IOP-v3.0.pdf), it says (p.8 l21):\r\n> Default parameters and flags shall be stored in movie fragments (‘tfhd’ or ‘trun’ box) and not track headers (‘trex’ box) \r\n\r\nMP4Box follows that. We could possibly use the values in both places (tfhd and trex), this wouldn't hurt but would not be strictly compliant to the DASHIF guidelines.\r\n\r\nI believe we can close this bug. \r\n\r\n"}}