{"action":"created","issue":{"url":"https://api.github.com/repos/gpac/gpac/issues/298","labels_url":"https://api.github.com/repos/gpac/gpac/issues/298/labels{/name}","comments_url":"https://api.github.com/repos/gpac/gpac/issues/298/comments","events_url":"https://api.github.com/repos/gpac/gpac/issues/298/events","html_url":"https://github.com/gpac/gpac/issues/298","id":113414064,"number":298,"title":"negative time sample causing loss of data","user":{"login":"NathanLewis","id":1850390,"avatar_url":"https://avatars.githubusercontent.com/u/1850390?v=3","gravatar_id":"","url":"https://api.github.com/users/NathanLewis","html_url":"https://github.com/NathanLewis","followers_url":"https://api.github.com/users/NathanLewis/followers","following_url":"https://api.github.com/users/NathanLewis/following{/other_user}","gists_url":"https://api.github.com/users/NathanLewis/gists{/gist_id}","starred_url":"https://api.github.com/users/NathanLewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NathanLewis/subscriptions","organizations_url":"https://api.github.com/users/NathanLewis/orgs","repos_url":"https://api.github.com/users/NathanLewis/repos","events_url":"https://api.github.com/users/NathanLewis/events{/privacy}","received_events_url":"https://api.github.com/users/NathanLewis/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-10-26T17:57:12Z","updated_at":"2015-11-19T17:28:23Z","closed_at":"2015-11-19T14:11:09Z","body":"In line 8166 of src/media_tools/media_import.c as of commit f2dc63a1608619bc625451a7d9ef7a5b760bfbac\r\n\r\nThere is the conditional statement\r\n```\r\nif (samp->DTS >= pck->stream->first_dts) {\r\n.\r\n.\r\n} else {\r\n      GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS Import] negative time sample - skipping\\n\"));\r\n}\r\n```\r\nWe have found that the samp->DTS value appears to wraparound causing mp4box to needlessly drop data. \r\nI have made a very simple patch in my own fork of gpac, https://github.com/NathanLewis/gpac that appears to fix the problem.\r\n\r\nI have .ts input file which reproduces the data loss problem which I am happy to provide to anyone investigating this but cannot make world viewable due to copyright issues.\r\n\r\nThanks,\r\nNathan"},"comment":{"url":"https://api.github.com/repos/gpac/gpac/issues/comments/158128207","html_url":"https://github.com/gpac/gpac/issues/298#issuecomment-158128207","issue_url":"https://api.github.com/repos/gpac/gpac/issues/298","id":158128207,"user":{"login":"dholroyd","id":512165,"avatar_url":"https://avatars.githubusercontent.com/u/512165?v=3","gravatar_id":"","url":"https://api.github.com/users/dholroyd","html_url":"https://github.com/dholroyd","followers_url":"https://api.github.com/users/dholroyd/followers","following_url":"https://api.github.com/users/dholroyd/following{/other_user}","gists_url":"https://api.github.com/users/dholroyd/gists{/gist_id}","starred_url":"https://api.github.com/users/dholroyd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dholroyd/subscriptions","organizations_url":"https://api.github.com/users/dholroyd/orgs","repos_url":"https://api.github.com/users/dholroyd/repos","events_url":"https://api.github.com/users/dholroyd/events{/privacy}","received_events_url":"https://api.github.com/users/dholroyd/received_events","type":"User","site_admin":false},"created_at":"2015-11-19T17:28:23Z","updated_at":"2015-11-19T17:28:23Z","body":"It seems that in trying to come up with the smallest possible example file, the result has ended up not being perfectly representative.  Apologies! I don't think we are expecting to deal with a multi-second gap, in addition to wraparound!\r\n\r\nThe workflow hitting an issue was basically,\r\n * make a .ts file from a 'period of interest' within a live stream (that runs 24/7/365)\r\n * use mp4box to convert the .ts to mp4\r\n\r\nObviously there will be a point in the stream every ~26.5 hours that will contain a wraparound of the 33-bit PCR, and if the 'period of interest' in the above steps happened to contain that point, the output from mp4box would have been truncated.\r\n\r\nIt seems the example that was provided is also missing 72 seconds of content -- suspiciously, an integer multiple of the 8-second chunks the input .ts is constructed from.  (Maybe not quite the right chunks got assembled in the test asset, or there is actually some other problem in the pre-mp4box workflow!)"}}