{"action":"created","issue":{"url":"https://api.github.com/repos/axiomatic-systems/Bento4/issues/53","labels_url":"https://api.github.com/repos/axiomatic-systems/Bento4/issues/53/labels{/name}","comments_url":"https://api.github.com/repos/axiomatic-systems/Bento4/issues/53/comments","events_url":"https://api.github.com/repos/axiomatic-systems/Bento4/issues/53/events","html_url":"https://github.com/axiomatic-systems/Bento4/pull/53","id":124263514,"number":53,"title":"Don't try to match anchor track fragmenting after it is finished.","user":{"login":"jgreer","id":29563,"avatar_url":"https://avatars.githubusercontent.com/u/29563?v=3","gravatar_id":"","url":"https://api.github.com/users/jgreer","html_url":"https://github.com/jgreer","followers_url":"https://api.github.com/users/jgreer/followers","following_url":"https://api.github.com/users/jgreer/following{/other_user}","gists_url":"https://api.github.com/users/jgreer/gists{/gist_id}","starred_url":"https://api.github.com/users/jgreer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgreer/subscriptions","organizations_url":"https://api.github.com/users/jgreer/orgs","repos_url":"https://api.github.com/users/jgreer/repos","events_url":"https://api.github.com/users/jgreer/events{/privacy}","received_events_url":"https://api.github.com/users/jgreer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-29T20:24:12Z","updated_at":"2016-01-01T05:57:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/axiomatic-systems/Bento4/pulls/53","html_url":"https://github.com/axiomatic-systems/Bento4/pull/53","diff_url":"https://github.com/axiomatic-systems/Bento4/pull/53.diff","patch_url":"https://github.com/axiomatic-systems/Bento4/pull/53.patch"},"body":"When a secondary track (audio) is slightly longer than the anchor track (video), the mp4fragment tries to match the fragment durations, creating an unexpected short segment at the end, like so:\r\n\r\n```\r\nfragment: track ID 1  60 samples\r\nfragment: track ID 2  86 samples\r\nfragment: track ID 1  60 samples\r\nfragment: track ID 2  86 samples\r\nfragment: track ID 1  32 samples\r\nfragment: track ID 2  46 samples\r\nfragment: track ID 2   3 samples\r\n```\r\n\r\nSo each fragment is approximately 2 seconds, except the final video fragment is about 1.07 seconds.  The audio is then fragmented into a 1.07 second fragment and a 0.035 second fragment, so that its durations match the video.\r\n\r\nInstead, the final audio fragment should be allowed to be up to 2 seconds long, ensuring consistent fragmenting.  With this patch applied, the fragmenting looks like the following:\r\n\r\n```\r\nfragment: track ID 1  60 samples\r\nfragment: track ID 2  86 samples\r\nfragment: track ID 1  60 samples\r\nfragment: track ID 2  86 samples\r\nfragment: track ID 1  32 samples\r\nfragment: track ID 2  49 samples\r\n```"},"comment":{"url":"https://api.github.com/repos/axiomatic-systems/Bento4/issues/comments/168286188","html_url":"https://github.com/axiomatic-systems/Bento4/pull/53#issuecomment-168286188","issue_url":"https://api.github.com/repos/axiomatic-systems/Bento4/issues/53","id":168286188,"user":{"login":"barbibulle","id":2460045,"avatar_url":"https://avatars.githubusercontent.com/u/2460045?v=3","gravatar_id":"","url":"https://api.github.com/users/barbibulle","html_url":"https://github.com/barbibulle","followers_url":"https://api.github.com/users/barbibulle/followers","following_url":"https://api.github.com/users/barbibulle/following{/other_user}","gists_url":"https://api.github.com/users/barbibulle/gists{/gist_id}","starred_url":"https://api.github.com/users/barbibulle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barbibulle/subscriptions","organizations_url":"https://api.github.com/users/barbibulle/orgs","repos_url":"https://api.github.com/users/barbibulle/repos","events_url":"https://api.github.com/users/barbibulle/events{/privacy}","received_events_url":"https://api.github.com/users/barbibulle/received_events","type":"User","site_admin":false},"created_at":"2016-01-01T05:57:52Z","updated_at":"2016-01-01T05:57:52Z","body":"The current behavior may seem a bit odd, but there's a rationale behind it: the tool tries to match audio and video segments so they are of equal duration. If the audio is too long, then you do end up with an \"extra\" segment of audio, which you would normally ignore (there shouldn't be more audio than video in a normal presentation).\r\nThere's a command line option, --trim, which can be used to simply discard this extra media in case the media is mismatched."}}