c# - Mitigating suspension and/or termination while encoding video in an app -


i have windows store app option export data in video file format. app in c#, encoding handled dropping c++ library adapted this sample david catuhe , working well. problem have found encoding process can take long time when run @ high quality, , if screen times out (say, on surface rt) or user switches apps, process fails. i'm not entirely sure source of failure , working verify it, if process able survive suspension without changes, don't know how handle being tombstoned.

i can live encoding being interrupted in situations. don't want have start on scratch if app goes away reason.

as far can tell, isn't feasible close stream without finalizing video , resume writing later. in light of this, have considered few options, can't tell which, if any, might work. i'd grateful direction.

1) if possible, it'd great able close stream , reopen later, picking left off. @ moment haven't been able work, if should work i'd love know.

2) push encode process background task, either start or when tombstoned. there way pass open stream app background task? if not, there way app's background task run without cpu/memory limitations @ least while app in foreground? because doing whole encode within tight constraints bind background tasks take years.

3) render segments of video progressively while app in foreground , stitch parts @ end. way, if encode interrupted can pick @ recent segment. reading should possible in theory (i think falls under category of remuxing, avoid need re-encode video). haven't found samples cover scenario, not in c++ (which have no experience with). transcode api doesn't seem cover joining multiple samples. i've looked using sharpdx it, candidate i'd want use (a media session) exposed desktop apps.

4) push work off either desktop or server app. problem want have run on windows rt (so desktop out) , don't have business model can support servers capable of handling such intensive work on customers' behalf.

so question is, best line of attack here? there way hold onto stream across suspension? , if, suspect, option #3 best bet, know of samples or guides on how it? c# options preferred, hope overlooking one. c++ might ok (as mr. catuhe's sample got me far), i'm afraid i'd need pretty specific guidance. msdn documentation on this, incidentally, high-level have vague idea of pieces need assemble , each requires, let alone how write actual program in c++.

any offer appreciated.

unfortunately don't have enough reputation points on comment have give answer.

you consider combination of #3 , #4. render in segments within app , upload segments stitching together. bring realms of using commodity solution create final output.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -